Symfony2 API
Class

Symfony\Component\DependencyInjection\Loader\ClosureLoader

class ClosureLoader extends Loader

ClosureLoader loads service definitions from a PHP closure.

The Closure has access to the container as its first argument.

Methods

LoaderResolver getResolver()

Gets the loader resolver.

from Loader
setResolver(LoaderResolver $resolver)

Sets the loader resolver.

from Loader
import(mixed $resource, string $type = null)

Imports a resource.

from Loader
LoaderInterface resolve(mixed $resource, string $type = null)

Finds a loader able to load an imported resource.

from Loader
__construct(ContainerBuilder $container)

Constructor.

load(Closure $closure, string $type = null)

Loads a resource.

Boolean supports(mixed $resource, string $type = null)

Returns true if this class supports the given resource.

Details

in Loader at line 30
public LoaderResolver getResolver()

Gets the loader resolver.

Return Value

LoaderResolver A LoaderResolver instance

in Loader at line 40
public setResolver(LoaderResolver $resolver)

Sets the loader resolver.

Parameters

LoaderResolver $resolver A LoaderResolver instance

in Loader at line 51
public import(mixed $resource, string $type = null)

Imports a resource.

Parameters

mixed $resource A Resource
string $type The resource type

in Loader at line 66
public LoaderInterface resolve(mixed $resource, string $type = null)

Finds a loader able to load an imported resource.

Parameters

mixed $resource A Resource
string $type The resource type

Return Value

LoaderInterface A LoaderInterface instance

Exceptions

FileLoaderLoadException if no loader is found

at line 33
public __construct(ContainerBuilder $container)

Constructor.

Parameters

ContainerBuilder $container A ContainerBuilder instance

at line 44
public load(Closure $closure, string $type = null)

Loads a resource.

Parameters

Closure $closure The resource
string $type The resource type

at line 57
public Boolean supports(mixed $resource, string $type = null)

Returns true if this class supports the given resource.

Parameters

mixed $resource A resource
string $type The resource type

Return Value

Boolean true if this class supports the given resource, false otherwise