src/Month.php
public function getLength(bool $leapYear) : int
    {
        switch ($this->month) {
            case Month::FEBRUARY:
                return ($leapYear ? 29 : 28);
            case Month::APRIL:
            case Month::JUNE:
            case Month::SEPTEMBER:
            case Month::NOVEMBER:
                return 30;
            default:
                return 31;
        }
    }
public function getLength(bool $leapYear) : int
    {
        switch ($this->month) {
            case Month::FEBRUARY:
                return ($leapYear ? 29 : 28);
            case Month::APRIL:
            case Month::JUNE:
            case Month::SEPTEMBER:
            case Month::NOVEMBER:
                return 30;
            default:
                return 31;
        }
    }
public function getLength ( bool $ leapYear ) : int { switch ( $ this -> month ) { case Month :: FEBRUARY : return ( $ leapYear ? 29 : 28 ) ; case Month :: APRIL : case Month :: JUNE : case Month :: SEPTEMBER : case Month :: NOVEMBER : return 30 ; default : return 31 ; } }
Returns the length of this month in days.

This takes a flag to determine whether to return the length for a leap year or not.

February has 28 days in a standard year and 29 days in a leap year.
April, June, September and November have 30 days.
All other months have 31 days.

@param bool $leapYear

@return int
Returns the length of this month in days .