setNbForks() public method

Set forks
public setNbForks ( integer $nbForks )
$nbForks integer
Exemplo n.º 1
0
 /**
  * Return true if the Repo exists on GitHub, false otherwise
  *
  * @param Entity\Bundle $bundle
  * @param array $data
  * @return boolean whether the Repo exists on GitHub
  */
 public function updateInfos(Entity\Bundle $bundle)
 {
     $this->output->write(' infos');
     try {
         $data = $this->github->getRepoApi()->show($bundle->getUsername(), $bundle->getName());
     } catch (\Github_HttpClient_Exception $e) {
         if (404 == $e->getCode()) {
             return false;
         }
         throw $e;
     }
     if ($data['fork']) {
         if ($data['watchers'] >= 10) {
             // Let's try to keep a forked repo with lots of watchers
         } else {
             return false;
         }
     }
     $bundle->setDescription(empty($data['description']) ? null : $data['description']);
     $bundle->setNbFollowers($data['watchers']);
     $bundle->setNbForks($data['forks']);
     $bundle->setCreatedAt(new \DateTime($data['created_at']));
     $bundle->setHomepage(empty($data['homepage']) ? null : $data['homepage']);
     return $bundle;
 }
Exemplo n.º 2
0
 /**
  * @test
  */
 public function shouldNotHaveChangesWithOnlyChangedScore()
 {
     $bundle = new Bundle('knplabs/KnpMenuBundle');
     $bundle->setScore(1000);
     $bundle->setReadme('readme number one');
     $bundle->setLastCommitAt(new \DateTime('-10 day'));
     $bundle->setNbFollowers(100);
     $bundle->setNbForks(10);
     $beforeChange = $bundle->getStatusHash();
     $bundle->setScore(1100);
     $afterChange = $bundle->getStatusHash();
     $this->assertEquals($beforeChange, $afterChange);
 }
Exemplo n.º 3
0
 /**
  * Return true if the Repo exists on GitHub, false otherwise
  *
  * @param Bundle $bundle
  *
  * @return boolean whether the Repo exists on GitHub
  */
 public function updateInfos(Bundle $bundle)
 {
     $this->output->write(' infos');
     try {
         $data = $this->github->api('repo')->show($bundle->getOwnerName(), $bundle->getName());
     } catch (RuntimeException $e) {
         return false;
     }
     // Let's try to only keep a forked repo with lots of watchers
     if ($data['fork'] && $data['watchers'] < 10) {
         return false;
     }
     $bundle->setDescription(empty($data['description']) ? null : $data['description']);
     $bundle->setNbFollowers($data['watchers']);
     $bundle->setNbForks($data['forks']);
     $bundle->setIsFork($data['fork']);
     $bundle->setCreatedAt(new \DateTime($data['created_at']));
     $bundle->setHomepage(empty($data['homepage']) ? null : $data['homepage']);
     return true;
 }