Code Duplication    Length = 16-16 lines in 2 locations

Extension/BuiltInFunctionsExtension.php 2 locations

@@ 101-116 (lines=16) @@
98
     * @return string
99
     * @throws \Exception
100
     */
101
    public function startOfWeek($date = null)
102
    {
103
        $now = clone $this->dateTimeProvider->get();
104
105
        if ($date) {
106
            $now = $this->modifyDate($now, $date);
107
        }
108
109
        $year = $now->format('o'); // o = ISO-8601 year number
110
        $week = $now->format('W'); // W = ISO-8601 week number of year, weeks starting on Monday
111
112
        $startOfWeek = $now->setISODate($year, $week);
113
        $startOfWeek->setTime(0, 0, 0);
114
115
        return $startOfWeek->format(\DateTime::ISO8601);
116
    }
117
118
    /**
119
     * Gets the first day of the month for the specified date with the hour 00:00:00
@@ 126-141 (lines=16) @@
123
     * @return string
124
     * @throws \Exception
125
     */
126
    public function startOfMonth($date = null)
127
    {
128
        $now = clone $this->dateTimeProvider->get();
129
130
        if ($date) {
131
            $now = $this->modifyDate($now, $date);
132
        }
133
134
        $year = $now->format('Y');
135
        $month = $now->format('m');
136
137
        $startOfMonth = $now->setDate($year, $month, 1);
138
        $startOfMonth->setTime(0, 0, 0);
139
140
        return $startOfMonth->format(\DateTime::ISO8601);
141
    }
142
143
    /**
144
     * Gets the first day of the year for the specified date with the hour 00:00:00