protected function getDateFormat($type, $verbosity, DateTime $date)
    {
        $numWeekDay = (int)$date->format('w');
        $numWeekDay = $numWeekDay  == 0 ? 7 : $numWeekDay;
        $numMonth =  $date->format('n');

        $cacheKey = "$numWeekDay|$numMonth";

        if (isset($this->dateFormatCache[$type][$verbosity][$cacheKey])) {
            return $this->dateFormatCache[$type][$verbosity][$cacheKey];
        }

        $format = $this->getFormat($type, $verbosity);

        $format = $this->replaceDatePlaceHolders($date, $format);

        $this->dateFormatCache[$type][$verbosity][$cacheKey] = $format;

        return $format;

    }
protected function getDateFormat($type, $verbosity, DateTime $date)
    {
        $numWeekDay = (int)$date->format('w');
        $numWeekDay = $numWeekDay  == 0 ? 7 : $numWeekDay;
        $numMonth =  $date->format('n');

        $cacheKey = "$numWeekDay|$numMonth";

        if (isset($this->dateFormatCache[$type][$verbosity][$cacheKey])) {
            return $this->dateFormatCache[$type][$verbosity][$cacheKey];
        }

        $format = $this->getFormat($type, $verbosity);

        $format = $this->replaceDatePlaceHolders($date, $format);

        $this->dateFormatCache[$type][$verbosity][$cacheKey] = $format;

        return $format;

    }
protected function getDateFormat ( $ type , $ verbosity , DateTime $ date ) { $ numWeekDay = ( int ) $ date -> format ( 'w' ) ; $ numWeekDay = $ numWeekDay == 0 ? 7 : $ numWeekDay ; $ numMonth = $ date -> format ( 'n' ) ; $ cacheKey = "$numWeekDay|$numMonth" ; if ( isset ( $ this -> dateFormatCache [ $ type ] [ $ verbosity ] [ $ cacheKey ] ) ) { return $ this -> dateFormatCache [ $ type ] [ $ verbosity ] [ $ cacheKey ] ; } $ format = $ this -> getFormat ( $ type , $ verbosity ) ; $ format = $ this -> replaceDatePlaceHolders ( $ date , $ format ) ; $ this -> dateFormatCache [ $ type ] [ $ verbosity ] [ $ cacheKey ] = $ format ; return $ format ; }
The date formats has to be parsed before passing them to DateTime. So
this method does the parsing and caching.

@param string   $type
@param string   $verbosity
@param DateTime $date

@return string
The date formats has to be parsed before passing them to DateTime . So this method does the parsing and caching .