Code Duplication    Length = 8-19 lines in 3 locations

src/date/SimpleTimeZone.class.php 2 locations

@@ 798-812 (lines=15) @@
795
     * @author     The ICU Project
796
     * @since      0.11.0
797
     */
798
    public function getOffsetIIIIII($era, $year, $month, $day, $dayOfWeek, $millis)
799
    {
800
        // Check the month before calling Grego::monthLength(). This
801
        // duplicates the test that occurs in the 7-argument getOffset(),
802
        // however, this is unavoidable. We don't mind because this method, in
803
        // fact, should not be called; internal code should always call the
804
        // 7-argument getOffset(), and outside code should use Calendar.get(int
805
        // field) with fields ZONE_OFFSET and DST_OFFSET. We can't get rid of
806
        // this method because it's public API. - liu 8/10/98
807
        if ($month < DateDefinitions::JANUARY || $month > DateDefinitions::DECEMBER) {
808
            throw new \InvalidArgumentException('Month out of range');
809
        }
810
811
        return $this->getOffsetIIIIIII($era, $year, $month, $day, $dayOfWeek, $millis, CalendarGrego::monthLength($year, $month));
812
    }
813
814
    /**
815
     * Gets the time zone offset, for current date, modified in case of
@@ 833-851 (lines=19) @@
830
     * @author     The ICU Project
831
     * @since      0.11.0
832
     */
833
    public function getOffsetIIIIIII($era, $year, $month, $day, $dayOfWeek, $millis, $monthLength)
834
    {
835
        // Check the month before calling Grego::monthLength(). This
836
        // duplicates a test that occurs in the 9-argument getOffset(),
837
        // however, this is unavoidable. We don't mind because this method, in
838
        // fact, should not be called; internal code should always call the
839
        // 9-argument getOffset(), and outside code should use Calendar.get(int
840
        // field) with fields ZONE_OFFSET and DST_OFFSET. We can't get rid of
841
        // this method because it's public API. - liu 8/10/98
842
        if ($month < DateDefinitions::JANUARY || $month > DateDefinitions::DECEMBER) {
843
            throw new \InvalidArgumentException('Month out of range');
844
        }
845
846
        // We ignore monthLength because it can be derived from year and month.
847
        // This is so that February in leap years is calculated correctly.
848
        // We keep this argument in this function for backwards compatibility.
849
        return $this->getOffsetIIIIIIII($era, $year, $month, $day, $dayOfWeek, $millis, CalendarGrego::monthLength($year, $month), CalendarGrego::previousMonthLength($year, $month));
850
    }
851
852
    /**
853
     * Gets the time zone offset, for current date, modified in case of
854
     * daylight savings. This is the offset to add *to* UTC to get local time.

src/date/OlsonTimeZone.class.php 1 location

@@ 228-235 (lines=8) @@
225
     * @author     The ICU Project
226
     * @since      0.11.0
227
     */
228
    protected function getOffsetIIIIII($era, $year, $month, $dom, $dow, $millis)
229
    {
230
        if ($month < DateDefinitions::JANUARY || $month > DateDefinitions::DECEMBER) {
231
            throw new \InvalidArgumentException('Month out of range');
232
        } else {
233
            return $this->getOffsetIIIIIII($era, $year, $month, $dom, $dow, $millis, CalendarGrego::monthLength($year, $month));
234
        }
235
    }
236
237
    /**
238
     * TimeZone API.