Exemplo n.º 1
0
 /**
  * @param ClassName $className
  *
  * @return ObjectInterface
  */
 public function getConfigurationObjectForClass(ClassName $className) : ObjectInterface
 {
     if (isset($this->objects[$className->getIdentifier()]) === true) {
         return $this->objects[$className->getIdentifier()];
     }
     return new Blackhole();
 }
Exemplo n.º 2
0
 /**
  * Create $className object with data
  *
  * @param ClassName $className
  * @param mixed[] $data
  *
  * @return object|object[]
  */
 private function setObjectForClass(ClassName $className, array $data)
 {
     $fqdnClass = $className->getValue();
     $object = new $fqdnClass();
     foreach ($data as $attribute => $value) {
         $configurationObject = $this->configuration->getConfigurationObjectForClass($className);
         $type = $configurationObject->getTypeForAttribute($attribute);
         $this->processDeserializeForType($type, $object, $value);
     }
     return $object;
 }