contains() public method

Returns whether a module with the given name exists.
public contains ( string $name ) : boolean
$name string The module name.
return boolean Whether a module with this name exists.
コード例 #1
0
ファイル: PathMapping.php プロジェクト: puli/manager
 private function makeAbsolute($relativePath, Module $containingModule, ModuleList $modules)
 {
     // Reference to install path of other module
     if ('@' !== $relativePath[0] || false === ($pos = strpos($relativePath, ':'))) {
         return $containingModule->getInstallPath() . '/' . $relativePath;
     }
     $refModuleName = substr($relativePath, 1, $pos - 1);
     if (!$modules->contains($refModuleName)) {
         throw new NoSuchModuleException(sprintf('The module "%s" referenced in the resource path "%s" was not ' . 'found. Maybe the module is not installed?', $refModuleName, $relativePath));
     }
     $refModule = $modules->get($refModuleName);
     return $refModule->getInstallPath() . '/' . substr($relativePath, $pos + 1);
 }
コード例 #2
0
ファイル: ModuleManagerImpl.php プロジェクト: puli/manager
 /**
  * {@inheritdoc}
  */
 public function hasModule($name)
 {
     Assert::string($name, 'The module name must be a string. Got: %s');
     $this->assertModulesLoaded();
     return $this->modules->contains($name);
 }