Commit: 7abbdae7e11cd9facd85a2d8a215b023404a2861 Author: Levi Morrison <[email protected]> Wed, 10 Jul 2013 15:08:25 -0600 Parents: 4745ec337422c7b41b4c530f48cbd0e552670562 Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=7abbdae7e11cd9facd85a2d8a215b023404a2861 Log: Undoing some of my over-architecting from a couple years back. Also showing more items on the homepage. Changed paths: M Gateway/NewsFileSystemGateway.php M Gateway/NewsGateway.php M View/HomepageNewsView.php M index-beta.php Diff: diff --git a/Gateway/NewsFileSystemGateway.php b/Gateway/NewsFileSystemGateway.php index 849ac7f..6bc6bb2 100644 --- a/Gateway/NewsFileSystemGateway.php +++ b/Gateway/NewsFileSystemGateway.php @@ -37,18 +37,18 @@ class NewsFileSystemGateway implements NewsGateway { /** * @param int $max [optional] - * @return Traversable + * @return array */ public function getLatestArticles($max = 5) { - return new ArrayIterator(array_slice($this->articles, 0, $max)); + return array_slice($this->articles, 0, $max); } /** - * @param Traversable $categories + * @param array $categories * @param int $limit - * @return Traversable + * @return array */ - public function getArticlesForCategories(Traversable $categories, $limit = 5) { + public function getArticlesForCategories(array $categories, $limit = 5) { $result = array(); foreach ($this->articles as $item) { @@ -65,7 +65,7 @@ class NewsFileSystemGateway implements NewsGateway { } - return new ArrayIterator(array_slice($result, 0 , $limit)); + return array_slice($result, 0 , $limit); } diff --git a/Gateway/NewsGateway.php b/Gateway/NewsGateway.php index 991cac4..9af903a 100644 --- a/Gateway/NewsGateway.php +++ b/Gateway/NewsGateway.php @@ -5,16 +5,16 @@ interface NewsGateway { /** * @abstract * @param int $max [optional] - * @return Traversable + * @return array */ function getLatestArticles($max = 5); /** * @abstract - * @param Traversable $categories + * @param array $categories * @param int $limit [optional] - * @return Traversable + * @return array */ - function getArticlesForCategories(Traversable $categories, $limit = 5); + function getArticlesForCategories(array $categories, $limit = 5); } diff --git a/View/HomepageNewsView.php b/View/HomepageNewsView.php index 0f1d564..0d982ca 100644 --- a/View/HomepageNewsView.php +++ b/View/HomepageNewsView.php @@ -3,14 +3,14 @@ class HomepageNewsView { /** - * @var Traversable + * @var array */ protected $articles; /** - * @param Traversable $articles + * @param array $articles */ - public function __construct(Traversable $articles) { + public function __construct(array $articles) { $this->articles = $articles; } diff --git a/index-beta.php b/index-beta.php index f865675..74bbc01 100644 --- a/index-beta.php +++ b/index-beta.php @@ -79,9 +79,9 @@ if (is_array($CONF_TEASER) && $CONF_TEASER) { require_once './Gateway/NewsFileSystemGateway.php'; $NewsGateway = new NewsFileSystemGateway(); -$RecentNews = $NewsGateway->getArticlesForCategories(new ArrayIterator(array( +$RecentNews = $NewsGateway->getArticlesForCategories(array( "frontpage" -)), 2); +), 4); ob_start(); -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
