/**
  * {@inheritdoc}
  */
 public function execute()
 {
     // sanity check
     if ($this->typeDescriptor->isLoaded()) {
         return;
     }
     // never fails with the check before
     $this->typeDescriptor->load($this->containingPackage);
     $typeName = $this->typeDescriptor->getTypeName();
     $packageName = $this->containingPackage->getName();
     if ($this->typeDescriptors->contains($typeName, $packageName)) {
         // never fails with the check before
         $this->previousDescriptor = $this->typeDescriptors->get($typeName, $packageName);
     }
     // never fails
     $this->typeDescriptors->add($this->typeDescriptor);
 }
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     // sanity check
     if (!$this->typeDescriptor->isLoaded()) {
         return;
     }
     // never fails with the check before
     $this->containingModule = $this->typeDescriptor->getContainingModule();
     $typeName = $this->typeDescriptor->getTypeName();
     $moduleName = $this->containingModule->getName();
     // never fails with the check before
     $this->typeDescriptor->unload();
     if ($this->typeDescriptors->contains($typeName, $moduleName) && $this->typeDescriptor === $this->typeDescriptors->get($typeName, $moduleName)) {
         // never fails
         $this->typeDescriptors->remove($typeName, $moduleName);
         $this->wasRemoved = true;
     }
 }
 /**
  * {@inheritdoc}
  */
 public function getBindingType($typeName, $packageName)
 {
     Assert::string($typeName, 'The type name must be a string. Got: %s');
     Assert::string($packageName, 'The package name must be a string. Got: %s');
     $this->assertPackagesLoaded();
     if (!$this->typeDescriptors->contains($typeName, $packageName)) {
         throw NoSuchTypeException::forTypeName($typeName);
     }
     return $this->typeDescriptors->get($typeName, $packageName);
 }
Beispiel #4
0
 /**
  * {@inheritdoc}
  */
 public function getTypeDescriptor($typeName, $moduleName)
 {
     Assert::string($typeName, 'The type name must be a string. Got: %s');
     Assert::string($moduleName, 'The module name must be a string. Got: %s');
     $this->assertModulesLoaded();
     if (!$this->typeDescriptors->contains($typeName, $moduleName)) {
         throw NoSuchTypeException::forTypeName($typeName);
     }
     return $this->typeDescriptors->get($typeName, $moduleName);
 }