Skip to content
Pieter Hordijk edited this page Jan 1, 2019 · 1 revision

TOC

Countable

Validates the input (mixed) to contain a countable value.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Set\Countable;

(new Countable())->validate(['foo', 'bar']);

Failure reasons

  • Set.Countable when the validated value is not countable

LengthRange

Validates the input (countable) to be within minimum length (int) and maximum length (int) inclusive.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Set\LengthRange;

(new LengthRange(1, 10))->validate(['foo', 'bar']);

Failure reasons

  • Set.Countable when the validated value is not countable
  • Set.MinimumLength when the countable list contains less items than minimum
  • Set.MaximumLength when the countable list contains more items than maximum

MinimumLength

Validates the input (countable) to contain more than or exactly minimum length (int) number of items.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Set\MinimumLength;

(new MinimumLength(1))->validate(['foo', 'bar']);

Failure reasons

  • Set.Countable when the validated value is not countable
  • Set.MinimumLength when the countable list contains less items than minimum

MaximumLength

Validates the input (countable) to contain less than or exactly maximum length (int) number of items.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Set\MaximumLength;

(new MaximumLength(10))->validate(['foo', 'bar']);

Failure reasons

  • Set.Countable when the validated value is not countable
  • Set.MaximumLength when the countable list contains more items than maximum
Clone this wiki locally