Code Duplication    Length = 10-10 lines in 3 locations

src/Assert.php 3 locations

@@ 1115-1124 (lines=10) @@
1112
     *
1113
     * @throws InvalidArgumentException
1114
     */
1115
    public static function endsWith($value, $suffix, $message = '')
1116
    {
1117
        if ($suffix !== \substr($value, -\strlen($suffix))) {
1118
            static::reportInvalidArgument(\sprintf(
1119
                $message ?: 'Expected a value to end with %2$s. Got: %s',
1120
                static::valueToString($value),
1121
                static::valueToString($suffix)
1122
            ));
1123
        }
1124
    }
1125
1126
    /**
1127
     * @psalm-pure
@@ 1135-1144 (lines=10) @@
1132
     *
1133
     * @throws InvalidArgumentException
1134
     */
1135
    public static function notEndsWith($value, $suffix, $message = '')
1136
    {
1137
        if ($suffix === \substr($value, -\strlen($suffix))) {
1138
            static::reportInvalidArgument(\sprintf(
1139
                $message ?: 'Expected a value not to end with %2$s. Got: %s',
1140
                static::valueToString($value),
1141
                static::valueToString($suffix)
1142
            ));
1143
        }
1144
    }
1145
1146
    /**
1147
     * @psalm-pure
@@ 1574-1583 (lines=10) @@
1571
     *
1572
     * @throws InvalidArgumentException
1573
     */
1574
    public static function implementsInterface($value, $interface, $message = '')
1575
    {
1576
        if (!\in_array($interface, \class_implements($value))) {
1577
            static::reportInvalidArgument(\sprintf(
1578
                $message ?: 'Expected an implementation of %2$s. Got: %s',
1579
                static::valueToString($value),
1580
                static::valueToString($interface)
1581
            ));
1582
        }
1583
    }
1584
1585
    /**
1586
     * @psalm-pure