PHP Interface Kraken\Util\Factory\SimpleFactoryInterface

Show file Open project: kraken-php/framework

Public Methods

Method Description
bindParam ( string $name, mixed $value ) : Kraken\Util\Factory\FactoryInterface Bind param $value under $name key to Factory.
create ( mixed[] $args = [] ) : mixed Create object with given arguments using factoryMethod stored in Factory.
define ( callable $factoryMethod ) : Kraken\Util\Factory\FactoryInterface Define factory method for some object in Factory.
getDefinition ( ) : callable Return factory method definition stored in Factory.
getParam ( string $name ) : mixed Get param stored under $name key.
getParams ( ) : mixed[] Return all params stored in Factory in the form of associative array.
hasDefinition ( ) : boolean Check if there is any factory method definition stored in Factory.
hasParam ( string $param ) : boolean Check if there is any param under $param $key.
unbindParam ( string $name ) : Kraken\Util\Factory\FactoryInterface Unbind param stored under $name key from Factory.

Method Details

bindParam() public method

Bind param $value under $name key to Factory.
public bindParam ( string $name, mixed $value ) : Kraken\Util\Factory\FactoryInterface
$name string
$value mixed
return Kraken\Util\Factory\FactoryInterface

create() public method

Create object with given arguments using factoryMethod stored in Factory. Throws exception if there is no definition stored.
public create ( mixed[] $args = [] ) : mixed
$args mixed[]
return mixed

define() public method

Define factory method for some object in Factory.
public define ( callable $factoryMethod ) : Kraken\Util\Factory\FactoryInterface
$factoryMethod callable
return Kraken\Util\Factory\FactoryInterface

getDefinition() public method

Return factory method definition stored in Factory.
public getDefinition ( ) : callable
return callable

getParam() public method

Get param stored under $name key. Throws exception if there is no param set under $name key.
public getParam ( string $name ) : mixed
$name string
return mixed

getParams() public method

Return all params stored in Factory in the form of associative array.
public getParams ( ) : mixed[]
return mixed[]

hasDefinition() public method

Check if there is any factory method definition stored in Factory.
public hasDefinition ( ) : boolean
return boolean

hasParam() public method

Check if there is any param under $param $key.
public hasParam ( string $param ) : boolean
$param string
return boolean

unbindParam() public method

Unbind param stored under $name key from Factory.
public unbindParam ( string $name ) : Kraken\Util\Factory\FactoryInterface
$name string
return Kraken\Util\Factory\FactoryInterface