GreetController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 35
ccs 7
cts 7
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A greet() 0 3 1
A __construct() 0 3 1
A scream() 0 3 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