Code Duplication    Length = 10-10 lines in 4 locations

src/Assert.php 4 locations

@@ 1033-1042 (lines=10) @@
1030
     *
1031
     * @throws InvalidArgumentException
1032
     */
1033
    public static function contains($value, $subString, $message = '')
1034
    {
1035
        if (false === \strpos($value, $subString)) {
1036
            static::reportInvalidArgument(\sprintf(
1037
                $message ?: 'Expected a value to contain %2$s. Got: %s',
1038
                static::valueToString($value),
1039
                static::valueToString($subString)
1040
            ));
1041
        }
1042
    }
1043
1044
    /**
1045
     * @psalm-pure
@@ 1053-1062 (lines=10) @@
1050
     *
1051
     * @throws InvalidArgumentException
1052
     */
1053
    public static function notContains($value, $subString, $message = '')
1054
    {
1055
        if (false !== \strpos($value, $subString)) {
1056
            static::reportInvalidArgument(\sprintf(
1057
                $message ?: '%2$s was not expected to be contained in a value. Got: %s',
1058
                static::valueToString($value),
1059
                static::valueToString($subString)
1060
            ));
1061
        }
1062
    }
1063
1064
    /**
1065
     * @psalm-pure
@@ 1091-1100 (lines=10) @@
1088
     *
1089
     * @throws InvalidArgumentException
1090
     */
1091
    public static function startsWith($value, $prefix, $message = '')
1092
    {
1093
        if (0 !== \strpos($value, $prefix)) {
1094
            static::reportInvalidArgument(\sprintf(
1095
                $message ?: 'Expected a value to start with %2$s. Got: %s',
1096
                static::valueToString($value),
1097
                static::valueToString($prefix)
1098
            ));
1099
        }
1100
    }
1101
1102
    /**
1103
     * @psalm-pure
@@ 1111-1120 (lines=10) @@
1108
     *
1109
     * @throws InvalidArgumentException
1110
     */
1111
    public static function notStartsWith($value, $prefix, $message = '')
1112
    {
1113
        if (0 === \strpos($value, $prefix)) {
1114
            static::reportInvalidArgument(\sprintf(
1115
                $message ?: 'Expected a value not to start with %2$s. Got: %s',
1116
                static::valueToString($value),
1117
                static::valueToString($prefix)
1118
            ));
1119
        }
1120
    }
1121
1122
    /**
1123
     * @psalm-pure