| 1 |
<?php |
| 2 |
|
| 3 |
namespace Safe; |
| 4 |
|
| 5 |
use Safe\Exceptions\UopzException; |
| 6 |
|
| 7 |
/** |
| 8 |
* Makes class extend parent |
| 9 |
* |
| 10 |
* @param string $class The name of the class to extend |
| 11 |
* @param string $parent The name of the class to inherit |
| 12 |
* @throws UopzException |
| 13 |
* |
| 14 |
*/ |
| 15 |
function uopz_extend(string $class, string $parent): void |
| 16 |
{ |
| 17 |
error_clear_last(); |
| 18 |
$result = \uopz_extend($class, $parent); |
| 19 |
if ($result === false) { |
| 20 |
throw UopzException::createFromPhpError(); |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
/** |
| 26 |
* Makes class implement interface |
| 27 |
* |
| 28 |
* @param string $class |
| 29 |
* @param string $interface |
| 30 |
* @throws UopzException |
| 31 |
* |
| 32 |
*/ |
| 33 |
function uopz_implement(string $class, string $interface): void |
| 34 |
{ |
| 35 |
error_clear_last(); |
| 36 |
$result = \uopz_implement($class, $interface); |
| 37 |
if ($result === false) { |
| 38 |
throw UopzException::createFromPhpError(); |
| 39 |
} |
| 40 |
} |
| 41 |
|