1 | <?php |
||
26 | class Registry |
||
27 | { |
||
28 | /** |
||
29 | * @var array Classes aliased by name of method. |
||
30 | */ |
||
31 | private $aliases = []; |
||
32 | |||
33 | /** |
||
34 | * @var array Callable instances aliased by name of method. |
||
35 | */ |
||
36 | private $instances = []; |
||
37 | |||
38 | /** |
||
39 | * @param array $aliases |
||
40 | */ |
||
41 | 7 | public function __construct(array $aliases = []) |
|
45 | |||
46 | /** |
||
47 | * Get the callable for an Underscore method alias. |
||
48 | * |
||
49 | * @param string $name |
||
50 | * @return callable |
||
51 | */ |
||
52 | 58 | public function instance($name) |
|
63 | |||
64 | /** |
||
65 | * Alias method name to a callable. |
||
66 | * |
||
67 | * @param string $name |
||
68 | * @param callable $spec |
||
69 | * @return void |
||
70 | */ |
||
71 | 3 | public function alias($name, $spec) |
|
82 | |||
83 | /** |
||
84 | * Define a default mutator, accessor, or initializer for a method name. |
||
85 | * |
||
86 | * @throws \BadMethodCallException If no default can be located. |
||
87 | * @param string $name |
||
88 | * @return void |
||
89 | */ |
||
90 | 48 | private function aliasDefault($name) |
|
108 | } |
||
109 |