FileAccessibilityAndValidationCheck
class FileAccessibilityAndValidationCheck implements EnvironmentCheck (View source)
Checks for the accessibility and file type validation of one or more files or folders.
Examples: // Checks /assets/calculator_files has .json files and all files are valid json files. EnvironmentCheckSuite::register( 'check', 'FileAccessibilityAndValidationCheck( "' . BASE_PATH . '/assets/calculator_files/*.json", "jsonValidate", '.FileAccessibilityAndValidationCheck::CHECK_ALL.' )', 'Check a json file exist and are all valid json files' );
// Checks /assets/calculator_files/calculator.json exists and is valid json file. EnvironmentCheckSuite::register( 'check', 'FileAccessibilityAndValidationCheck( "' . BASE_PATH . '/assets/calculator_files/calculator.json", "jsonValidate", '.FileAccessibilityAndValidationCheck::CHECK_SINGLE.' )', 'Check a calculator.json exists and is valid json file' );
// Check only existence EnvironmentCheckSuite::register( 'check', 'FileAccessibilityAndValidationCheck("' . BASE_PATH . '/assets/calculator_files/calculator.json")', 'Check a calculator.json exists only' );
Constants
CHECK_SINGLE |
|
CHECK_ALL |
|
Properties
protected | string | $path | Absolute path to a file or folder, compatible with glob(). |
|
protected | int | $fileTypeValidateFunc | Constant, check for a single file to match age criteria, or all of them. |
|
protected | int | $checkType | Constant, check for a single file to match age criteria, or all of them. |
Methods
No description
Details
__construct(string $path, string $fileTypeValidateFunc = 'noVidation', null|int $checkType = null)
No description
array
check()
No description
protected bool
noVidation(string $file)
No description
protected array
getFiles()
Gets a list of absolute file paths.