public static function isFile($object, $value): bool
    {
        // allow empty fields, "required" option filter that
        if ($object === null) {
            return true;
        }

        $all = false;
        // if string is given
        if (!Any::isArray($value)) {
            if ($value === '*') {
                $all = true;
            } else {
                $value = [$value];
            }
        }

        // input file is not object?
        if ($object === null || !Any::isObj($object)) {
            return false;
        }

        // get guess file type, based on mime-type
        $type = $object->guessExtension();
        if ($type === null) {
            return false;
        }

        return ($all ? true : Arr::in($type, $value));
    }
public static function isFile($object, $value): bool
    {
        // allow empty fields, "required" option filter that
        if ($object === null) {
            return true;
        }

        $all = false;
        // if string is given
        if (!Any::isArray($value)) {
            if ($value === '*') {
                $all = true;
            } else {
                $value = [$value];
            }
        }

        // input file is not object?
        if ($object === null || !Any::isObj($object)) {
            return false;
        }

        // get guess file type, based on mime-type
        $type = $object->guessExtension();
        if ($type === null) {
            return false;
        }

        return ($all ? true : Arr::in($type, $value));
    }
public static function isFile ( $ object , $ value ) : bool { // allow empty fields, "required" option filter that if ( $ object === null ) { return true ; } $ all = false ; // if string is given if ( ! Any :: isArray ( $ value ) ) { if ( $ value === '*' ) { $ all = true ; } else { $ value = [ $ value ] ; } } // input file is not object? if ( $ object === null || ! Any :: isObj ( $ object ) ) { return false ; } // get guess file type, based on mime-type $ type = $ object -> guessExtension ( ) ; if ( $ type === null ) { return false ; } return ( $ all ? true : Arr :: in ( $ type , $ value ) ) ; }
Check if field is file or null
@param object $object
@param $value
@return bool
Check if field is file or null