Overview

Namespaces

  • Syringe
    • Exceptions

Classes

  • Container
  • Resolver
  • Overview
  • Namespace
  • Class

Class Resolver

The Resolver. Used for constructor and method injection, and to resolve Container bindings.

The Resolver supports method/constructor injection using both PHPDocComments (the @Inject tag), and typehints on the parameters. The syntax for the @Inject tag is

@Inject {bindingKey} {parameterName}

. The Resolver first makes use of the doc, then resolves any dependencies not covered in the doc via the typehints.

Class Resolver

Namespace: Syringe
Package: Syringe
Located at Resolver.php
Methods summary
public
# __construct( array $config = [] )

Creates a new Resolver.

Creates a new Resolver.

Parameters

$config
Settings to be used when resolving
public mixed
# call( Syringe\string $classname, Syringe\string $methodname, array $overrideArgs = [] )

Call a class method, automatically resolving its dependencies

Call a class method, automatically resolving its dependencies

Parameters

$classname
$methodname
$overrideArgs

Associative array with parameter names as keys, and their desired values as the values. When calling

$methodname

, the Resolver will not attempt tp resolve any parameter names you specify here. Rather, it will pass in the specified value

Returns

mixed
The result of the method call
public stdClass
# resolveClass( Syringe\string $classname, array $constructorOverrideArgs = [] )

Resolve a class dependencies and instantiate it (constructor injection)

Resolve a class dependencies and instantiate it (constructor injection)

Parameters

$classname
$constructorOverrideArgs

Associative array with parameter names as keys, and their desired values as the values. When calling the class constructor, the Resolver will not attempt tp resolve any parameter names you specify here. Rather, it will pass in the specified value

Returns

stdClass
public mixed
# resolveMethod( StdClass $instance, Syringe\string $methodname, array $methodOverrideArgs = [] )

Call a method on a resolved class instance

Call a method on a resolved class instance

Parameters

$instance
The class instance
$methodname
$methodOverrideArgs

Associative array with parameter names as keys, and their desired values as the values. When calling the class method, the Resolver will not attempt tp resolve any parameter names you specify here. Rather, it will pass in the specified value

Returns

mixed
API documentation generated by ApiGen