public function autoload(array $autoloads, $provider, $options = [])
    {
        foreach ($autoloads as $name => $alias) {
            if (is_int($name)) {
                $name = $alias;
            }
            if (empty($name)) {
                throw new \InvalidArgumentException("Cannot not autoload empty service");
            }
            if (!empty($options['prefix'])) {
                $alias = $options['prefix'] . ucfirst($alias);
            }
            $shared = true;
            if (isset($options['shared'])) {
                if (is_array($options['shared'])) {
                    $shared = in_array($name, $options['shared']);
                } else {
                    $shared = $options['shared'];
                }
            } elseif (isset($options['instances'])) {
                $shared = !in_array($name, $options['instances']);
            }
            $this->set($alias, function () use ($name, $provider) {
                if (!is_object($provider)) {
                    $provider = $this->getShared($provider);
                }
                return $provider->provide($name, func_get_args());
            }, $shared);
        }
        return $this;
    }
public function autoload(array $autoloads, $provider, $options = [])
    {
        foreach ($autoloads as $name => $alias) {
            if (is_int($name)) {
                $name = $alias;
            }
            if (empty($name)) {
                throw new \InvalidArgumentException("Cannot not autoload empty service");
            }
            if (!empty($options['prefix'])) {
                $alias = $options['prefix'] . ucfirst($alias);
            }
            $shared = true;
            if (isset($options['shared'])) {
                if (is_array($options['shared'])) {
                    $shared = in_array($name, $options['shared']);
                } else {
                    $shared = $options['shared'];
                }
            } elseif (isset($options['instances'])) {
                $shared = !in_array($name, $options['instances']);
            }
            $this->set($alias, function () use ($name, $provider) {
                if (!is_object($provider)) {
                    $provider = $this->getShared($provider);
                }
                return $provider->provide($name, func_get_args());
            }, $shared);
        }
        return $this;
    }
public function autoload ( array $ autoloads , $ provider , $ options = [ ] ) { foreach ( $ autoloads as $ name => $ alias ) { if ( is_int ( $ name ) ) { $ name = $ alias ; } if ( empty ( $ name ) ) { throw new \ InvalidArgumentException ( "Cannot not autoload empty service" ) ; } if ( ! empty ( $ options [ 'prefix' ] ) ) { $ alias = $ options [ 'prefix' ] . ucfirst ( $ alias ) ; } $ shared = true ; if ( isset ( $ options [ 'shared' ] ) ) { if ( is_array ( $ options [ 'shared' ] ) ) { $ shared = in_array ( $ name , $ options [ 'shared' ] ) ; } else { $ shared = $ options [ 'shared' ] ; } } elseif ( isset ( $ options [ 'instances' ] ) ) { $ shared = ! in_array ( $ name , $ options [ 'instances' ] ) ; } $ this -> set ( $ alias , function ( ) use ( $ name , $ provider ) { if ( ! is_object ( $ provider ) ) { $ provider = $ this -> getShared ( $ provider ) ; } return $ provider -> provide ( $ name , func_get_args ( ) ) ; } , $ shared ) ; } return $ this ; }
mark autoload service definition from service provider

@param array $autoloads name of service. service alias
@param string|ServiceProvider $provider service provider
@param array options: shared, instances, prefix
mark autoload service definition from service provider