Migrate isValid() to Validator and ValidatorInterface

* Maintain backwards compatibility with the former Uuid::isValid() and
  Uuid::VALID_PATTERN
* Remove the assert statements in favor of str_replace and preg_match
* Make the validator a featureset of the factory
* Remove old suggestion about locations of constants
* Remove argument count assertions
* Remove VALID_PATTERN from Uuid
This commit is contained in:
Bradyn Poulsen
2016-02-06 00:58:44 -07:00
committed by Ben Ramsey
parent 6f3316a1f7
commit 3cf759ad05
8 changed files with 276 additions and 114 deletions
+6
View File
@@ -18,6 +18,7 @@ use Exception;
use InvalidArgumentException;
use Ramsey\Uuid\Exception\InvalidUuidStringException;
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
use Ramsey\Uuid\Validator\ValidatorInterface;
/**
* UuidFactoryInterface defines common functionality all `UuidFactory` instances
@@ -25,6 +26,11 @@ use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
*/
interface UuidFactoryInterface
{
/**
* @return ValidatorInterface
*/
public function getValidator();
/**
* Generate a version 1 UUID from a host ID, sequence number, and the current time.
*