Exemplo n.º 1
0
 public function import($scope)
 {
     if (!$this->className) {
         throw new WrongStateException("no class defined for PrimitiveIdentifier '{$this->name}'");
     }
     $className = $this->className;
     if (isset($scope[$this->name]) && $scope[$this->name] instanceof $className) {
         $value = $scope[$this->name];
         $this->raw = $this->actualExportValue($value);
         $this->setValue($value);
         return $this->imported = true;
     }
     $result = parent::import($scope);
     if ($result === true) {
         try {
             $result = $this->actualImportValue($this->value);
             Assert::isInstance($result, $className);
             $this->value = $result;
             return true;
         } catch (WrongArgumentException $e) {
             // not imported
         } catch (ObjectNotFoundException $e) {
             // not imported
         }
         $this->value = null;
         return false;
     }
     return $result;
 }
Exemplo n.º 2
0
 public function import($scope)
 {
     $result = parent::import($scope);
     if ($result === true) {
         try {
             $this->value = $this->makeRegistryById($this->value);
         } catch (MissingElementException $e) {
             $this->value = null;
             return false;
         }
         return true;
     }
     return $result;
 }
Exemplo n.º 3
0
 public function import($scope)
 {
     if (!$this->className) {
         throw new WrongStateException("no class defined for PrimitiveEnumeration '{$this->name}'");
     }
     $result = parent::import($scope);
     if ($result === true) {
         try {
             $this->value = new $this->className($this->value);
         } catch (MissingElementException $e) {
             $this->value = null;
             return false;
         }
         return true;
     }
     return $result;
 }