/** * @test */ public function fromArray() { $object = Sabel_ValueObject::fromArray(array("a" => 10, "b" => "20", "c" => true)); $this->assertEquals(10, $object->a); $this->assertEquals("20", $object->b); $this->assertEquals(true, $object->c); }
protected function getUserData() { $userId = $this->userId; $cache = UserCache::getInstance(); $data = $cache->read($userId); if ((ENVIRONMENT & PRODUCTION) > 0 && !$data) { list($fp) = $cache->lock($userId); $data = $this->_getUserData($userId); $cache->write($fp, $data); } if (!$data) { $data = $this->_getUserData($userId); } return Sabel_ValueObject::fromArray(array("userId" => $userId, "friends" => Follower::getFriends($userId, FRIENDS_ICON_LIMIT + 1), "friendsCount" => $data["friends"], "followersCount" => $data["followers"], "statusesCount" => $data["statuses"], "latestComment" => $data["comment"])); }