Code Duplication    Length = 10-10 lines in 3 locations

src/Assert.php 3 locations

@@ 1303-1312 (lines=10) @@
1300
     *
1301
     * @throws InvalidArgumentException
1302
     */
1303
    public static function endsWith($value, $suffix, $message = '')
1304
    {
1305
        if ($suffix !== \substr($value, -\strlen($suffix))) {
1306
            static::reportInvalidArgument(\sprintf(
1307
                $message ?: 'Expected a value to end with %2$s. Got: %s',
1308
                static::valueToString($value),
1309
                static::valueToString($suffix)
1310
            ));
1311
        }
1312
    }
1313
1314
    /**
1315
     * @psalm-pure
@@ 1323-1332 (lines=10) @@
1320
     *
1321
     * @throws InvalidArgumentException
1322
     */
1323
    public static function notEndsWith($value, $suffix, $message = '')
1324
    {
1325
        if ($suffix === \substr($value, -\strlen($suffix))) {
1326
            static::reportInvalidArgument(\sprintf(
1327
                $message ?: 'Expected a value not to end with %2$s. Got: %s',
1328
                static::valueToString($value),
1329
                static::valueToString($suffix)
1330
            ));
1331
        }
1332
    }
1333
1334
    /**
1335
     * @psalm-pure
@@ 1760-1769 (lines=10) @@
1757
     *
1758
     * @throws InvalidArgumentException
1759
     */
1760
    public static function implementsInterface($value, $interface, $message = '')
1761
    {
1762
        if (!\in_array($interface, \class_implements($value))) {
1763
            static::reportInvalidArgument(\sprintf(
1764
                $message ?: 'Expected an implementation of %2$s. Got: %s',
1765
                static::valueToString($value),
1766
                static::valueToString($interface)
1767
            ));
1768
        }
1769
    }
1770
1771
    /**
1772
     * @psalm-pure