Completed
Pull Request — master (#2)
by Pol
02:05
created

Time   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
cbo 4
dl 0
loc 46
ccs 0
cts 24
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A find() 0 23 1
A get() 0 4 1
1
<?php
2
3
namespace drupol\Yaroc\Examples;
4
5
use drupol\Yaroc\Plugin\Provider;
6
7
/**
8
 * Class Time.
9
 */
10
class Time extends BaseExample
11
{
12
    /**
13
     * @var integer[]
14
     */
15
    protected $time;
16
17
    /**
18
     * @throws \Http\Client\Exception
19
     *
20
     * @return $this
21
     */
22
    public function find()
23
    {
24
        $provider = Provider::withResource('generateIntegers');
25
26
        $hours = $this->getRandomOrgAPI()->getData(
27
            $provider->withParameters(
28
                ['n' => 1, 'min' => 0, 'max' => 23]
29
            )
30
        );
31
        $minutesSeconds = $this->getRandomOrgAPI()->getData(
32
            $provider->withParameters(
33
                ['n' => 2, 'min' => 0, 'max' => 59]
34
            )
35
        );
36
37
        $this->time = [
38
            'h' => $hours[0],
39
            'm' => $minutesSeconds[0],
40
            's' => $minutesSeconds[1],
41
        ];
42
43
        return $this;
44
    }
45
46
    /**
47
     * Get the time.
48
     *
49
     * @return integer[]
50
     */
51
    public function get()
52
    {
53
        return $this->time;
54
    }
55
}
56