for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Description: demonstrates using the Wrapper decorator.
*/
if (!@require_once __DIR__ . '/Calendar/Calendar.php') {
define('CALENDAR_ROOT', '../../');
}
require_once CALENDAR_ROOT . 'Month.php';
require_once CALENDAR_ROOT . 'Decorator.php'; // Not really needed but added to help this make sense
require_once CALENDAR_ROOT . 'Decorator/Wrapper.php';
* Class MyBoldDecorator.
class MyBoldDecorator extends Calendar_Decorator
{
* @param $Calendar
public function __construct(&$Calendar)
parent::__construct($Calendar);
* @return string
public function thisDay()
return '<b>' . parent::thisDay() . '</b>';
$Month = new Calendar_Month(date('Y'), date('n'));
date('Y')
string
integer
$y
Calendar_Month::__construct()
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
ignore-type
$Month = new Calendar_Month(/** @scrutinizer ignore-type */ date('Y'), date('n'));
date('n')
$m
$Month = new Calendar_Month(date('Y'), /** @scrutinizer ignore-type */ date('n'));
$Wrapper = new Calendar_Decorator_Wrapper($Month);
$Wrapper->build();
echo '<h2>The Wrapper decorator</h2>';
echo '<i>Day numbers are rendered in bold</i><br> <br>';
while (false !== ($DecoratedDay = $Wrapper->fetch('MyBoldDecorator'))) {
echo $DecoratedDay->thisDay() . '<br>';