MyBoldDecorator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 3
dl 0
loc 10
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A MyBoldDecorator() 0 3 1
A thisDay() 0 3 1
1
<?php
2
/**
3
* Description: demonstrates using the Wrapper decorator
4
*/
5
6
if (!@include 'Calendar/Calendar.php') {
7
    define('CALENDAR_ROOT', '../../');
8
}
9
require_once CALENDAR_ROOT.'Month.php';
10
require_once CALENDAR_ROOT.'Decorator.php'; // Not really needed but added to help this make sense
11
require_once CALENDAR_ROOT.'Decorator/Wrapper.php';
12
13
class MyBoldDecorator extends Calendar_Decorator
0 ignored issues
show
Bug introduced by
The type Calendar_Decorator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
{
15
    function MyBoldDecorator(&$Calendar)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
16
    {
17
        parent::Calendar_Decorator($Calendar);
18
    }
19
20
    function thisDay()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
21
    {
22
        return '<b>'.parent::thisDay().'</b>';
23
    }
24
}
25
26
$Month = new Calendar_Month(date('Y'), date('n'));
0 ignored issues
show
Bug introduced by
The type Calendar_Month was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
27
28
$Wrapper = & new Calendar_Decorator_Wrapper($Month);
0 ignored issues
show
Bug introduced by
The type Calendar_Decorator_Wrapper was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
29
$Wrapper->build();
30
31
echo '<h2>The Wrapper decorator</h2>';
32
echo '<i>Day numbers are rendered in bold</i><br /> <br />';
33
while ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator')) {
34
    echo $DecoratedDay->thisDay().'<br />';
35
}
36
?>
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...