__construct() public method

public __construct ( string | null $class = null, array $arguments = [] )
$class string | null The service class
$arguments array An array of arguments to pass to the service constructor
Example #1
0
    /**
     * Constructor.
     *
     * @param string $parent The id of Definition instance to decorate.
     *
     * @api
     */
    public function __construct($parent)
    {
        parent::__construct();

        $this->parent = $parent;
        $this->changes = array();
    }
Example #2
0
 /**
  * Construct a definition.
  *
  * To avoid confusion, use the setters constructArgs() and addMethod().
  *
  * @param string $className       Name of the class (with full namespace if applicable).
  * @param array  $constructorArgs Non associative array of parameters.
  * @param array  $methods         Associative array of array($method => array(0 => array($param1, $param2...),
  *                                                                            1 => array($param1, $param2...).
  */
 public function __construct($className, array $constructorArgs = array(), array $methods = array())
 {
     parent::__construct($className, $constructorArgs);
     if ($methods) {
         $this->setMethods($methods);
     }
 }
 /**
  * Constructor.
  *
  * @param string $bundle A bundle name or empty string
  * @param string $engine The templating engine
  * @param array  $dirs   An array of directories to merge
  */
 public function __construct($bundle, $engine, array $dirs)
 {
     if (!count($dirs)) {
         throw new \InvalidArgumentException('You must provide at least one directory.');
     }
     parent::__construct();
     $this->addTag('assetic.templating.' . $engine)->addTag('assetic.formula_resource', array('loader' => $engine));
     if (1 == count($dirs)) {
         // no need to coalesce
         self::configureDefinition($this, $bundle, $engine, reset($dirs));
         return;
     }
     // gather the wrapped resource definitions
     $resources = array();
     foreach ($dirs as $dir) {
         $resources[] = $resource = new Definition();
         self::configureDefinition($resource, $bundle, $engine, $dir);
     }
     $this->setClass('%assetic.coalescing_directory_resource.class%')->addArgument($resources)->setPublic(false);
 }
 /**
  * Constructor.
  *
  * @param string $parent The id of Definition instance to decorate.
  */
 public function __construct($parent)
 {
     parent::__construct();
     $this->parent = $parent;
 }
 public function __construct($bundle)
 {
     parent::__construct();
     $this->setClass('%symedit_theme.template.loader.bundle.class%')->addTag('symedit_theme.template_loader')->addArgument($bundle)->addArgument(new Reference('kernel'))->setPublic(false);
 }
 /**
  * Constructor
  *
  * @param string $flagsPath
  * @param array  $patterns
  * @param array  $defaults
  */
 public function __construct($flagsPath, array $patterns, array $defaults)
 {
     parent::__construct();
     $this->setClass('%server_grove_locale.flag_cache_warmer.class%')->setPublic(false)->addArgument('%kernel.root_dir%')->addArgument($flagsPath)->addArgument($patterns)->addArgument($defaults)->addArgument('%server_grove_locale.enabled_locales%')->addTag('kernel.cache_warmer');
 }
 public function __construct($model, array $title, array $description)
 {
     parent::__construct('%symedit_seo.model.preference.class%', [$model, $title, $description]);
 }
 public function __construct($class, array $services)
 {
     parent::__construct($class, [$class, $services]);
     $this->setFactory([AmbiguousService::class, 'throwException']);
     $this->services = $services;
 }