Completed
Push — master ( 2ff2f4...64e7ee )
by Aydin
02:08
created

HttpJsonApi::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace PhpSchool\LearnYouPhp\Exercise;
4
5
use PhpSchool\PhpWorkshop\Exercise\AbstractExercise;
6
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
7
use PhpSchool\PhpWorkshop\ExerciseCheck\CgiOutputExerciseCheck;
8
use Psr\Http\Message\RequestInterface;
9
use Zend\Diactoros\Request;
10
11
/**
12
 * Class HttpJsonApi
13
 * @package PhpSchool\LearnYouPhp\Exercise
14
 * @author Aydin Hassan <[email protected]>
15
 */
16
class HttpJsonApi extends AbstractExercise implements ExerciseInterface, CgiOutputExerciseCheck
17
{
18
    /**
19
     * @return string
20
     */
21
    public function getName()
22
    {
23
        return 'HTTP JSON API';
24
    }
25
26
    /**
27
     * @return string
28
     */
29
    public function getDescription()
30
    {
31
        return 'HTTP JSON API - Servers JSON when it receives a GET request';
32
    }
33
    
34
    /**
35
     * @return RequestInterface[]
36
     */
37
    public function getRequests()
38
    {
39
        $url = 'http://www.time.com/api/%s?iso=%s';
40
        return [
41
            (new Request(sprintf($url, 'parsetime', (new \DateTime)->format(DATE_ISO8601))))
42
                ->withMethod('GET'),
43
            (new Request(sprintf($url, 'unixtime', (new \DateTime)->format(DATE_ISO8601))))
44
                ->withMethod('GET'),
45
        ];
46
    }
47
}
48