Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
5 / 5 |
EntitySchema\Domain\Model\SchemaId | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
5 / 5 |
__construct | |
100.00% |
1 / 1 |
2 | |
100.00% |
4 / 4 |
|||
getId | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
<?php | |
namespace EntitySchema\Domain\Model; | |
use InvalidArgumentException; | |
/** | |
* @license GPL-2.0-or-later | |
*/ | |
class SchemaId { | |
/** @var string */ | |
private $id; | |
const PATTERN = '/^E[1-9][0-9]*\z/'; | |
/** | |
* @param string $id | |
*/ | |
public function __construct( $id ) { | |
if ( !preg_match( self::PATTERN, $id ) ) { | |
throw new InvalidArgumentException( 'ID must match ' . self::PATTERN ); | |
} | |
$this->id = $id; | |
} | |
/** | |
* @return string | |
*/ | |
public function getId() { | |
return $this->id; | |
} | |
} |