Passed
Push — task/laravel-boot-performance ( 514268...f896e1 )
by Tristan
14:24 queued 08:17
created

HandleOutput   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 16
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handleOutput() 0 5 2
A getFunctions() 0 3 1
1
<?php namespace App\Utilities;
2
3
use Twig_Extension;
4
use Twig_SimpleFunction;
5
use Twig_SimpleFilter;
6
7
class HandleOutput extends Twig_Extension {
8
    /**
9
     * Functions
10
     * @return void
1 ignored issue
show
Coding Style introduced by
Function return type is void, but function contains return statement
Loading history...
11
     */
12 17
    public function getFunctions() {
0 ignored issues
show
introduced by
Method \App\Utilities\HandleOutput::getFunctions() does not have return type hint for its return value but it should be possible to add it based on @return annotation "void".
Loading history...
13
      return [
1 ignored issue
show
Bug Best Practice introduced by
The expression return array(new Twig_Si...this, 'handleOutput'))) returns the type array<integer,Twig_SimpleFunction> which is incompatible with the documented return type void.
Loading history...
14 17
        new Twig_SimpleFunction('handleOutput', [$this, 'handleOutput']),
15
      ];
16
    }
17
18 4
    public function handleOutput($output, $outputHtml, $nullHtml) {
1 ignored issue
show
introduced by
Method \App\Utilities\HandleOutput::handleOutput() does not have parameter type hint nor @param annotation for its parameter $output.
Loading history...
introduced by
Method \App\Utilities\HandleOutput::handleOutput() does not have parameter type hint nor @param annotation for its parameter $outputHtml.
Loading history...
introduced by
Method \App\Utilities\HandleOutput::handleOutput() does not have parameter type hint nor @param annotation for its parameter $nullHtml.
Loading history...
introduced by
Method \App\Utilities\HandleOutput::handleOutput() does not have void return type hint.
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function handleOutput()
Loading history...
19 4
        if( !empty($output) ) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space(s) after IF keyword; 0 found
Loading history...
Coding Style introduced by
Expected 0 spaces before closing bracket; 1 found
Loading history...
20 4
          echo $outputHtml;
21
        } else {
22
          echo $nullHtml;
23
        }
24 4
    }
25
}
26
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
27