public static function validate($birthday): array
    {
        $date = strtotime($birthday);

        if ($date === false) {
            throw new \InvalidArgumentException("Invalid birthday: $birthday");
        }

        $year = date('Y', $date);
        $month = date('n', $date);
        $day = date('j', $date);
        $currentYear = date('Y');

        if ($year > $currentYear || $year <= $currentYear - self::MAX_AGE) {
            throw new \OutOfRangeException('The age is out of range [0, 200)');
        }

        return ['year' => $year, 'month' => $month, 'day' => $day];
    }
public static function validate($birthday): array
    {
        $date = strtotime($birthday);

        if ($date === false) {
            throw new \InvalidArgumentException("Invalid birthday: $birthday");
        }

        $year = date('Y', $date);
        $month = date('n', $date);
        $day = date('j', $date);
        $currentYear = date('Y');

        if ($year > $currentYear || $year <= $currentYear - self::MAX_AGE) {
            throw new \OutOfRangeException('The age is out of range [0, 200)');
        }

        return ['year' => $year, 'month' => $month, 'day' => $day];
    }
public static function validate ( $ birthday ) : array { $ date = strtotime ( $ birthday ) ; if ( $ date === false ) { throw new \ InvalidArgumentException ( "Invalid birthday: $birthday" ) ; } $ year = date ( 'Y' , $ date ) ; $ month = date ( 'n' , $ date ) ; $ day = date ( 'j' , $ date ) ; $ currentYear = date ( 'Y' ) ; if ( $ year > $ currentYear || $ year <= $ currentYear - self :: MAX_AGE ) { throw new \ OutOfRangeException ( 'The age is out of range [0, 200)' ) ; } return [ 'year' => $ year , 'month' => $ month , 'day' => $ day ] ; }
Validate birthday, if it is valid then return the birth year, month and day

@param  string                      $birthday
@throws \InvalidArgumentException
@throws \OutOfRangeException
@return array
Validate birthday if it is valid then return the birth year month and day