protected function getDayInYear($date, $pattern = 'D') { if ($pattern != 'D') { throw new Exception('The pattern for day in year is "D".'); } return $date['yday']; }