Total Complexity | 4 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | final class AffiliateFactory implements AffiliateFactoryInterface |
||
12 | { |
||
13 | private FactoryInterface $decoratedFactory; |
||
14 | |||
15 | public function __construct(FactoryInterface $decoratedFactory) |
||
18 | } |
||
19 | |||
20 | public function createNew(): object |
||
21 | { |
||
22 | return $this->decoratedFactory->createNew(); |
||
23 | } |
||
24 | |||
25 | public function createForCustomer(CustomerInterface $customer): AffiliateInterface |
||
26 | { |
||
27 | /** @var AffiliateInterface $affiliate */ |
||
28 | $affiliate = $this->decoratedFactory->createNew(); |
||
29 | $affiliate->setCustomer($customer); |
||
30 | $affiliate->setTokenValue($this->generateTokenValue()); |
||
31 | |||
32 | return $affiliate; |
||
33 | } |
||
34 | |||
35 | private function generateTokenValue(): string |
||
38 | } |
||
39 | } |
||
40 |