Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
85.71% covered (warning)
85.71%
6 / 7
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
FormId
85.71% covered (warning)
85.71%
6 / 7
50.00% covered (danger)
50.00%
1 / 2
2.01
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
 getEntityType
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3declare( strict_types = 1 );
4
5namespace Wikibase\Lexeme\Domain\Model;
6
7use Wikimedia\Assert\Assert;
8
9/**
10 * Immutable ID of a Lexeme' form in the lexicographical data model.
11 *
12 * @see https://www.mediawiki.org/wiki/Extension:WikibaseLexeme/Data_Model#Form
13 *
14 * @license GPL-2.0-or-later
15 * @author Thiemo Kreuz
16 */
17class FormId extends LexemeSubEntityId {
18
19    public const PATTERN = '/^L[1-9]\d*-F[1-9]\d*\z/';
20
21    public function __construct( string $serialization ) {
22        parent::__construct( $serialization );
23
24        Assert::parameter(
25            preg_match( self::PATTERN, $serialization ),
26            '$serialization',
27            'Form ID must match "' . self::PATTERN . '", given: ' . $serialization
28        );
29    }
30
31    public function getEntityType(): string {
32        return Form::ENTITY_TYPE;
33    }
34
35}