Example #1
0
 /**
  * Converts the given value so that it can be hydrated by the hydrator.
  *
  * @param mixed $value The original value.
  * @param array $data (optional) The original data for context.
  * @return mixed Returns the value that should be hydrated.
  */
 public function hydrate($value)
 {
     if ($value instanceof StateInterface) {
         return $value;
     }
     if (is_string($value)) {
         if ($this->checkPlugin() && $this->plugins->has($value)) {
             return $this->plugins->get($value);
         }
         throw new \RuntimeException(sprintf('No service registered in %s with name %s', is_object($this->plugins) ? get_class($this->plugins) : gettype($this->plugins), $value));
     }
     if (empty($value) && $this->checkPlugin() && $this->plugins->has($this->firstStateName)) {
         return $this->plugins->has($this->firstStateName);
     }
     // FIXME is correct? or exception
     return $value;
 }
 public function has($name, $checkAbstractFactories = true, $usePeeringServiceManagers = true)
 {
     if (is_string($name)) {
         // internally called with an array [normalizedName, requestedName].
         $this->incrementCallCount('has', $name);
     }
     return parent::has($name, $checkAbstractFactories, $usePeeringServiceManagers);
 }
 /**
  * {@inheritDoc}
  */
 public function has($name, $checkAbstractFactories = true, $usePeeringServiceManagers = true)
 {
     return parent::has($name, $checkAbstractFactories, false);
     // Don't look in peering service managers
 }
 /**
  * Override: do not use peering service managers
  *
  * @param  string|array $name
  * @param  bool         $checkAbstractFactories
  * @param  bool         $usePeeringServiceManagers
  * @return bool
  */
 public function has($name, $checkAbstractFactories = true, $usePeeringServiceManagers = false)
 {
     return parent::has($name, $checkAbstractFactories, $usePeeringServiceManagers);
 }