Code Duplication    Length = 12-13 lines in 3 locations

src/Assert.php 3 locations

@@ 108-120 (lines=13) @@
105
     *
106
     * @throws InvalidArgumentException
107
     */
108
    public static function integerish($value, $message = '')
109
    {
110
        if (!\is_numeric($value) || $value != (int) $value) {
111
            static::reportInvalidArgument(
112
                is_callable($message)
113
                    ? $message()
114
                    : sprintf(
115
                        $message ?: 'Expected an integerish value. Got: %s',
116
                        static::typeToString($value)
117
                    )
118
            );
119
        }
120
    }
121
122
    /**
123
     * @psalm-pure
@@ 524-535 (lines=12) @@
521
     *
522
     * @throws InvalidArgumentException
523
     */
524
    public static function isAOf($value, $class, $message = '')
525
    {
526
        static::string($class, 'Expected class as a string. Got: %s');
527
528
        if (!\is_a($value, $class, \is_string($value))) {
529
            static::reportInvalidArgument(sprintf(
530
                $message ?: 'Expected an instance of this class or to this class among his parents %2$s. Got: %s',
531
                static::typeToString($value),
532
                $class
533
            ));
534
        }
535
    }
536
537
    /**
538
     * @psalm-pure
@@ 550-561 (lines=12) @@
547
     *
548
     * @throws InvalidArgumentException
549
     */
550
    public static function isNotA($value, $class, $message = '')
551
    {
552
        static::string($class, 'Expected class as a string. Got: %s');
553
554
        if (\is_a($value, $class, \is_string($value))) {
555
            static::reportInvalidArgument(sprintf(
556
                $message ?: 'Expected an instance of this class or to this class among his parents other than %2$s. Got: %s',
557
                static::typeToString($value),
558
                $class
559
            ));
560
        }
561
    }
562
563
    /**
564
     * @psalm-pure