Skip to content

FileSystem

Pieter Hordijk edited this page Dec 31, 2018 · 1 revision

TOC

Directory

Validates the input (string) to be a valid directory.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\FileSystem\Directory;

(new Directory())->validate('/path/to/a/directory');

Failure reasons

  • Type.String when the validated value is not a string
  • FileSystem.Directory when the directory does not exists

Exists

Validates the input (string) to be a valid path.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\FileSystem\Exists;

(new Exists())->validate('/path/to');

Failure reasons

  • Type.String when the validated value is not a string
  • FileSystem.Exists when the path is valid

File

Validates the input (string) to be a valid file.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\FileSystem\File;

(new File())->validate('/path/to/a/file.txt');

Failure reasons

  • Type.String when the validated value is not a string
  • FileSystem.File when the file does not exists
Clone this wiki locally