IntegerTypeMock::getSample()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 14
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 0
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
}