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

TOC

Nil

Validates the input (string) to be a nil UUID.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Uuid\Nil;

(new Nil())->validate('00000000-0000-0000-0000-000000000000');

Failure reasons

  • Type.String when the validated value is not a string
  • Uuid.Nil when the validated value is not a nil UUID

Version1

Validates the input (string) to be a version 1 UUID.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Uuid\Version1;

(new Version1())->validate('5ba4dff4-e99d-11e8-9f32-f2801f1b9fd1');

Failure reasons

  • Type.String when the validated value is not a string
  • Uuid.Version1 when the validated value is not a version 1 UUID

Version2

Validates the input (string) to be a version 2 UUID.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Uuid\Version2;

(new Version2())->validate('5ba4dff4-e99d-21e8-9f32-f2801f1b9fd1');

Failure reasons

  • Type.String when the validated value is not a string
  • Uuid.Version2 when the validated value is not a version 2 UUID

Version3

Validates the input (string) to be a version 3 UUID.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Uuid\Version3;

(new Version3())->validate('5ba4dff4-e99d-31e8-9f32-f2801f1b9fd1');

Failure reasons

  • Type.String when the validated value is not a string
  • Uuid.Version3 when the validated value is not a version 3 UUID

Version4

Validates the input (string) to be a version 4 UUID.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Uuid\Version4;

(new Version4())->validate('d0e67d41-ab5d-4b49-8ed6-17e9bffc4621');

Failure reasons

  • Type.String when the validated value is not a string
  • Uuid.Version4 when the validated value is not a version 4 UUID

Version5

Validates the input (string) to be a version 5 UUID.

Version information

Available since: 1.0.0

Usage

<?php declare(strict_types);

use HarmonyIO\Validation\Rule\Uuid\Version5;

(new Version5())->validate('d0e67d41-ab5d-5b49-8ed6-17e9bffc4621');

Failure reasons

  • Type.String when the validated value is not a string
  • Uuid.Version5 when the validated value is not a version 5 UUID

Clone this wiki locally