コード例 #1
0
ファイル: ClientTest.php プロジェクト: balaorg/php-github-api
 public function testInjectApi()
 {
     $client = new Github_Client();
     $userApiMock = $this->getMockBuilder('Github_ApiInterface')->getMock();
     $client->setApi('user', $userApiMock);
     $this->assertSame($userApiMock, $client->getUserApi());
 }
コード例 #2
0
 public function update(Entity\User $user)
 {
     try {
         $data = $this->github->getUserApi()->show($user->getName());
     } catch (\Github_HttpClient_Exception $e) {
         if (404 == $e->getCode()) {
             // User has been removed
             return false;
         }
         return true;
     }
     $user->setEmail(isset($data['email']) ? $data['email'] : null);
     $user->setFullName(isset($data['name']) ? $data['name'] : null);
     $user->setCompany(isset($data['company']) ? $data['company'] : null);
     $user->setLocation(isset($data['location']) ? $data['location'] : null);
     $user->setBlog(isset($data['blog']) ? $data['blog'] : null);
     return true;
 }
コード例 #3
0
 function getTicket(array $p_aParams = array())
 {
     $github = new Github_Client();
     $ticket = $github->getIssueApi()->show('dragoonis', 'ppi-framework', $p_aParams['id']);
     //	    ppi_dump($ticket); exit;
     $ticket['id'] = $ticket['number'];
     $ticket['status'] = $ticket['state'];
     $ticket['ticket_type'] = 'bug';
     $ticket['severity'] = 'major';
     $ticket['created'] = $ticket['created_at'];
     $ticket['content'] = $ticket['body'];
     $user = $github->getUserApi()->show($ticket['user']);
     $ticket['user_fullname'] = $user['name'];
     $ticket['repo_name'] = 'ppi-framework';
     return $ticket;
     /*
     		$tickets = $this->select()
     					->columns('t.*, u.first_name user_fn, u.last_name user_ln, uu.first_name user_assigned_fn, uu.last_name user_assigned_ln, c.title category_name')
     					->from($this->getTableName() . ' t')
     					->leftJoin('ticket_category c', 't.category_id = c.id')
     					->leftJoin('users u', 't.user_id=u.id')
     					->leftJoin('users uu', 't.assigned_user_id=uu.id');
     
     		if(isset($p_aParams['keyword']) && $p_aParams['keyword'] != '') {
     			$sSecureSearchKeyword = $this->quote('%'. $p_aParams['keyword'] .'%');
     			$aOrWhere             = array(
     				't.id = '           . $sSecureSearchKeyword,
     				't.title LIKE '     . $sSecureSearchKeyword,
     				'ticket_type LIKE ' . $sSecureSearchKeyword,
     				't.severity LIKE '  . $sSecureSearchKeyword,
     				't.status LIKE '    . $sSecureSearchKeyword
     			);
     			$tickets = $tickets->where(implode(' OR ', $aOrWhere));
     		}
     
     		$tickets = $tickets
     			->where('t.id = ' . $this->quote($p_aParams['id']))
     			->order('created desc')
     			->getList()->fetch();
     		return $tickets;
     */
 }