IntegerTypeMock   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 21
dl 0
loc 32
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSample() 0 14 2
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Created by PhpStorm.
5
 * User: danchukas
6
 * Date: 2017-07-18 08:46
7
 */
8
9
namespace DanchukAS\Mock\Type;
10
11
12
use DanchukAS\Mock\TypeMock;
13
14
/**
15
 * Class IntegerTypeMock
16
 * @package DanchukAS\Mock\Type
17
 */
18
class IntegerTypeMock extends TypeMock
19
{
20
    const /** @noinspection PhpConstantNamingConventionInspection */
21
        ZERO = 'zero, false, not positive';
22
    const MINUS_ONE = 'false, negative';
23
    const /** @noinspection PhpConstantNamingConventionInspection */
24
        ONE = 'true, positive';
25
    const /** @noinspection PhpConstantNamingConventionInspection */
26
        MAX = 'max';
27
    const /** @noinspection PhpConstantNamingConventionInspection */
28
        MIN = 'min';
29
    const USUAL = 'usual';
30
31
    protected static $recommendCount = 6;
32
33
    /**
34
     * @return \Generator
35
     */
36
    public static function getSample()
37
    {
38
        $sample_list = [
39
            self::ZERO => 0
40
            , self::MINUS_ONE => -1
41
            , self::ONE => 1
42
            , self::MAX => PHP_INT_MAX
43
            , self::MIN => PHP_INT_MIN
44
        ];
45
        foreach ($sample_list as $expression => $value) {
46
            yield [$expression => $value];
47
        }
48
49
        yield [self::USUAL => random_int(PHP_INT_MIN, PHP_INT_MAX)];
50
//        for ($sequence_number = 2; ; $sequence_number++) {
51
//            yield [self::USUAL . "_$sequence_number" => random_int(PHP_INT_MIN, PHP_INT_MAX)];
52
//        }
53
    }
54
}