<?php

declare(strict_types=1);

namespace CodingTests;

class Numerical
{
    public static function isPandigital(int $input): bool
    {
        return self::isDigitsPresent($input, [49 => 1, 50 => 1, 51 => 1, 52 => 1, 53 => 1, 54 => 1, 55 => 1, 56 => 1, 57 => 1]);
    }

    public static function isPandigitalWithZero(int $input): bool
    {
        return self::isDigitsPresent($input, [48 => 0, 49 => 1, 50 => 1, 51 => 1, 52 => 1, 53 => 1, 54 => 1, 55 => 1, 56 => 1, 57 => 1]);
    }

    private static function isDigitsPresent(int $input, array $count): bool
    {
        $array = count_chars((string)$input, 1);
        ksort($array);
        if ($array == $count) {
            return TRUE;
        } else {
            return FALSE;
        }
    }
}
