Returns a copy of this YearMonth with the year altered.

@param int $year

@return YearMonth

@throws DateTimeException If the year is not valid.
322024
public function withYear(int $year) : YearMonth
    {
        if ($year === $this->year) {
            return $this;
        }

        Field\Year::check($year);

        return new YearMonth($year, $this->month);
    }
577603
protected function GetFullYear($year)
	{
		if ( strlen($year) < 4 )
		{
			// assume the current century (could be problematic around 2098, 2099, etc)
			$century = substr(date("Y"),0,2);
			$year = $century . $year;
		}

		return $year;
	}
576192
public function getByTerm($year, $term)
    {
        $url = $this->requestUrl;

        $param['__VIEWSTATE'] = true;
        $param['__EVENTTARGET'] = "xnd";
        $param['__EVENTARGUMENT'] = "";
        $param['xnd'] = $year;
        $param['xqd'] = $term;

        $response = $this->request('post', [$url, $param]);

        return $this->parseSchedule($response);
    }
110494
public static function cWeekEnding($year, $cWeek = 0) {
		if ($cWeek < 1 || $cWeek >= static::cWeeks($year)) {
			return static::cWeekBeginning($year + 1) - 1;
		}
		return static::cWeekBeginning($year, $cWeek + 1) - 1;
	}
424128
public static function GetDaysInMonth( int $year, int $month ) : int
   {

      $dt = new \DateTime();
      $dt->setDate( $year, $month, 2 );
      $dt->setTime( 0, 0, 2 );

      return \intval( $dt->format( 't' ) );

   }
633492
public static function check(int $year) : void
    {
        if ($year < self::MIN_VALUE || $year > self::MAX_VALUE) {
            throw DateTimeException::fieldNotInRange(self::NAME, $year, self::MIN_VALUE, self::MAX_VALUE);
        }
    }
1013121
private function createSunday($year)
    {
        $easterSunday = new \DateTime('21.03.' . $year);
        $easterSunday->modify(sprintf('+%d days', easter_days($year)));

        return $easterSunday;
    }
460926
public static function yearMonth() : PatternParser
    {
        static $parser;

        if ($parser) {
            return $parser;
        }

        return $parser = (new PatternParserBuilder())
            ->appendCapturePattern(Year::PATTERN, Year::NAME)
            ->appendLiteral('-')
            ->appendCapturePattern(MonthOfYear::PATTERN, MonthOfYear::NAME)
            ->toParser();
    }
459135
public static function easterDate($year)
    {
        if ($year < 1970 || $year > 2037) {
            return trigger_error('This function is only valid for years between 1970 and 2037 inclusive', E_USER_WARNING);
        }

        $days = self::$gregorian_calendar->easterDays($year);

        // Calculate time-zone offset
        $date_time      = new \DateTime('now', new \DateTimeZone(date_default_timezone_get()));
        $offset_seconds = (int) $date_time->format('Z');

        if ($days < 11) {
            return self::jdtounix(self::$gregorian_calendar->ymdToJd($year, 3, $days + 21)) - $offset_seconds;
        } else {
            return self::jdtounix(self::$gregorian_calendar->ymdToJd($year, 4, $days - 10)) - $offset_seconds;
        }
    }
653148
public NumberExpression<Integer> yearMonth() {
        if (yearMonth == null) {
            yearMonth = Expressions.numberOperation(Integer.class, Ops.DateTimeOps.YEAR_MONTH, mixin);
        }
        return yearMonth;
    }
554540
protected function getYears()
    {
        $intSecondsPerYear = ($this->isPositive()) ? DateTimeSpan::SECONDS_PER_YEAR : ((-1) * DateTimeSpan::SECONDS_PER_YEAR);
        $intYears = floor($this->intSeconds / $intSecondsPerYear);
        if ($this->isNegative()) {
            $intYears = (-1) * $intYears;
        }
        return $intYears;
    }
265766
public function firstAirDateYear($year)
    {
        if ($year instanceof \DateTime) {
            $year = $year->format('Y');
        }

        $this->set('first_air_date_year', (int) $year);

        return $this;
    }
1172063
protected function yearOrYearNo($year)
    {
        if (is_scalar($year)) {
            return $this->getYear($year);
        }

        if (!$year instanceof Year) {
            throw new InvalidArgumentException(
                '$year must be an instance of BmCalendar\Year; got "' . get_class($year) . '"'
            );
        }

        return $year;
    }
1129124
public static function cWeeks($year = null) {
		if ($year === null) {
			$year = date('Y');
		}
		return (int)date('W', mktime(23, 59, 59, 12, 28, $year));
	}
1348999
private static function calculateYearInQuadCycle($year) {
        
        $yearInGrandCycle = static::calculateYearInGrandCycle($year);
        
        // static::FIRST_QUAD_CYCLE;
        $yearInQuadCycle = $yearInGrandCycle % static::FIRST_QUAD_CYCLE;
        
        if ((static::GRAND_CYCLE_LENGTH - static::SECOND_QUAD_CYCLE) < $yearInGrandCycle) {
            
            // static::SECOND_QUAD_CYCLE;
            $yearInQuadCycle = $yearInGrandCycle - (21 * static::FIRST_QUAD_CYCLE);
            
        }
        
        return $yearInQuadCycle;
    }
234940
private function setYear($year) {
        
        //preventing duplication process
        if ($year == $this->year) {
            return;
        }
        $this->year          = (int) $year;
        $maximumDayAvailable = static::getMonthLength($this->year, $this->month);
        if ($this->day > $maximumDayAvailable) {
            $this->day = $maximumDayAvailable;
        }
    }
1214109
public static function isLeapYear($year = null): bool
    {
        $year = $year ? $year : date('Y');
        return ($year % 4 == 0 && $year % 100 != 0 || $year % 400 == 0);
    }