Code Duplication    Length = 9-10 lines in 6 locations

src/Assert.php 6 locations

@@ 324-332 (lines=9) @@
321
        }
322
    }
323
324
    public static function null($value, $message = '')
325
    {
326
        if (null !== $value) {
327
            throw static::createInvalidArgumentException(sprintf(
328
                $message ?: 'Expected null. Got: %s',
329
                static::valueToString($value)
330
            ));
331
        }
332
    }
333
334
    public static function notNull($value, $message = '')
335
    {
@@ 343-351 (lines=9) @@
340
        }
341
    }
342
343
    public static function true($value, $message = '')
344
    {
345
        if (true !== $value) {
346
            throw static::createInvalidArgumentException(sprintf(
347
                $message ?: 'Expected a value to be true. Got: %s',
348
                static::valueToString($value)
349
            ));
350
        }
351
    }
352
353
    public static function false($value, $message = '')
354
    {
@@ 353-361 (lines=9) @@
350
        }
351
    }
352
353
    public static function false($value, $message = '')
354
    {
355
        if (false !== $value) {
356
            throw static::createInvalidArgumentException(sprintf(
357
                $message ?: 'Expected a value to be false. Got: %s',
358
                static::valueToString($value)
359
            ));
360
        }
361
    }
362
363
    public static function eq($value, $value2, $message = '')
364
    {
@@ 609-618 (lines=10) @@
606
        }
607
    }
608
609
    public static function length($value, $length, $message = '')
610
    {
611
        if ($length !== static::strlen($value)) {
612
            throw static::createInvalidArgumentException(sprintf(
613
                $message ?: 'Expected a value to contain %2$s characters. Got: %s',
614
                static::valueToString($value),
615
                $length
616
            ));
617
        }
618
    }
619
620
    public static function minLength($value, $min, $message = '')
621
    {
@@ 620-629 (lines=10) @@
617
        }
618
    }
619
620
    public static function minLength($value, $min, $message = '')
621
    {
622
        if (static::strlen($value) < $min) {
623
            throw static::createInvalidArgumentException(sprintf(
624
                $message ?: 'Expected a value to contain at least %2$s characters. Got: %s',
625
                static::valueToString($value),
626
                $min
627
            ));
628
        }
629
    }
630
631
    public static function maxLength($value, $max, $message = '')
632
    {
@@ 631-640 (lines=10) @@
628
        }
629
    }
630
631
    public static function maxLength($value, $max, $message = '')
632
    {
633
        if (static::strlen($value) > $max) {
634
            throw static::createInvalidArgumentException(sprintf(
635
                $message ?: 'Expected a value to contain at most %2$s characters. Got: %s',
636
                static::valueToString($value),
637
                $max
638
            ));
639
        }
640
    }
641
642
    public static function lengthBetween($value, $min, $max, $message = '')
643
    {