@@ 74-80 (lines=7) @@ | ||
71 | throw new InvalidArgumentException("Subscription period unit should be '".self::UNIT_DAILY."' (daily), '".self::UNIT_WEEKLY."' (weekly) or '".self::UNIT_MONTHLY."' (monthly)"); |
|
72 | } |
|
73 | ||
74 | if (self::UNIT_WEEKLY === $unit) { |
|
75 | if ($this->moment > 7) { |
|
76 | throw new InvalidArgumentException('The unit cannot be set to weekly while the moment > 7'); |
|
77 | } |
|
78 | } elseif (self::UNIT_MONTHLY === $unit && $this->moment > 28) { |
|
79 | throw new InvalidArgumentException('The unit cannot be set to monthly while the moment > 28'); |
|
80 | } |
|
81 | $this->unit = $unit; |
|
82 | } |
|
83 | ||
@@ 134-142 (lines=9) @@ | ||
131 | throw new InvalidArgumentException("Interval is too high"); |
|
132 | } |
|
133 | ||
134 | if (self::UNIT_WEEKLY == $this->unit) { |
|
135 | // Valid values are 1 to 7 |
|
136 | if ($moment > 7) { |
|
137 | throw new InvalidArgumentException("Moment should be 1 (Sunday), 2, 3 .. 7 (Saturday)"); |
|
138 | } |
|
139 | } elseif (self::UNIT_MONTHLY == $this->unit && $moment > 28) { |
|
140 | // We will not allow a day of month > 28 |
|
141 | throw new InvalidArgumentException("Moment can't be larger than 29. Last day for month allowed is 28."); |
|
142 | } |
|
143 | ||
144 | $this->moment = $moment; |
|
145 | } |