Completed
Pull Request — master (#12)
by Aydin
02:26
created

HttpUpperCaserer::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 Faker\Generator;
6
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
7
use PhpSchool\PhpWorkshop\ExerciseCheck\CgiOutputExerciseCheck;
8
use Psr\Http\Message\RequestInterface;
9
use Symfony\Component\Process\Process;
10
use Symfony\Component\Process\ProcessBuilder;
11
use Zend\Diactoros\Request;
12
13
/**
14
 * Class HttpUpperCaserer
15
 * @package PhpSchool\LearnYouPhp\Exercise
16
 * @author Aydin Hassan <[email protected]>
17
 */
18
class HttpUpperCaserer implements ExerciseInterface, CgiOutputExerciseCheck
19
{
20
    
21
    /**
22
     * @var Generator
23
     */
24
    private $faker;
25
26
    /**
27
     * HttpUpperCaserer constructor.
28
     * @param Generator $faker
29
     */
30
    public function __construct(Generator $faker)
31
    {
32
        $this->faker = $faker;
33
    }
34
    
35
    /**
36
     * @return string
37
     */
38
    public function getName()
39
    {
40
        return 'HTTP Upper Caserer';
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getDescription()
47
    {
48
        return 'Uppercase and return the HTTP POST body content';
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getSolution()
55
    {
56
        return __DIR__ . '/../../res/solutions/http-upper-caserer/solution.php';
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getProblem()
63
    {
64
        return __DIR__ . '/../../res/problems/http-upper-caserer/problem.md';
65
    }
66
67
    /**
68
     * @return null
69
     */
70
    public function tearDown()
71
    {
72
    }
73
74
    /**
75
     * @return RequestInterface[]
76
     */
77
    public function getRequests()
78
    {
79
        $request = new Request('http://www.uppercaser.com', "POST");
80
        $request->getBody()->write($this->faker->word);
81
        
82
        return [$request];
83
    }
84
}
85