@@ 18-46 (lines=29) @@ | ||
15 | use hiqdev\php\billing\plan\PlanInterface; |
|
16 | use hiqdev\php\billing\plan\PlanRepositoryInterface; |
|
17 | ||
18 | class SimplePlanRepository implements PlanRepositoryInterface |
|
19 | { |
|
20 | protected $plan; |
|
21 | ||
22 | public function __construct(PlanInterface $plan) |
|
23 | { |
|
24 | $this->plan = $plan; |
|
25 | } |
|
26 | ||
27 | public function findByAction(ActionInterface $action) |
|
28 | { |
|
29 | return $this->plan; |
|
30 | } |
|
31 | ||
32 | public function findByOrder(OrderInterface $order) |
|
33 | { |
|
34 | $plans = []; |
|
35 | foreach (array_keys($order->getActions()) as $actionKey) { |
|
36 | $plans[$actionKey] = $this->plan; |
|
37 | } |
|
38 | ||
39 | return $plans; |
|
40 | } |
|
41 | ||
42 | public function findByIds(array $ids) |
|
43 | { |
|
44 | throw new \Exception('not implemented'); |
|
45 | } |
|
46 | } |
|
47 |
@@ 18-46 (lines=29) @@ | ||
15 | use hiqdev\php\billing\sale\SaleInterface; |
|
16 | use hiqdev\php\billing\sale\SaleRepositoryInterface; |
|
17 | ||
18 | class SimpleSaleRepository implements SaleRepositoryInterface |
|
19 | { |
|
20 | protected $sale; |
|
21 | ||
22 | public function __construct(SaleInterface $sale) |
|
23 | { |
|
24 | $this->sale = $sale; |
|
25 | } |
|
26 | ||
27 | public function findByAction(ActionInterface $action) |
|
28 | { |
|
29 | return $this->sale; |
|
30 | } |
|
31 | ||
32 | public function findByOrder(OrderInterface $order) |
|
33 | { |
|
34 | $sales = []; |
|
35 | foreach ($order->getActions() as $actionKey => $action) { |
|
36 | $sales[$actionKey] = $this->findByAction($action); |
|
37 | } |
|
38 | ||
39 | return $sales; |
|
40 | } |
|
41 | ||
42 | public function findByIds(array $ids) |
|
43 | { |
|
44 | throw new \Exception('not implemented'); |
|
45 | } |
|
46 | } |
|
47 |