Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
AttributeSingleValue
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 confirmParameterCount
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3/**
4 * @author: Doug Wilbourne (dougwilbourne@gmail.com)
5 */
6declare(strict_types=1);
7
8namespace pvc\html\attribute;
9
10use pvc\html\err\InvalidNumberOfAttributeValuesException;
11use pvc\interfaces\html\attribute\AttributeInterface;
12use pvc\interfaces\html\attribute\AttributeWithValueInterface;
13
14/**
15 * Class AttributeSingleValue
16 * @phpstan-import-type ValueType from AttributeWithValueInterface
17 */
18class AttributeSingleValue extends AttributeWithValue
19{
20    /**
21     * @param  array<ValueType>  $values
22     *
23     * @return Void
24     * @throws InvalidNumberOfAttributeValuesException
25     */
26    protected function confirmParameterCount(array $values): void
27    {
28        if (count($values) != 1) {
29            throw new InvalidNumberOfAttributeValuesException('1');
30        }
31    }
32}