/** * @inheritdoc * * @param string $name * @param array $options * @param bool $usePeeringServiceManagers * @return JobInterface */ public function get($name, $options = [], $usePeeringServiceManagers = true) { // parent::get calls validatePlugin() so we're sure $instance is a JobInterface $instance = parent::get($name, $options, $usePeeringServiceManagers); $instance->setMetadata('__name__', $name); return $instance; }
public function get($name, $options = array(), $usePeeringServiceManagers = true) { $plugin = parent::get($name, $options, $usePeeringServiceManagers); $plugin->setConfig($this->getConfig()->{$name}); $plugin->setObjectManager($this->getObjectManager()); return $plugin; }
/** * Override: do not use peering service managers * * @param string $name * @param array $options * @param bool $usePeeringServiceManagers * @return mixed */ public function get($name, $options = [], $usePeeringServiceManagers = false) { if (is_string($options)) { $options = ['class_name' => $options]; } return parent::get($name, $options, $usePeeringServiceManagers); }
/** * Retrieve a registered instance * * After the plugin is retrieved from the service locator, inject the * controller in the plugin every time it is requested. This is required * because a controller can use a plugin and another controller can be * dispatched afterwards. If this second controller uses the same plugin * as the first controller, the reference to the controller inside the * plugin is lost. * * @param string $name * @param mixed $options * @param bool $usePeeringServiceManagers * @return mixed */ public function get($name, $options = array(), $usePeeringServiceManagers = true) { $plugin = parent::get($name, $options, $usePeeringServiceManagers); $this->injectController($plugin); return $plugin; }
/** * 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; }
/** * Override get to inject options as PatternOptions instance. * * {@inheritDoc} */ public function get($plugin, array $options = [], $usePeeringServiceManagers = true) { if (empty($options)) { return parent::get($plugin, [], $usePeeringServiceManagers); } $plugin = parent::get($plugin, [], $usePeeringServiceManagers); $plugin->setOptions(new Pattern\PatternOptions($options)); return $plugin; }
/** * {@inheritDoc} */ public function get($name, $options = [], $usePeeringServiceManagers = true) { try { $instance = parent::get($name, $options, $usePeeringServiceManagers); } catch (ServiceNotFoundException $e) { $instance = new Fallback(); $instance->setServiceLocator($this->getServiceLocator()); } return $instance; }
/** * {@inheritDoc} */ public function get($name, $options = array(), $usePeeringServiceManagers = true) { $formElementManager = $this->getServiceLocator()->get('FormElementManager'); if ($formElementManager->has($name)) { $form = $formElementManager->get($name); if ($form instanceof FormInterface) { return $form; } } return parent::get($name, $options, $usePeeringServiceManagers); }
/** * Retrieve a service from the manager by name * * Allows passing an array of options to use when creating the instance. * createFromInvokable() will use these and pass them to the instance * constructor if not null and a non-empty array. * * @param string $name * @param array $options * @param bool $usePeeringServiceManagers * @return object * @throws InvalidPluginException */ public function get($name, $options = [], $usePeeringServiceManagers = true) { // If service not registered check the the Service Locator. if (!$this->has($name)) { return $this->getServiceLocator()->get($name); } if (isset($options['initialize'])) { $this->initialize = $options['initialize']; unset($options['initialize']); } $instance = parent::get($name, $options, $usePeeringServiceManagers); $this->validatePlugin($instance); return $instance; }
/** * Retrieve a service from the manager by name * * Allows passing an array of options to use when creating the instance. * createFromInvokable() will use these and pass them to the instance * constructor if not null and a non-empty array. * * @param string $name * @param string|array $options * @param bool $usePeeringServiceManagers * @return object */ public function get($name, $options = array(), $usePeeringServiceManagers = true) { if (is_string($options)) { $options = array('name' => $options); } return parent::get($name, $options, $usePeeringServiceManagers); }
/** * {@inheritDoc} */ public function get($name, $options = array(), $usePeeringServiceManagers = true) { return parent::get($name, $options, false); // Don't look in peering service managers }
/** * Override: do not use peering service manager to retrieve controller * * @param string $name * @param array $options * @param bool $usePeeringServiceManagers * @return mixed */ public function get($name, $options = array(), $usePeeringServiceManagers = false) { return parent::get($name, $options, $usePeeringServiceManagers); }
/** * {@inheritDoc} * * @return AbstractPlugin */ public function get($name, $options = array(), $usePeeringServiceManagers = true) { if (empty($options['name'])) { $options['name'] = $name; } return parent::get($name, $options, $usePeeringServiceManagers); }
public function get($name, $options = [], $usePeeringServiceManagers = true) { $this->incrementCallCount('get', $name, $options); return parent::get($name, $options, $usePeeringServiceManagers); }
/** * Retrieve a registered instance * * After the plugin is retrieved from the service locator, inject the * controller in the plugin every time it is requested. This is required * because a controller can use a plugin and another controller can be * dispatched afterwards. If this second controller uses the same plugin * as the first controller, the reference to the controller inside the * plugin is lost. * * @param string $name * @return DispatchableInterface */ public function get($name, array $options = null) { $plugin = parent::get($name, $options); $this->injectController($plugin); return $plugin; }