| Total Complexity | 10 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class NewsletterListCollection extends Collection |
||
| 9 | { |
||
| 10 | /** @var string */ |
||
| 11 | public $defaultList = ''; |
||
| 12 | |||
| 13 | public static function createFromConfig(array $config): self |
||
| 29 | } |
||
| 30 | |||
| 31 | public function findByName(string $name): NewsletterList |
||
| 32 | { |
||
| 33 | if ($name === '') { |
||
| 34 | return $this->getDefault(); |
||
| 35 | } |
||
| 36 | |||
| 37 | foreach ($this->items as $newsletterList) { |
||
| 38 | if ($newsletterList->getName() === $name) { |
||
| 39 | return $newsletterList; |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | throw InvalidNewsletterList::noListWithName($name); |
||
| 44 | } |
||
| 45 | |||
| 46 | public function getDefault(): NewsletterList |
||
| 55 | } |
||
| 56 | } |
||
| 57 |