getName() public method

Get name
public getName ( ) : string
return string
示例#1
0
 /**
  * Populates document with bundle data.
  *
  * @param \Solarium_Document_ReadWrite $document
  * @param Bundle                       $bundle
  * @param \Solarium_Query_Helper       $helper
  */
 private function updateDocumentFromBundle(\Solarium_Document_ReadWrite $document, Bundle $bundle, \Solarium_Query_Helper $helper)
 {
     $document->setField('id', $bundle->getId());
     $document->setField('name', $bundle->getName());
     $document->setField('ownerName', $bundle->getOwnerName());
     $document->setField('ownerType', $bundle->getOwnerType());
     $document->setField('fullName', $bundle->getFullName());
     $document->setField('description', $bundle->getDescription());
     $document->setField('readme', $bundle->getReadme());
     $document->setField('totalScore', $bundle->getScore());
     $document->setField('state', $bundle->getState());
     $document->setField('avatarUrl', $bundle->getOwner()->getAvatarUrl());
     $document->setField('lastCommitAt', $helper->formatDate(clone $bundle->getLastCommitAt()));
     $document->setField('lastTweetedAt', null !== $bundle->getLastTweetedAt() ? $helper->formatDate($bundle->getLastTweetedAt()) : null);
     $keywords = array();
     foreach ($bundle->getKeywords() as $keyword) {
         $keywords[mb_strtolower($keyword->getValue(), 'UTF-8')] = true;
     }
     $document->setField('keywords', array_keys($keywords));
 }
示例#2
0
 /**
  * Updates repo based on status from travis.
  *
  * @param  Bundle $bundle
  *
  * @return boolean
  */
 public function update(Bundle $bundle)
 {
     $this->output->write(' Travis status:');
     $response = $this->browser->get('http://travis-ci.org/' . $bundle->getOwnerName() . '/' . $bundle->getName() . '.json');
     $status = json_decode($response->getContent(), true);
     if (JSON_ERROR_NONE === json_last_error()) {
         $lastBuildAt = new \DateTime();
         $lastBuildAt->setTimestamp(strtotime($status['last_build_finished_at']));
         // Only execute if date of last build is older than last update of bundle
         if ($lastBuildAt < $bundle->getUpdatedAt()) {
             $state = Activity::STATE_UNKNOWN;
             if (0 === $status['last_build_status']) {
                 $bundle->setTravisCiBuildStatus(true);
                 $state = Activity::STATE_OPEN;
                 $this->output->write(' success');
             } elseif (1 === $status['last_build_status']) {
                 $bundle->setTravisCiBuildStatus(false);
                 $state = Activity::STATE_CLOSED;
                 $this->output->write(' failed');
             }
             if (Activity::STATE_UNKNOWN !== $state) {
                 $activity = new Activity();
                 $activity->setType(Activity::ACTIVITY_TYPE_TRAVIS_BUILD);
                 $activity->setState($state);
                 $activity->setBundle($bundle);
                 return true;
             }
         } else {
             $this->output->write(' skipped');
             return true;
         }
     }
     $bundle->setTravisCiBuildStatus(null);
     $this->output->write(' error');
     return false;
 }
示例#3
0
 private function tryToValidateWithComposerFile(Bundle $bundle, Contents $contentApi)
 {
     $validComposer = false;
     try {
         $file = $contentApi->show($bundle->getOwnerName(), $bundle->getName(), 'composer.json');
         $composer = $this->decodeFileContent($file, true);
         if (JSON_ERROR_NONE === json_last_error()) {
             if (isset($composer['type']) && false !== strpos(strtolower($composer['type']), 'symfony')) {
                 $validComposer = true;
             }
             if (isset($composer['autoload']['psr-0'])) {
                 foreach ($composer['autoload']['psr-0'] as $key => $value) {
                     if (preg_match('/\\\\(.*)(\\w*)Bundle$/', $key) > 0) {
                         $validComposer = true;
                     }
                 }
             }
             if (isset($composer['autoload']['psr-4'])) {
                 foreach ($composer['autoload']['psr-4'] as $key => $value) {
                     if (preg_match('/\\\\(.*)(\\w*)Bundle$/', $key) > 0) {
                         $validComposer = true;
                     }
                 }
             }
         }
     } catch (RuntimeException $e) {
         $validComposer = false;
     }
     return $validComposer;
 }
示例#4
0
文件: Repo.php 项目: ruian/KnpBundles
 public function getContributorNames(Entity\Bundle $bundle)
 {
     try {
         $contributors = $this->github->getRepoApi()->getRepoContributors($bundle->getUsername(), $bundle->getName());
     } catch (\Github_HttpClient_Exception $e) {
         if (404 == $e->getCode()) {
             return array();
         }
         throw $e;
     }
     $names = array();
     foreach ($contributors as $contributor) {
         if ($bundle->getUsername() != $contributor['login']) {
             $names[] = $contributor['login'];
         }
     }
     return $names;
 }
示例#5
0
 /**
  * @param Bundle $bundle
  */
 public function setBundle(Bundle $bundle)
 {
     $this->bundle = $bundle;
     $this->bundleName = $bundle->getName();
     $this->bundleOwnerName = $bundle->getOwnerName();
     $bundle->addActivity($this);
 }
示例#6
0
 /**
  * Get repository status for Repo
  * 
  * @param Entity\Bundle $repo
  * @return array
  */
 protected function getTravisDataForRepo(Entity\Bundle $repo)
 {
     return $this->getTravisData($repo->getUsername() . "/" . $repo->getName());
 }
示例#7
0
 /**
  * @param \Knp\Bundle\KnpBundlesBundle\Entity\Bundle $bundle
  * @return string
  */
 protected function getRepoDir(BundleEntity $repo)
 {
     return $this->dir . DIRECTORY_SEPARATOR . $repo->getOwnerName() . DIRECTORY_SEPARATOR . $repo->getName();
 }
示例#8
0
 public function getRepoDir(BundleEntity $repo)
 {
     return $this->dir . '/' . $repo->getUsername() . '/' . $repo->getName();
 }
 /**
  * @param Bundle $trendingBundle
  *
  * @return string
  */
 private function prepareMessage(Bundle $trendingBundle)
 {
     $bundleName = $trendingBundle->getName();
     $url = 'knpbundles.com/' . $trendingBundle->getOwnerName() . '/' . $bundleName;
     return str_replace(array('{name}', '{url}'), array($bundleName, $url), $this->twitterParams['tweet_template']);
 }
示例#10
0
 /**
  * Get badge image full path
  *
  * @param Bundle $bundle
  * @param string $type
  *
  * @return string
  */
 protected function getBadgeFile(Bundle $bundle, $type = self::LONG)
 {
     return $this->cacheDir . '/badges/' . $type . '/' . $bundle->getOwnerName() . '-' . $bundle->getName() . '.png';
 }