Code Duplication    Length = 10-10 lines in 4 locations

src/Assert.php 4 locations

@@ 1137-1146 (lines=10) @@
1134
     *
1135
     * @throws InvalidArgumentException
1136
     */
1137
    public static function contains($value, $subString, $message = '')
1138
    {
1139
        if (false === \strpos($value, $subString)) {
1140
            static::reportInvalidArgument(\sprintf(
1141
                $message ?: 'Expected a value to contain %2$s. Got: %s',
1142
                static::valueToString($value),
1143
                static::valueToString($subString)
1144
            ));
1145
        }
1146
    }
1147
1148
    /**
1149
     * @psalm-pure
@@ 1157-1166 (lines=10) @@
1154
     *
1155
     * @throws InvalidArgumentException
1156
     */
1157
    public static function notContains($value, $subString, $message = '')
1158
    {
1159
        if (false !== \strpos($value, $subString)) {
1160
            static::reportInvalidArgument(\sprintf(
1161
                $message ?: '%2$s was not expected to be contained in a value. Got: %s',
1162
                static::valueToString($value),
1163
                static::valueToString($subString)
1164
            ));
1165
        }
1166
    }
1167
1168
    /**
1169
     * @psalm-pure
@@ 1195-1204 (lines=10) @@
1192
     *
1193
     * @throws InvalidArgumentException
1194
     */
1195
    public static function startsWith($value, $prefix, $message = '')
1196
    {
1197
        if (0 !== \strpos($value, $prefix)) {
1198
            static::reportInvalidArgument(\sprintf(
1199
                $message ?: 'Expected a value to start with %2$s. Got: %s',
1200
                static::valueToString($value),
1201
                static::valueToString($prefix)
1202
            ));
1203
        }
1204
    }
1205
1206
    /**
1207
     * @psalm-pure
@@ 1215-1224 (lines=10) @@
1212
     *
1213
     * @throws InvalidArgumentException
1214
     */
1215
    public static function notStartsWith($value, $prefix, $message = '')
1216
    {
1217
        if (0 === \strpos($value, $prefix)) {
1218
            static::reportInvalidArgument(\sprintf(
1219
                $message ?: 'Expected a value not to start with %2$s. Got: %s',
1220
                static::valueToString($value),
1221
                static::valueToString($prefix)
1222
            ));
1223
        }
1224
    }
1225
1226
    /**
1227
     * @psalm-pure