diff options
author | Thomas Mueller <thomas.mueller@tmit.eu> | 2012-09-07 15:21:03 +0200 |
---|---|---|
committer | Thomas Mueller <thomas.mueller@tmit.eu> | 2012-09-07 15:21:03 +0200 |
commit | a59854cc809828501371dc934362c81a82e83cee (patch) | |
tree | 24e9172389f9fdf3aaaac50452f90c8dc9e77ed1 /lib/feedmapper.php | |
parent | ce2e3bd0cba51d5625c53d14bd58204eca89eaf2 (diff) |
adding space between) and {
Diffstat (limited to 'lib/feedmapper.php')
-rw-r--r-- | lib/feedmapper.php | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/feedmapper.php b/lib/feedmapper.php index eec3ade64..85797c44c 100644 --- a/lib/feedmapper.php +++ b/lib/feedmapper.php @@ -20,7 +20,7 @@ class FeedMapper { const tableName = '*PREFIX*news_feeds'; private $userid; - public function __construct($userid = null){ + public function __construct($userid = null) { if ($userid !== null) { $this->userid = $userid; } @@ -32,7 +32,7 @@ class FeedMapper { * @param row a row from the feeds table of the database * @returns an object of the class OCA\News\Feed */ - public function fromRow($row){ + public function fromRow($row) { $url = $row['url']; $title = $row['title']; $id = $row['id']; @@ -48,10 +48,10 @@ class FeedMapper { * @param userid * @returns */ - public function findAll(){ + public function findAll() { $query = 'SELECT * FROM ' . self::tableName; $params = array(); - if( $this->userid ){ + if( $this->userid ) { $query = $query.' WHERE user_id = ?'; $params[] = $this->userid; } @@ -75,7 +75,7 @@ class FeedMapper { * @param id The id of the feed in the database table. * @returns */ - public function findById($id){ + public function findById($id) { $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE id = ?'); $result = $stmt->execute(array($id)); if(!$row = $result->fetchRow()) @@ -89,7 +89,7 @@ class FeedMapper { * @param folderid The id of the folder in the database table. * @returns a list of feeds */ - public function findByFolderId($folderid){ + public function findByFolderId($folderid) { $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE user_id = ? AND folder_id = ?'); $result = $stmt->execute(array($this->userid, $folderid)); $feeds = array(); @@ -106,7 +106,7 @@ class FeedMapper { * @param id The id of the feed in the database table. * @returns an instance of OCA\News\Feed */ - public function findWithItems($id){ + public function findWithItems($id) { $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE id = ?'); $result = $stmt->execute(array($id)); $row = $result->fetchRow(); @@ -125,25 +125,25 @@ class FeedMapper { * @return id of the feed corresponding to the url passed as parameters * null - if there is no such feed */ - public function findIdFromUrl($url){ + public function findIdFromUrl($url) { $url_hash = md5($url); $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' WHERE url_hash = ?'); $result = $stmt->execute(array($url_hash)); $row = $result->fetchRow(); $id = null; - if ($row != null){ + if ($row != null) { $id = $row['id']; } return $id; } - public function mostRecent(){ + public function mostRecent() { //FIXME: does something like SELECT TOP 1 * exists in pear/mdb2 ?? $stmt = \OCP\DB::prepare('SELECT * FROM ' . self::tableName . ' ORDER BY lastmodified'); $result = $stmt->execute(); $row = $result->fetchRow(); $id = null; - if ($row != null){ + if ($row != null) { $id = $row['id']; } return $id; @@ -155,7 +155,7 @@ class FeedMapper { * @returns The id of the feed in the database table. */ //TODO: handle error case - public function save(Feed $feed, $folderid){ + public function save(Feed $feed, $folderid) { $title = $feed->getTitle(); $url = $feed->getUrl(); $url_hash = md5($url); @@ -169,7 +169,7 @@ class FeedMapper { //FIXME: Detect when feed contains already a database id $feedid = $this->findIdFromUrl($url); - if ($feedid === null){ + if ($feedid === null) { $query = \OCP\DB::prepare(" INSERT INTO " . self::tableName . "(url, url_hash, title, favicon_link, folder_id, user_id, added, lastmodified) @@ -209,7 +209,7 @@ class FeedMapper { $items = $feed->getItems(); if ($items !== null) { - foreach($items as $item){ + foreach($items as $item) { $itemMapper->save($item, $feedid); } } @@ -218,7 +218,7 @@ class FeedMapper { } - public function deleteById($id){ + public function deleteById($id) { if ($id == null) { return false; } @@ -233,12 +233,12 @@ class FeedMapper { return true; } - public function delete(Feed $feed){ + public function delete(Feed $feed) { $id = $feed->getId(); return deleteById($id); } - public function deleteAll($folderid){ + public function deleteAll($folderid) { if ($folderid == null) { return false; } |