Skip to content
Pieter Hordijk edited this page Dec 31, 2018 · 3 revisions

TOC

ValidAttributes

Validates the input file (string of SVG file path) to contain only valid SVG attributes.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\File\Image\Type\Svg\ValidAttributes;

(new ValidAttributes())->validate('/path/to/an/svg/file.svg');

Failure reasons

  • Type.String when the input valid is not a string
  • FileSystem.File when the validated file does not exist
  • File.MimeType when the validated file does not have an SVG mime type
  • File.Image.Type.Svg.ValidAttributes when the validated file does not contain valid XML
  • File.Image.Type.Svg.ValidAttributes when the validated file contains invalid SVG attributes

ValidElements

Validates the input file (string of SVG file path) to contain only valid SVG attributes.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\File\Image\Type\Svg\ValidElements;

(new ValidElements())->validate('/path/to/an/svg/file.svg');

Failure reasons

  • Type.String when the input valid is not a string
  • FileSystem.File when the validated file does not exist
  • File.MimeType when the validated file does not have an SVG mime type
  • File.Image.Type.Svg.ValidElements when the validated file does not contain valid XML
  • File.Image.Type.Svg.ValidElements when the validated file contains invalid SVG elements

Bmp

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

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\File\Image\Type\Bmp;

(new Bmp())->validate('/path/to/an/bmp/file.bmp

Failure reasons

  • Type.String when the input valid is not a string
  • FileSystem.File when the validated file does not exist
  • File.Image.Type.Bmp when the validated file is not a BMP file

Gif

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

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\File\Image\Type\Gif;

(new Gif())->validate('/path/to/a/gif/file.gif');

Failure reasons

  • Type.String when the input valid is not a string
  • FileSystem.File when the validated file does not exist
  • File.MimeType when the validated file does not have a GIF mime type
  • File.Image.Type.Gif when the validated file is not a valid GIF file

Jpeg

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

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\File\Image\Type\Jpeg;

(new Jpeg())->validate('/path/to/a/jpg/file.jpg');

Failure reasons

  • Type.String when the input valid is not a string
  • FileSystem.File when the validated file does not exist
  • File.MimeType when the validated file does not have a JPEG mime type
  • File.Image.Type.Jpeg when the validated file is not a valid JPEG file

Png

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

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\File\Image\Type\Png;

(new Png())->validate('/path/to/a/png/file.png');

Failure reasons

  • Type.String when the input valid is not a string
  • FileSystem.File when the validated file does not exist
  • File.MimeType when the validated file does not have a PNG mime type
  • File.Image.Type.Png when the validated file is not a valid PNG file

Svg

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

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\File\Image\Type\Svg;

(new Svg())->validate('/path/to/an/svg/file.svg');

Failure reasons

  • Type.String when the input valid is not a string
  • FileSystem.File when the validated file does not exist
  • File.MimeType when the validated file does not have an SVG mime type
  • File.Image.Type.Svg.ValidAttributes when the validated file does not contain valid XML
  • File.Image.Type.Svg.ValidAttributes when the validated file contains invalid SVG attributes
  • File.Image.Type.Svg.ValidElements when the validated file does not contain valid XML
  • File.Image.Type.Svg.ValidElements when the validated file contains invalid SVG elements
Clone this wiki locally