MyBoldDecorator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A thisDay() 0 3 1
1
<?php
2
3
/**
4
 * Description: demonstrates using the Wrapper decorator.
5
 */
6
if (!@require_once __DIR__ . '/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
/**
14
 * Class MyBoldDecorator.
15
 */
16
class MyBoldDecorator extends Calendar_Decorator
17
{
18
    /**
19
     * @param $Calendar
20
     */
21
    public function __construct(&$Calendar)
22
    {
23
        parent::__construct($Calendar);
24
    }
25
26
    /**
27
     * @return string
28
     */
29
    public function thisDay()
30
    {
31
        return '<b>' . parent::thisDay() . '</b>';
32
    }
33
}
34
35
$Month = new Calendar_Month(date('Y'), date('n'));
0 ignored issues
show
Bug introduced by
date('Y') of type string is incompatible with the type integer expected by parameter $y of Calendar_Month::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

35
$Month = new Calendar_Month(/** @scrutinizer ignore-type */ date('Y'), date('n'));
Loading history...
Bug introduced by
date('n') of type string is incompatible with the type integer expected by parameter $m of Calendar_Month::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

35
$Month = new Calendar_Month(date('Y'), /** @scrutinizer ignore-type */ date('n'));
Loading history...
36
37
$Wrapper = new Calendar_Decorator_Wrapper($Month);
38
$Wrapper->build();
39
40
echo '<h2>The Wrapper decorator</h2>';
41
echo '<i>Day numbers are rendered in bold</i><br> <br>';
42
while (false !== ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator'))) {
43
    echo $DecoratedDay->thisDay() . '<br>';
44
}
45