Total Complexity | 4 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | abstract class AbstractSubscriptionStrategy implements SubscriptionStrategyInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | private $subscriptionClass; |
||
13 | |||
14 | /** |
||
15 | * @var AbstractProductStrategy |
||
16 | */ |
||
17 | private $productStrategy; |
||
18 | |||
19 | /** |
||
20 | * Constructor. |
||
21 | * |
||
22 | * @param string $subscriptionClass |
||
23 | * @param AbstractProductStrategy $productStrategy |
||
24 | */ |
||
25 | 21 | public function __construct($subscriptionClass, AbstractProductStrategy $productStrategy) |
|
26 | { |
||
27 | 21 | $this->subscriptionClass = $subscriptionClass; |
|
28 | 21 | $this->productStrategy = $productStrategy; |
|
29 | 21 | } |
|
30 | |||
31 | /** |
||
32 | * @return SubscriptionInterface |
||
33 | */ |
||
34 | 8 | public function createSubscriptionInstance() |
|
35 | { |
||
36 | 8 | return new $this->subscriptionClass(); |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return AbstractProductStrategy |
||
41 | */ |
||
42 | 7 | public function getProductStrategy() |
|
45 | } |
||
46 | |||
47 | /** |
||
48 | * Create current date. |
||
49 | * |
||
50 | * @return \DateTimeImmutable |
||
51 | */ |
||
52 | 5 | protected function createCurrentDate() |
|
57 |