Example #1
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct(new ParameterBag($this->getDefaultParameters()));
 }
Example #2
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->parameters = $this->getDefaultParameters();
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     $this->__bar = new stdClass();
     $this->__foo_bar = new stdClass();
     $this->__foo_baz = new stdClass();
 }
Example #4
0
  protected function getServiceCall($id, Reference $reference = null)
  {
    if ('service_container' === $id)
    {
      return '$this';
    }

    if (null !== $reference && Container::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior())
    {
      return sprintf('$this->getService(\'%s\', Container::NULL_ON_INVALID_REFERENCE)', $id);
    }
    else
    {
      if ($this->container->hasAlias($id))
      {
        $id = $this->container->getAlias($id);
      }

      if ($this->container->hasDefinition($id))
      {
        return sprintf('$this->get%sService()', Container::camelize($id));
      }

      return sprintf('$this->getService(\'%s\')', $id);
    }
  }
Example #5
0
    protected function addServiceAlias($alias, $id)
    {
        $name = Container::camelize($alias);
        $type = 'Object';
        if ($this->container->hasDefinition($id)) {
            $class = $this->container->getDefinition($id)->getClass();
            $type = 0 === strpos($class, '%') ? 'Object' : $class;
        }
        return <<<EOF

  /**
   * Gets the {$alias} service alias.
   *
   * @return {$type} An instance of the {$id} service
   */
  protected function get{$name}Service()
  {
    return {$this->getServiceCall($id)};
  }

EOF;
    }
Example #6
0
 /**
  * Gets all service ids.
  *
  * @return array An array of all defined service ids
  */
 public function getServiceIds()
 {
     return array_unique(array_merge(array_keys($this->getDefinitions()), array_keys($this->aliases), parent::getServiceIds()));
 }