Code Duplication    Length = 10-10 lines in 4 locations

src/Assert.php 4 locations

@@ 992-1001 (lines=10) @@
989
     *
990
     * @throws InvalidArgumentException
991
     */
992
    public static function contains($value, $subString, $message = '')
993
    {
994
        if (false === \strpos($value, $subString)) {
995
            static::reportInvalidArgument(\sprintf(
996
                $message ?: 'Expected a value to contain %2$s. Got: %s',
997
                static::valueToString($value),
998
                static::valueToString($subString)
999
            ));
1000
        }
1001
    }
1002
1003
    /**
1004
     * @psalm-pure
@@ 1012-1021 (lines=10) @@
1009
     *
1010
     * @throws InvalidArgumentException
1011
     */
1012
    public static function notContains($value, $subString, $message = '')
1013
    {
1014
        if (false !== \strpos($value, $subString)) {
1015
            static::reportInvalidArgument(\sprintf(
1016
                $message ?: '%2$s was not expected to be contained in a value. Got: %s',
1017
                static::valueToString($value),
1018
                static::valueToString($subString)
1019
            ));
1020
        }
1021
    }
1022
1023
    /**
1024
     * @psalm-pure
@@ 1050-1059 (lines=10) @@
1047
     *
1048
     * @throws InvalidArgumentException
1049
     */
1050
    public static function startsWith($value, $prefix, $message = '')
1051
    {
1052
        if (0 !== \strpos($value, $prefix)) {
1053
            static::reportInvalidArgument(\sprintf(
1054
                $message ?: 'Expected a value to start with %2$s. Got: %s',
1055
                static::valueToString($value),
1056
                static::valueToString($prefix)
1057
            ));
1058
        }
1059
    }
1060
1061
    /**
1062
     * @psalm-pure
@@ 1070-1079 (lines=10) @@
1067
     *
1068
     * @throws InvalidArgumentException
1069
     */
1070
    public static function notStartsWith($value, $prefix, $message = '')
1071
    {
1072
        if (0 === \strpos($value, $prefix)) {
1073
            static::reportInvalidArgument(\sprintf(
1074
                $message ?: 'Expected a value not to start with %2$s. Got: %s',
1075
                static::valueToString($value),
1076
                static::valueToString($prefix)
1077
            ));
1078
        }
1079
    }
1080
1081
    /**
1082
     * @psalm-pure