public function getItems() { $collection = new Collection; foreach ($this->_dbTable->fetchAll() as $item) { $collection->append($item->username); } return $collection; }
public function search($text) { $response = $this->_twitter->search($text); $factory = new Factory\Tweet; $collection = new Collection\Collection(); foreach ($response->results as $tweetData) { $tweet = $factory->create($tweetData); if (!$tweet->hasLocation()) { $tweet->setLocation($this->findLocationByUsername($tweet->getFrom())); } $collection->append($tweet); } return $collection; }
public function __construct(Collection\Collection $tweets) { $this->_tweets = $tweets->filter(new Tweet\Specification\HasLocation); }