src/YearWeek.php
public function atDay(int $dayOfWeek) : LocalDate
    {
        Field\DayOfWeek::check($dayOfWeek);

        $correction = LocalDate::of($this->year, 1, 4)->getDayOfWeek()->getValue() + 3;
        $dayOfYear = $this->week * 7 + $dayOfWeek - $correction;
        $maxDaysOfYear = Field\Year::isLeap($this->year) ? 366 : 365;

        if ($dayOfYear > $maxDaysOfYear) {
            return LocalDate::ofYearDay($this->year + 1, $dayOfYear - $maxDaysOfYear);
        }

        if ($dayOfYear > 0) {
            return LocalDate::ofYearDay($this->year, $dayOfYear);
        }

        $daysOfPreviousYear = Field\Year::isLeap($this->year - 1) ? 366 : 365;

        return LocalDate::ofYearDay($this->year - 1, $daysOfPreviousYear + $dayOfYear);
    }
public function atDay(int $dayOfWeek) : LocalDate
    {
        Field\DayOfWeek::check($dayOfWeek);

        $correction = LocalDate::of($this->year, 1, 4)->getDayOfWeek()->getValue() + 3;
        $dayOfYear = $this->week * 7 + $dayOfWeek - $correction;
        $maxDaysOfYear = Field\Year::isLeap($this->year) ? 366 : 365;

        if ($dayOfYear > $maxDaysOfYear) {
            return LocalDate::ofYearDay($this->year + 1, $dayOfYear - $maxDaysOfYear);
        }

        if ($dayOfYear > 0) {
            return LocalDate::ofYearDay($this->year, $dayOfYear);
        }

        $daysOfPreviousYear = Field\Year::isLeap($this->year - 1) ? 366 : 365;

        return LocalDate::ofYearDay($this->year - 1, $daysOfPreviousYear + $dayOfYear);
    }
public function atDay ( int $ dayOfWeek ) : LocalDate { Field \ DayOfWeek :: check ( $ dayOfWeek ) ; $ correction = LocalDate :: of ( $ this -> year , 1 , 4 ) -> getDayOfWeek ( ) -> getValue ( ) + 3 ; $ dayOfYear = $ this -> week * 7 + $ dayOfWeek - $ correction ; $ maxDaysOfYear = Field \ Year :: isLeap ( $ this -> year ) ? 366 : 365 ; if ( $ dayOfYear > $ maxDaysOfYear ) { return LocalDate :: ofYearDay ( $ this -> year + 1 , $ dayOfYear - $ maxDaysOfYear ) ; } if ( $ dayOfYear > 0 ) { return LocalDate :: ofYearDay ( $ this -> year , $ dayOfYear ) ; } $ daysOfPreviousYear = Field \ Year :: isLeap ( $ this -> year - 1 ) ? 366 : 365 ; return LocalDate :: ofYearDay ( $ this -> year - 1 , $ daysOfPreviousYear + $ dayOfYear ) ; }
Combines this year-week with a day-of-week to create a LocalDate.

@param int $dayOfWeek

@return LocalDate
Combines this year - week with a day - of - week to create a LocalDate .