Exemplo n.º 1
0
 /**
  * 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;
 }