GreetController::scream()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App\Example;
4
5
use Zapheus\Renderer\RendererInterface;
6
7
/**
8
 * Greet Controller
9
 *
10
 * @package App
11
 * @author  Rougin Gutib <[email protected]>
12
 */
13
class GreetController
14
{
15
    /**
16
     * @var \Zapheus\Renderer\RendererInterface
17
     */
18
    protected $renderer;
19
20
    /**
21
     * Initializes the HTTP controller instance.
22
     *
23
     * @param \Zapheus\Renderer\RendererInterface $renderer
24
     */
25 6
    public function __construct(RendererInterface $renderer)
26
    {
27 6
        $this->renderer = $renderer;
28 6
    }
29
30
    /**
31
     * Greets a specified name.
32
     *
33
     * @return string
34
     */
35 6
    public function greet($name = 'Stranger')
36
    {
37 6
        return $this->renderer->render('sample.greet', compact('name'));
38
    }
39
40
    /**
41
     * Shouts the specified name.
42
     *
43
     * @return string
44
     */
45 3
    public function scream()
46
    {
47 3
        return strtoupper($this->greet());
48
    }
49
}
50