Exemplo n.º 1
0
 private function getForkeeInfo(array $event)
 {
     $owner = $event['payload']['forkee']['owner'];
     $ou = new User($owner['id'], $owner['login'], $owner['type']);
     $fork = new Repository($event['forkee']['id'], $event['forkee']['name']);
     $fork->setOwner($ou);
     return $fork;
 }
 private function processBranch(array $branch)
 {
     $b = new Branch();
     $b->setLabel($branch['label']);
     $b->setReferenceName($branch['ref']);
     $u = new User($branch['user']['id'], $branch['user']['login'], $branch['user']['type']);
     $b->setUser($u);
     if (!empty($branch['repo'])) {
         $repo = new Repository($branch['repo']['id'], $branch['repo']['name']);
         $owner = new User($branch['repo']['owner']['id'], $branch['repo']['owner']['login'], $branch['repo']['owner']['type']);
     } else {
         $repoId = crc32($u->getLogin() . $b->getLabel());
         $repoName = $b->getLabel();
         $repo = new Repository($repoId, $repoName);
         $owner = new User($u->getId(), $u->getLogin(), $branch['user']['type']);
     }
     $repo->setOwner($owner);
     $b->setRepository($repo);
     return $b;
 }