Single   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 * This file is part of the Tuple package.
5
 * For the full copyright information please view the LICENCE file that was
6
 * distributed with this package.
7
 *
8
 * @copyright Simon Deeley 2017
9
 */
10
11
namespace simondeeley\Tuples;
12
13
use simondeeley\Tuple;
14
15
/**
16
 * Concrete implementaion of a single tuple
17
 *
18
 * In use, this class allows you to create a mathematical single which in PHP
19
 * terms is an object containing exactly one item. This item can be of any
20
 * type. Construction in through the 'new' keyword, e.g.
21
 * $single = new Single('foo'); Once instantiated, access to the objects
22
 * properties are via an array-type access, such as $value = $single[0];
23
 * Trying to set values this way will result in an exception being thrown.
24
 *
25
 * @final
26
 * @author Simon Deeley <[email protected]>
27
 */
28
final class Single extends Tuple
29
{
30
    const MAX_LENGTH = 1;
31
    const MIN_LENGTH = 1;
32
33
    /**
34
     * Return type of this object
35
     *
36
     * @see simondeeley\Type
37
     * @return string
38
     */
39 5
    final public static function getType(): string
0 ignored issues
show
Coding Style introduced by
Unnecessary FINAL modifier in FINAL class
Loading history...
40
    {
41 5
        return 'SINGLE';
42
    }
43
}
44