public static function readableFile($value)
    {
        if (empty($value)) {
            throw new \InvalidArgumentException("Empty file path given.");
        }

        if (!is_file($value)) {
            throw new \InvalidArgumentException("Given file path is not a regular file.");
        }

        if (!is_readable($value)) {
            throw new \InvalidArgumentException("Given file is not readable.");
        }

        return $value;
    }
public static function readableFile($value)
    {
        if (empty($value)) {
            throw new \InvalidArgumentException("Empty file path given.");
        }

        if (!is_file($value)) {
            throw new \InvalidArgumentException("Given file path is not a regular file.");
        }

        if (!is_readable($value)) {
            throw new \InvalidArgumentException("Given file is not readable.");
        }

        return $value;
    }
public static function readableFile ( $ value ) { if ( empty ( $ value ) ) { throw new \ InvalidArgumentException ( "Empty file path given." ) ; } if ( ! is_file ( $ value ) ) { throw new \ InvalidArgumentException ( "Given file path is not a regular file." ) ; } if ( ! is_readable ( $ value ) ) { throw new \ InvalidArgumentException ( "Given file is not readable." ) ; } return $ value ; }
Validates the given file path and throws an exception
if it is not a regular file or readable.

@param string $value value to check

@return string path to valid file

@throws \InvalidArgumentException in case of validation errors (empty value or irregular or non-readable file)
Validates the given file path and throws an exception if it is not a regular file or readable .