Code Duplication    Length = 10-10 lines in 3 locations

src/Assert.php 3 locations

@@ 995-1004 (lines=10) @@
992
     *
993
     * @throws InvalidArgumentException
994
     */
995
    public static function contains($value, $subString, $message = '')
996
    {
997
        if (false === \strpos($value, $subString)) {
998
            static::reportInvalidArgument(\sprintf(
999
                $message ?: 'Expected a value to contain %2$s. Got: %s',
1000
                static::valueToString($value),
1001
                static::valueToString($subString)
1002
            ));
1003
        }
1004
    }
1005
1006
    /**
1007
     * @param mixed  $value
@@ 1013-1022 (lines=10) @@
1010
     *
1011
     * @throws InvalidArgumentException
1012
     */
1013
    public static function notContains($value, $subString, $message = '')
1014
    {
1015
        if (false !== \strpos($value, $subString)) {
1016
            static::reportInvalidArgument(\sprintf(
1017
                $message ?: '%2$s was not expected to be contained in a value. Got: %s',
1018
                static::valueToString($value),
1019
                static::valueToString($subString)
1020
            ));
1021
        }
1022
    }
1023
1024
    /**
1025
     * @param mixed  $value
@@ 1047-1056 (lines=10) @@
1044
     *
1045
     * @throws InvalidArgumentException
1046
     */
1047
    public static function startsWith($value, $prefix, $message = '')
1048
    {
1049
        if (0 !== \strpos($value, $prefix)) {
1050
            static::reportInvalidArgument(\sprintf(
1051
                $message ?: 'Expected a value to start with %2$s. Got: %s',
1052
                static::valueToString($value),
1053
                static::valueToString($prefix)
1054
            ));
1055
        }
1056
    }
1057
1058
    /**
1059
     * @psalm-assert string $value