EsiHelper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 19
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 6 1
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace JaySDe\HandlebarsBundle\Helper;
7
8
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
9
10
class EsiHelper implements HelperInterface
11
{
12
    /**
13
     * @var FragmentHandler
14
     */
15
    private $handler;
16
17 1
    public function __construct(FragmentHandler $handler)
18
    {
19 1
        $this->handler = $handler;
20 1
    }
21
22 1
    public function handle($context, $options)
23
    {
24 1
        $handler = $this->handler;
25 1
        $result = new \LightnCandy\SafeString($handler->render($context, 'esi', $options));
0 ignored issues
show
Bug introduced by
It seems like $handler->render($context, 'esi', $options) targeting Symfony\Component\HttpKe...agmentHandler::render() can also be of type false or null; however, LightnCandy\SafeString::__construct() does only seem to accept string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
26 1
        return $result;
27
    }
28
}
29