/**
* Magic method to access properties of the date given by class to the format method.
*
* @param string $name The name of the property.
*
* @return mixed A value if the property name is valid, null otherwise.
*
* @since 1.7.0
*/
public function __get($name)
{
$value = null;
switch ($name) {
case 'daysinmonth':
$value = $this->format('t', true);
break;
case 'dayofweek':
$value = $this->format('N', true);
break;
case 'dayofyear':
$value = $this->format('z', true);
break;
case 'isleapyear':
$value = (bool) $this->format('L', true);
break;
case 'day':
$value = $this->format('d', true);
break;
case 'hour':
$value = $this->format('H', true);
break;
case 'minute':
$value = $this->format('i', true);
break;
case 'second':
$value = $this->format('s', true);
break;
case 'month':
$value = $this->format('m', true);
break;
case 'ordinal':
$value = $this->format('S', true);
break;
case 'week':
$value = $this->format('W', true);
break;
case 'year':
$value = $this->format('Y', true);
break;
default:
$trace = debug_backtrace();
trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE);
}
return $value;
}