Code Duplication    Length = 10-10 lines in 3 locations

src/Assert.php 3 locations

@@ 1120-1129 (lines=10) @@
1117
     *
1118
     * @throws InvalidArgumentException
1119
     */
1120
    public static function endsWith($value, $suffix, $message = '')
1121
    {
1122
        if ($suffix !== \substr($value, -\strlen($suffix))) {
1123
            static::reportInvalidArgument(\sprintf(
1124
                $message ?: 'Expected a value to end with %2$s. Got: %s',
1125
                static::valueToString($value),
1126
                static::valueToString($suffix)
1127
            ));
1128
        }
1129
    }
1130
1131
    /**
1132
     * @psalm-pure
@@ 1140-1149 (lines=10) @@
1137
     *
1138
     * @throws InvalidArgumentException
1139
     */
1140
    public static function notEndsWith($value, $suffix, $message = '')
1141
    {
1142
        if ($suffix === \substr($value, -\strlen($suffix))) {
1143
            static::reportInvalidArgument(\sprintf(
1144
                $message ?: 'Expected a value not to end with %2$s. Got: %s',
1145
                static::valueToString($value),
1146
                static::valueToString($suffix)
1147
            ));
1148
        }
1149
    }
1150
1151
    /**
1152
     * @psalm-pure
@@ 1579-1588 (lines=10) @@
1576
     *
1577
     * @throws InvalidArgumentException
1578
     */
1579
    public static function implementsInterface($value, $interface, $message = '')
1580
    {
1581
        if (!\in_array($interface, \class_implements($value))) {
1582
            static::reportInvalidArgument(\sprintf(
1583
                $message ?: 'Expected an implementation of %2$s. Got: %s',
1584
                static::valueToString($value),
1585
                static::valueToString($interface)
1586
            ));
1587
        }
1588
    }
1589
1590
    /**
1591
     * @psalm-pure