@@ 476-485 (lines=10) @@ | ||
473 | } |
|
474 | } |
|
475 | ||
476 | public static function contains($value, $subString, $message = '') |
|
477 | { |
|
478 | if (false === strpos($value, $subString)) { |
|
479 | throw new InvalidArgumentException(sprintf( |
|
480 | $message ?: 'Expected a value to contain %2$s. Got: %s', |
|
481 | static::valueToString($value), |
|
482 | static::valueToString($subString) |
|
483 | )); |
|
484 | } |
|
485 | } |
|
486 | ||
487 | public static function startsWith($value, $prefix, $message = '') |
|
488 | { |
|
@@ 487-496 (lines=10) @@ | ||
484 | } |
|
485 | } |
|
486 | ||
487 | public static function startsWith($value, $prefix, $message = '') |
|
488 | { |
|
489 | if (0 !== strpos($value, $prefix)) { |
|
490 | throw new InvalidArgumentException(sprintf( |
|
491 | $message ?: 'Expected a value to start with %2$s. Got: %s', |
|
492 | static::valueToString($value), |
|
493 | static::valueToString($prefix) |
|
494 | )); |
|
495 | } |
|
496 | } |
|
497 | ||
498 | public static function startsWithLetter($value, $message = '') |
|
499 | { |
|
@@ 726-735 (lines=10) @@ | ||
723 | } |
|
724 | } |
|
725 | ||
726 | public static function subclassOf($value, $class, $message = '') |
|
727 | { |
|
728 | if (!is_subclass_of($value, $class)) { |
|
729 | throw new InvalidArgumentException(sprintf( |
|
730 | $message ?: 'Expected a sub-class of %2$s. Got: %s', |
|
731 | static::valueToString($value), |
|
732 | static::valueToString($class) |
|
733 | )); |
|
734 | } |
|
735 | } |
|
736 | ||
737 | public static function implementsInterface($value, $interface, $message = '') |
|
738 | { |