Code Duplication    Length = 9-10 lines in 6 locations

src/Assert.php 6 locations

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