1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- declare(strict_types=0);
- namespace mcard;
- class period_card extends card
- {
- public function usable(): bool
- {
- $state = $this->state();
- if ($state === STATE_OVER) {
- return false;
- }
- elseif ($state === STATE_USING)
- {
- if ($this->end_time() < time()) {
- return false;
- } else {
- return true;
- }
- }
- else {
- return true;
- }
- }
- public function deduct(int $cent)
- {
- return [$cent, false];
- }
- public function calc(int $cent)
- {
- $price = round($cent * (1 - $this->discount()) / 100, 2);
- return [$cent, false,$price];
- }
- }
|