Code Duplication    Length = 10-10 lines in 4 locations

src/Assert.php 4 locations

@@ 993-1002 (lines=10) @@
990
     *
991
     * @throws InvalidArgumentException
992
     */
993
    public static function contains($value, $subString, $message = '')
994
    {
995
        if (false === \strpos($value, $subString)) {
996
            static::reportInvalidArgument(\sprintf(
997
                $message ?: 'Expected a value to contain %2$s. Got: %s',
998
                static::valueToString($value),
999
                static::valueToString($subString)
1000
            ));
1001
        }
1002
    }
1003
1004
    /**
1005
     * @psalm-pure
@@ 1013-1022 (lines=10) @@
1010
     *
1011
     * @throws InvalidArgumentException
1012
     */
1013
    public static function notContains($value, $subString, $message = '')
1014
    {
1015
        if (false !== \strpos($value, $subString)) {
1016
            static::reportInvalidArgument(\sprintf(
1017
                $message ?: '%2$s was not expected to be contained in a value. Got: %s',
1018
                static::valueToString($value),
1019
                static::valueToString($subString)
1020
            ));
1021
        }
1022
    }
1023
1024
    /**
1025
     * @psalm-pure
@@ 1051-1060 (lines=10) @@
1048
     *
1049
     * @throws InvalidArgumentException
1050
     */
1051
    public static function startsWith($value, $prefix, $message = '')
1052
    {
1053
        if (0 !== \strpos($value, $prefix)) {
1054
            static::reportInvalidArgument(\sprintf(
1055
                $message ?: 'Expected a value to start with %2$s. Got: %s',
1056
                static::valueToString($value),
1057
                static::valueToString($prefix)
1058
            ));
1059
        }
1060
    }
1061
1062
    /**
1063
     * @psalm-pure
@@ 1071-1080 (lines=10) @@
1068
     *
1069
     * @throws InvalidArgumentException
1070
     */
1071
    public static function notStartsWith($value, $prefix, $message = '')
1072
    {
1073
        if (0 === \strpos($value, $prefix)) {
1074
            static::reportInvalidArgument(\sprintf(
1075
                $message ?: 'Expected a value not to start with %2$s. Got: %s',
1076
                static::valueToString($value),
1077
                static::valueToString($prefix)
1078
            ));
1079
        }
1080
    }
1081
1082
    /**
1083
     * @psalm-pure