コード例 #1
0
ファイル: ComposerManager.php プロジェクト: evaneos/berthe
 /**
  * Compose a Resource
  *
  * @param Resource $resource
  * @param string|null $scopeIdentifier
  * @param Scope|null $parentScopeInstance
  *
  * @return Scope
  */
 public function compose(Resource $resource, $scopeIdentifier = null, Scope $parentScopeInstance = null)
 {
     $scopeInstance = new Scope($this, $resource, $scopeIdentifier);
     // Update scope history
     if ($parentScopeInstance !== null) {
         // This will be the new children list of parents (parents parents, plus the parent)
         $scopeArray = $parentScopeInstance->getParentScopes();
         $scopeArray[] = $parentScopeInstance->getCurrentScope();
         $scopeInstance->setParentScopes($scopeArray);
     }
     return $scopeInstance;
 }