setDescription() public method

Set description
public setDescription ( string $description )
$description string
 public function setUp()
 {
     $kernel = static::createKernel();
     $kernel->boot();
     if ($kernel->getContainer()->getParameter('database_driver') == 'pdo_sqlite') {
         $this->markTestSkipped("The SQLite does not support joins.");
     }
     $this->em = $kernel->getContainer()->get('knp_bundles.entity_manager');
     $fileLocator = new FileLocator(__DIR__ . '/fixtures/');
     $path = $fileLocator->locate('trending-bundles.yml');
     $data = Yaml::parse($path);
     $developer = new Developer();
     $developer->setName('someName');
     $developer->setScore(0);
     $this->em->persist($developer);
     foreach ($data['bundles'] as $bundleName => $bundleData) {
         $bundle = new Bundle('vendor/' . $bundleName);
         $bundle->setDescription('some description');
         $bundle->setScore(100);
         $bundle->setOwner($developer);
         foreach ($bundleData['scores'] as $scoreData) {
             $bundle->setDescription(md5(time() . serialize($scoreData)));
             $score = new Score();
             $score->setDate(new \DateTime($scoreData['date']));
             $score->setBundle($bundle);
             $score->setValue($scoreData['value']);
             $this->em->persist($score);
         }
         $this->em->persist($bundle);
     }
     $this->em->flush();
 }
Exemplo n.º 2
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.º 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;
 }