public function getFormat(string $dateLength): string
    {
        // Oops, unknown length of date
        if (false === (new DateLength())->isCorrectType($dateLength)) {
            throw UnknownDateLengthException::createException($dateLength);
        }

        $format = '';

        switch ($dateLength) {
            case DateLength::DATE:
                $format = $this->dateFormat;

                break;
            case DateLength::DATETIME:
                $format = $this->dateTimeFormat;

                break;
            case DateLength::TIME:
                $format = $this->timeFormat;

                break;
        }

        return $format;
    }
public function getFormat(string $dateLength): string
    {
        // Oops, unknown length of date
        if (false === (new DateLength())->isCorrectType($dateLength)) {
            throw UnknownDateLengthException::createException($dateLength);
        }

        $format = '';

        switch ($dateLength) {
            case DateLength::DATE:
                $format = $this->dateFormat;

                break;
            case DateLength::DATETIME:
                $format = $this->dateTimeFormat;

                break;
            case DateLength::TIME:
                $format = $this->timeFormat;

                break;
        }

        return $format;
    }
public function getFormat ( string $ dateLength ) : string { // Oops, unknown length of date if ( false === ( new DateLength ( ) ) -> isCorrectType ( $ dateLength ) ) { throw UnknownDateLengthException :: createException ( $ dateLength ) ; } $ format = '' ; switch ( $ dateLength ) { case DateLength :: DATE : $ format = $ this -> dateFormat ; break ; case DateLength :: DATETIME : $ format = $ this -> dateTimeFormat ; break ; case DateLength :: TIME : $ format = $ this -> timeFormat ; break ; } return $ format ; }
Returns format of date according to given length of date

@param string $dateLength Type of date length. One of the DateLength's class constants.
@throws UnknownDateLengthException
@return string
Returns format of date according to given length of date