Method | Description | |
---|---|---|
addRule ( string $name, array $rule ) | Add a rule $rule to the class $name | |
create ( $name, array $args = [], array $share = [] ) : object | Returns a fully constructed object based on $name using $args and $share as constructor arguments if supplied | |
getRule ( $name ) : array | Returns the rule that will be applied to the class $name when calling create() |
Method | Description | |
---|---|---|
expand ( mixed $param, array $share = [], boolean $createFromString = false ) : mixed | Looks for 'instance' array keys in $param and when found returns an object based on the value see {@link https:// r.je/dice.html#example3-1} | |
getClosure ( string $name, array $rule ) : callable | Returns a closure for creating object $name based on $rule, caching the reflection object for later use | |
getParams ( ReflectionMethod $method, array $rule ) : callable | Returns a closure that generates arguments for $method based on $rule and any $args passed into the closure |
public create ( $name, array $args = [], array $share = [] ) : object | ||
$args | array | An array with any additional arguments to be passed into the constructor upon instantiation |
$share | array | Whether or not this class instance be shared, so that the same instance is passed around each time |
return | object | A fully constructed object based on the specified input arguments |