Exemplo n.º 1
0
    public function testScoreEntity()
    {
        $entity = new Entity();
        $entity->setProfileImageUrl('https://pbs.twimg.com/profile_images/55875903/randomkitten_bigger.jpeg');
        $entity->setUserName('t_ishida');
        $entity->setUrl('https://twitter.com/t_ishida/status/677131650585640960');
        $entity->setBody('怒首領蜂一面番長
ステージ1~2(全2面)
ファイター=Type-A(朱里)
難易度=特攻隊長(Hard)
Score=4918110点
 https://t.co/Ojz2Hse28r https://t.co/btKIBBa5HT');
        $entity->setSubject($entity->getBody());
        $score = new Score($entity);
        $this->assertInstanceOf('\\DDP\\GangLeader\\Score', $score);
        $this->assertSame('1~2(全2面)', $score->getStage());
        $this->assertSame('特攻隊長(Hard)', $score->getDifficulty());
        $this->assertSame('4918110', $score->getScore());
        $this->assertSame('t_ishida', $score->getUserName());
        $this->assertSame('https://pbs.twimg.com/profile_images/55875903/randomkitten_bigger.jpeg', $score->getProfileImageUrl());
        $this->assertSame('https://twitter.com/t_ishida/status/677131650585640960', $score->getUrl());
        $this->assertSame('怒首領蜂一面番長
ステージ1~2(全2面)
ファイター=Type-A(朱里)
難易度=特攻隊長(Hard)
Score=4918110点
 https://t.co/Ojz2Hse28r https://t.co/btKIBBa5HT', $score->getBody());
        $this->assertSame('怒首領蜂一面番長
ステージ1~2(全2面)
ファイター=Type-A(朱里)
難易度=特攻隊長(Hard)
Score=4918110点
 https://t.co/Ojz2Hse28r https://t.co/btKIBBa5HT', $score->getSubject());
    }
Exemplo n.º 2
0
 public function run()
 {
     $maxId = null;
     $result = array();
     $limit = $this->getLimit();
     while (true) {
         $page = $this->client->get($this->buildUrl(), $this->buildQuery($maxId));
         if (!$page->statuses || count($result) >= $limit) {
             break;
         }
         foreach ($page->statuses as $row) {
             $entity = new Entity();
             $entity->setBody($row->text);
             $entity->setSubject($row->text);
             $entity->setCreatedAt($row->created_at);
             $entity->setUserName($row->user->screen_name);
             $entity->setProfileImageUrl($row->user->profile_image_url_https);
             $entity->setUrl('https://twitter.com/' . urlencode($row->user->screen_name) . '/statuses/' . urlencode($row->id));
             $result[] = $entity;
             $maxId = intval($row->id_str) - 1;
         }
     }
     return $result;
 }