| @@ 1490-1498 (lines=9) @@ | ||
| 1487 | * @param null $exception |
|
| 1488 | * @throws Exception |
|
| 1489 | */ |
|
| 1490 | public static function propertyExists($classOrObject, $property, $message = '', $exception = null) |
|
| 1491 | { |
|
| 1492 | if (!\property_exists($classOrObject, $property)) { |
|
| 1493 | static::throwException(\sprintf( |
|
| 1494 | $message ?: 'Expected the property %s to exist.', |
|
| 1495 | static::valueToString($property) |
|
| 1496 | ), $exception); |
|
| 1497 | } |
|
| 1498 | } |
|
| 1499 | ||
| 1500 | /** |
|
| 1501 | * @param string|object $classOrObject |
|
| @@ 1507-1515 (lines=9) @@ | ||
| 1504 | * @param null $exception |
|
| 1505 | * @throws Exception |
|
| 1506 | */ |
|
| 1507 | public static function propertyNotExists($classOrObject, $property, $message = '', $exception = null) |
|
| 1508 | { |
|
| 1509 | if (\property_exists($classOrObject, $property)) { |
|
| 1510 | static::throwException(\sprintf( |
|
| 1511 | $message ?: 'Expected the property %s to not exist.', |
|
| 1512 | static::valueToString($property) |
|
| 1513 | ), $exception); |
|
| 1514 | } |
|
| 1515 | } |
|
| 1516 | ||
| 1517 | /** |
|
| 1518 | * @param string|object $classOrObject |
|
| @@ 1524-1532 (lines=9) @@ | ||
| 1521 | * @param null $exception |
|
| 1522 | * @throws Exception |
|
| 1523 | */ |
|
| 1524 | public static function methodExists($classOrObject, $method, $message = '', $exception = null) |
|
| 1525 | { |
|
| 1526 | if (!\method_exists($classOrObject, $method)) { |
|
| 1527 | static::throwException(\sprintf( |
|
| 1528 | $message ?: 'Expected the method %s to exist.', |
|
| 1529 | static::valueToString($method) |
|
| 1530 | ), $exception); |
|
| 1531 | } |
|
| 1532 | } |
|
| 1533 | ||
| 1534 | /** |
|
| 1535 | * @param string|object $classOrObject |
|
| @@ 1541-1549 (lines=9) @@ | ||
| 1538 | * @param null $exception |
|
| 1539 | * @throws Exception |
|
| 1540 | */ |
|
| 1541 | public static function methodNotExists($classOrObject, $method, $message = '', $exception = null) |
|
| 1542 | { |
|
| 1543 | if (\method_exists($classOrObject, $method)) { |
|
| 1544 | static::throwException(\sprintf( |
|
| 1545 | $message ?: 'Expected the method %s to not exist.', |
|
| 1546 | static::valueToString($method) |
|
| 1547 | ), $exception); |
|
| 1548 | } |
|
| 1549 | } |
|
| 1550 | ||
| 1551 | /** |
|
| 1552 | * @param array $array |
|