1 | <?php |
||
55 | class Underscore |
||
56 | { |
||
57 | /** @var Collection */ |
||
58 | protected $wrapped; |
||
59 | |||
60 | /** @var array */ |
||
61 | protected static $mixins = []; |
||
62 | |||
63 | /** @var Registry */ |
||
64 | protected static $registry; |
||
65 | |||
66 | /** |
||
67 | * Set the registry singleton. |
||
68 | * |
||
69 | * @param Registry $registry |
||
70 | * @return void |
||
71 | */ |
||
72 | 1 | public static function setRegistry(Registry $registry) |
|
76 | |||
77 | /** |
||
78 | * Get the registry singleton. |
||
79 | * |
||
80 | * Creates a new registry if none exists. |
||
81 | * |
||
82 | * @return Registry |
||
83 | */ |
||
84 | 54 | public static function getRegistry() |
|
92 | |||
93 | /** |
||
94 | * Allows you to extend Underscore with your own utility functions. |
||
95 | * |
||
96 | * Pass a hash of {name: function} definitions to have your functions added |
||
97 | * to the Underscore object, as well as the OOP wrapper. |
||
98 | * |
||
99 | * @param array $functions |
||
100 | * @return void |
||
101 | */ |
||
102 | 1 | public static function mixin(array $functions) |
|
108 | |||
109 | /** |
||
110 | * @param Collection $wrapped |
||
111 | */ |
||
112 | 52 | public function __construct(Collection $wrapped = null) |
|
116 | |||
117 | /** |
||
118 | * @param string $method |
||
119 | * @param array $args |
||
120 | * @throws \BadMethodCallException |
||
121 | * @return $this |
||
122 | */ |
||
123 | 52 | public function __call($method, $args) |
|
127 | |||
128 | /** |
||
129 | * @param string $method |
||
130 | * @param array $args |
||
131 | * @return $this |
||
132 | */ |
||
133 | 53 | public static function __callStatic($method, $args) |
|
137 | |||
138 | /** |
||
139 | * Payload is either Mutator or Accessor. Both are supposed to be callable. |
||
140 | * |
||
141 | * @param callable $payload |
||
142 | * @param array $args |
||
143 | * @return $this|mixed |
||
144 | */ |
||
145 | 51 | protected function executePayload($payload, $args) |
|
158 | } |
||
159 |