src/Container.php
private function createInstance($nid, array $args) {
        $rule = $this->makeRule($nid);

        // Cache the instance or its factory for future use.
        if (empty($rule['shared'])) {
            $factory = $this->makeFactory($nid, $rule);
            $instance = $factory($args);
            $this->factories[$nid] = $factory;
        } else {
            $instance = $this->createSharedInstance($nid, $rule, $args);
        }
        return $instance;
    }
private function createInstance($nid, array $args) {
        $rule = $this->makeRule($nid);

        // Cache the instance or its factory for future use.
        if (empty($rule['shared'])) {
            $factory = $this->makeFactory($nid, $rule);
            $instance = $factory($args);
            $this->factories[$nid] = $factory;
        } else {
            $instance = $this->createSharedInstance($nid, $rule, $args);
        }
        return $instance;
    }
private function createInstance ( $ nid , array $ args ) { $ rule = $ this -> makeRule ( $ nid ) ; // Cache the instance or its factory for future use. if ( empty ( $ rule [ 'shared' ] ) ) { $ factory = $ this -> makeFactory ( $ nid , $ rule ) ; $ instance = $ factory ( $ args ) ; $ this -> factories [ $ nid ] = $ factory ; } else { $ instance = $ this -> createSharedInstance ( $ nid , $ rule , $ args ) ; } return $ instance ; }
Create an instance of a container item.

This method either creates a new instance or returns an already created shared instance.

@param string $nid The normalized ID of the container item.
@param array $args Additional arguments to pass to the constructor.
@return object Returns an object instance.
Create an instance of a container item .