src/utils/traits/Extendable.php 1 location
|
@@ 41-48 (lines=8) @@
|
| 38 |
|
*/ |
| 39 |
|
public function extend($name, callable $callable = null) |
| 40 |
|
{ |
| 41 |
|
if (!is_array($name)) { |
| 42 |
|
if (null === $callable) { |
| 43 |
|
throw new \InvalidArgumentException("A callable must be given as second parameter if the first is not an array."); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
$this->extensions[$name] = $callable; |
| 47 |
|
return; |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
foreach ($name as $method => $callable) { |
| 51 |
|
if (!is_callable($callable)) { |
src/utils/traits/StaticallyExtendable.php 1 location
|
@@ 37-44 (lines=8) @@
|
| 34 |
|
*/ |
| 35 |
|
public static function extend($name, callable $callable = null) |
| 36 |
|
{ |
| 37 |
|
if (!is_array($name)) { |
| 38 |
|
if (null === $callable) { |
| 39 |
|
throw new \InvalidArgumentException("A callable must be given as second parameter if the first is not an array."); |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
self::$extensions[$name] = $callable; |
| 43 |
|
return; |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
foreach ($name as $method => $callable) { |
| 47 |
|
if (!is_callable($callable)) { |