Overview

Namespaces

  • Autarky
    • Config
      • Loaders
    • Console
    • Container
      • Exception
      • Factory
      • Proxy
    • Database
    • Errors
    • Events
    • Files
    • Http
    • Logging
    • Providers
    • Routing
      • Events
    • Testing
    • TwigTemplating
      • Extensions
    • Utils

Classes

  • AbstractArgument
  • ClassArgument
  • Definition
  • Factory
  • ScalarArgument

Interfaces

  • ArgumentInterface
  • FactoryInterface
  • Overview
  • Namespace
  • Class

Class Definition

Factory definition.

Autarky\Container\Factory\Definition implements Autarky\Container\Factory\FactoryInterface
Namespace: Autarky\Container\Factory
Located at Factory/Definition.php
Methods summary
public
# __construct( callable $callable, $name = null )

Constructor.

Constructor.

Parameters

$callable
$name
public static Autarky\Container\Factory\FactoryInterface
# getDefaultForClass( string $class, array $params = array() )

Get a default factory for a class.

Get a default factory for a class.

Parameters

$class
$params
Optional

Returns

Autarky\Container\Factory\FactoryInterface
public static Autarky\Container\Factory\FactoryInterface
# getDefaultForCallable( callable $callable, array $params = array() )

Get a default factory for a callable.

Get a default factory for a callable.

Parameters

$callable
$params
Optional

Returns

Autarky\Container\Factory\FactoryInterface
public static static
# getFromReflection( callable $callable, ReflectionFunctionAbstract $reflectionFunction = null )

Get a new factory definition instance via reflection.

Get a new factory definition instance via reflection.

Parameters

$callable
$reflectionFunction

Returns

static
protected static
# addReflectionArguments( Autarky\Container\Factory\Definition $factory, ReflectionFunctionAbstract $reflectionFunction = null )

Add arguments to an existing factory via reflection.

Add arguments to an existing factory via reflection.

Parameters

$factory
$reflectionFunction
Optional
public string|null
# getName( )

Get the factory's name.

Get the factory's name.

Returns

string|null
public callable
# getCallable( )

Get the factory callable.

Get the factory callable.

Returns

callable
public array
# getArguments( )

Get the factory definition's arguments, mapped by position.

Get the factory definition's arguments, mapped by position.

Returns

array
public
# addScalarArgument( string $name, string $type, boolean $required = true, mixed $default = null )

Add a scalar argument to the factory definition.

Add a scalar argument to the factory definition.

Parameters

$name
$type
int, string, object, etc.
$required
$default
Default value, if not required
public
# addOptionalScalarArgument( string $name, string $type, mixed $default )

Add an optional scalar argument to the factory definition.

Add an optional scalar argument to the factory definition.

Parameters

$name
$type
int, string, object, etc.
$default
public
# addClassArgument( string $name, string $class, boolean $required = true )

Add a class argument to the factory definition.

Add a class argument to the factory definition.

Parameters

$name
$class
$required
Optional - defaults to true
public
# addOptionalClassArgument( string $name, string $class )

Add an optional class argument to the factory definition.

Add an optional class argument to the factory definition.

Parameters

$name
$class
public
# addArgument( Autarky\Container\Factory\ArgumentInterface $argument )

Add an argument to the factory definition.

Add an argument to the factory definition.

Parameters

$argument
public Autarky\Container\Factory\Factory
# getFactory( array $params = array() )

Get the definition's factory.

Get the definition's factory.

Parameters

$params

Returns

Autarky\Container\Factory\Factory

Implementation of

Autarky\Container\Factory\FactoryInterface::getFactory()
public mixed
# invoke( Autarky\Container\ContainerInterface $container, array $params = array() )

Invoke the factory.

Invoke the factory.

Parameters

$container
$params

Returns

mixed

Implementation of

Autarky\Container\Factory\FactoryInterface::invoke()
public mixed
# __invoke( Autarky\Container\ContainerInterface $container, array $params = array() )

Proxy for the invoke method. Makes the factory definition class callable.

Proxy for the invoke method. Makes the factory definition class callable.

Parameters

$container
$params

Returns

mixed
Properties summary
protected callable $callable

The callable function/method.

The callable function/method.

#
protected string|null $name

The name of the definition.

The name of the definition.

#
protected array $argumentPositions

Map of argument position => argument

Map of argument position => argument

# []
protected array $argumentNames

Map of argument name => argument

Map of argument name => argument

# []
protected array $argumentClasses

Map of argument class => argument

Map of argument class => argument

# []
protected integer $argumentPosition

The current argument postition.

The current argument postition.

# 0
Autarky Framework API documentation generated by ApiGen