Exemple #1
0
    /**
     * Gets the 'method_call1' service.
     *
     * This service is shared.
     * This method always returns the same instance of the service.
     *
     * @return FooClass A FooClass instance.
     */
    protected function getMethodCall1Service()
    {
        require_once '%path%foo.php';

        $this->services['method_call1'] = $instance = new \FooClass();

        $instance->setBar($this->get('foo'));
        $instance->setBar($this->get('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE));
        if ($this->has('foo3')) {
            $instance->setBar($this->get('foo3', ContainerInterface::NULL_ON_INVALID_REFERENCE));
        }
        if ($this->has('foobaz')) {
            $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
        }

        return $instance;
    }
 /**
  * Gets the 'method_call1' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return FooClass A FooClass instance.
  */
 protected function getMethodCall1Service()
 {
     if (isset($this->shared['method_call1'])) {
         return $this->shared['method_call1'];
     }
     $instance = new FooClass();
     $this->shared['method_call1'] = $instance;
     $instance->setBar($this->getFooService());
     $instance->setBar($this->getService('foo', Container::NULL_ON_INVALID_REFERENCE));
     if ($this->hasService('foo')) {
         $instance->setBar($this->getService('foo', Container::NULL_ON_INVALID_REFERENCE));
     }
     if ($this->hasService('foobaz')) {
         $instance->setBar($this->getService('foobaz', Container::NULL_ON_INVALID_REFERENCE));
     }
     return $instance;
 }
 /**
  * Gets the 'foo' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return FooClass A FooClass instance.
  */
 protected function getFooService()
 {
     $this->services['foo'] = $instance = new \FooClass();
     $instance->setBar('someValue');
     return $instance;
 }
 /**
  * Gets the 'method_call1' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \FooClass A FooClass instance.
  */
 protected function getMethodCall1Service()
 {
     require_once '%path%foo.php';
     $this->services['method_call1'] = $instance = new \FooClass();
     $instance->setBar($this->get('foo'));
     $instance->setBar(NULL);
     return $instance;
 }
 /**
  * Gets the 'method_call1' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \FooClass A FooClass instance.
  */
 protected function getMethodCall1Service()
 {
     require_once '%path%foo.php';
     $this->services['method_call1'] = $instance = new \FooClass();
     $instance->setBar($this->get('foo'));
     $instance->setBar(NULL);
     $instance->setBar($this->get("foo")->foo() . ($this->hasparameter("foo") ? $this->getParameter("foo") : "default"));
     return $instance;
 }