Assert\Assertion::readable PHP Метод

readable() публичный статический Метод

Assert that the value is something readable
public static readable ( string $value, string | null $message = null, string | null $propertyPath = null ) : boolean
$value string
$message string | null
$propertyPath string | null
Результат boolean
    public static function readable($value, $message = null, $propertyPath = null)
    {
        static::string($value, $message, $propertyPath);
        if (!is_readable($value)) {
            $message = sprintf($message ?: 'Path "%s" was expected to be readable.', static::stringify($value));
            throw static::createException($value, $message, static::INVALID_READABLE, $propertyPath);
        }
        return true;
    }

Usage Example

 public function __construct($directory)
 {
     Assertion::directory($directory);
     Assertion::readable($directory);
     $directory .= substr($directory, -1) === '/' ? '' : '/';
     //add ending slash
     $this->directory = $directory;
 }
All Usage Examples Of Assert\Assertion::readable