diff options
author | Thomas Tanghus <thomas@tanghus.net> | 2013-09-19 11:27:13 +0200 |
---|---|---|
committer | Thomas Tanghus <thomas@tanghus.net> | 2013-09-19 11:27:13 +0200 |
commit | 314ca843e81c2e26e83d58391e313503e0f30ebd (patch) | |
tree | 93b4258186ee2ad517882346f59cd8c477c43e8d /lib | |
parent | 76f8be3b7aadbb2c78f6c341ef8919973275efc8 (diff) | |
download | nextcloud-server-314ca843e81c2e26e83d58391e313503e0f30ebd.tar.gz nextcloud-server-314ca843e81c2e26e83d58391e313503e0f30ebd.zip |
Updated method names and added a few more tests.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/itags.php | 6 | ||||
-rw-r--r-- | lib/tags.php | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/public/itags.php b/lib/public/itags.php index 047d4f5f40b..12643400548 100644 --- a/lib/public/itags.php +++ b/lib/public/itags.php @@ -65,7 +65,7 @@ interface ITags { * * @returns array */ - public function tags(); + public function getTags(); /** * Get the a list if items tagged with $tag. @@ -75,7 +75,7 @@ interface ITags { * @param string|integer $tag Tag id or name. * @return array An array of object ids or false on error. */ - public function idsForTag($tag); + public function getIdsForTag($tag); /** * Checks whether a tag is already saved. @@ -111,7 +111,7 @@ interface ITags { * @param int|null $id int Optional object id to add to this|these tag(s) * @return bool Returns false on error. */ - public function addMulti($names, $sync=false, $id = null); + public function addMultiple($names, $sync=false, $id = null); /** * Delete tag/object relations from the db diff --git a/lib/tags.php b/lib/tags.php index 3320d9ea1a8..2eaa603c1a3 100644 --- a/lib/tags.php +++ b/lib/tags.php @@ -96,7 +96,7 @@ class Tags implements \OCP\ITags { } if(count($defaultTags) > 0 && count($this->tags) === 0) { - $this->addMulti($defaultTags, true); + $this->addMultiple($defaultTags, true); } \OCP\Util::writeLog('core', __METHOD__.', tags: ' . print_r($this->tags, true), \OCP\Util::DEBUG); @@ -119,7 +119,7 @@ class Tags implements \OCP\ITags { \OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OCP\DB::getErrorMessage($result), \OCP\Util::ERROR); return false; } - return ($result->numRows() === 0); + return ((int)$result->numRows() === 0); } catch(\Exception $e) { \OCP\Util::writeLog('core', __METHOD__.', exception: '.$e->getMessage(), \OCP\Util::ERROR); @@ -138,7 +138,7 @@ class Tags implements \OCP\ITags { * * @return array */ - public function tags() { + public function getTags() { if(!count($this->tags)) { return array(); } @@ -167,7 +167,7 @@ class Tags implements \OCP\ITags { * @param string|integer $tag Tag id or name. * @return array An array of object ids or false on error. */ - public function idsForTag($tag) { + public function getIdsForTag($tag) { $result = null; if(is_numeric($tag)) { $tagId = $tag; @@ -293,7 +293,7 @@ class Tags implements \OCP\ITags { * @param int|null $id int Optional object id to add to this|these tag(s) * @return bool Returns false on error. */ - public function addMulti($names, $sync=false, $id = null) { + public function addMultiple($names, $sync=false, $id = null) { if(!is_array($names)) { $names = array($names); } @@ -456,7 +456,7 @@ class Tags implements \OCP\ITags { */ public function getFavorites() { try { - return $this->idsForTag(self::TAG_FAVORITE); + return $this->getIdsForTag(self::TAG_FAVORITE); } catch(\Exception $e) { \OCP\Util::writeLog('core', __METHOD__.', exception: ' . $e->getMessage(), \OCP\Util::ERROR); |