Code Duplication    Length = 10-10 lines in 4 locations

src/Assert.php 4 locations

@@ 1196-1205 (lines=10) @@
1193
     *
1194
     * @throws InvalidArgumentException
1195
     */
1196
    public static function contains($value, $subString, $message = '')
1197
    {
1198
        if (false === \strpos($value, $subString)) {
1199
            static::reportInvalidArgument(\sprintf(
1200
                $message ?: 'Expected a value to contain %2$s. Got: %s',
1201
                static::valueToString($value),
1202
                static::valueToString($subString)
1203
            ));
1204
        }
1205
    }
1206
1207
    /**
1208
     * @psalm-pure
@@ 1216-1225 (lines=10) @@
1213
     *
1214
     * @throws InvalidArgumentException
1215
     */
1216
    public static function notContains($value, $subString, $message = '')
1217
    {
1218
        if (false !== \strpos($value, $subString)) {
1219
            static::reportInvalidArgument(\sprintf(
1220
                $message ?: '%2$s was not expected to be contained in a value. Got: %s',
1221
                static::valueToString($value),
1222
                static::valueToString($subString)
1223
            ));
1224
        }
1225
    }
1226
1227
    /**
1228
     * @psalm-pure
@@ 1254-1263 (lines=10) @@
1251
     *
1252
     * @throws InvalidArgumentException
1253
     */
1254
    public static function startsWith($value, $prefix, $message = '')
1255
    {
1256
        if (0 !== \strpos($value, $prefix)) {
1257
            static::reportInvalidArgument(\sprintf(
1258
                $message ?: 'Expected a value to start with %2$s. Got: %s',
1259
                static::valueToString($value),
1260
                static::valueToString($prefix)
1261
            ));
1262
        }
1263
    }
1264
1265
    /**
1266
     * @psalm-pure
@@ 1274-1283 (lines=10) @@
1271
     *
1272
     * @throws InvalidArgumentException
1273
     */
1274
    public static function notStartsWith($value, $prefix, $message = '')
1275
    {
1276
        if (0 === \strpos($value, $prefix)) {
1277
            static::reportInvalidArgument(\sprintf(
1278
                $message ?: 'Expected a value not to start with %2$s. Got: %s',
1279
                static::valueToString($value),
1280
                static::valueToString($prefix)
1281
            ));
1282
        }
1283
    }
1284
1285
    /**
1286
     * @psalm-pure