Knp\Bundle\KnpBundlesBundle\Github\Repo::validate PHP Method

validate() public method

public validate ( Bundle $bundle ) : boolean
$bundle Knp\Bundle\KnpBundlesBundle\Entity\Bundle
return boolean
    public function validate(Bundle $bundle)
    {
        $valid = false;
        try {
            $contentApi = $this->github->api('repo')->contents();
            $valid = $this->tryToValidateWithComposerFile($bundle, $contentApi);
            if (!$valid) {
                $treeApi = $this->github->api('git')->trees();
                $valid = $this->tryToValidateWithFiles($bundle, $treeApi, $contentApi);
            }
        } catch (RuntimeException $e) {
            $valid = false;
        }
        return $valid;
    }

Usage Example

コード例 #1
0
ファイル: BundleManager.php プロジェクト: KnpLabs/KnpBundles
 /**
  * @param string $name
  * @param string $ownerName
  *
  * @return boolean|Bundle return false if the bundle is not valid
  */
 private function createFullBundle($name, $ownerName)
 {
     $bundle = $this->createEmptyBundle($name);
     $bundle->setOwnerName($ownerName);
     if (!$this->repoApi->validate($bundle)) {
         return false;
     }
     if (!$this->repoApi->updateInfos($bundle)) {
         return false;
     }
     $owner = $this->ownerManager->createOwner($ownerName, 'unknown', false);
     if (!$owner) {
         return false;
     }
     $owner->addBundle($bundle);
     return $bundle;
 }
All Usage Examples Of Knp\Bundle\KnpBundlesBundle\Github\Repo::validate