| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function registerNew($email) |
||
| 19 | { |
||
| 20 | if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { |
||
| 21 | throw new \Exception('Email is not valid!', 400); |
||
| 22 | } |
||
| 23 | |||
| 24 | $current = $this->newsletterMapper->select(['email' => $email])->current(); |
||
| 25 | |||
| 26 | if (!$current) { |
||
| 27 | return $this->newsletterMapper->insert(['email' => $email]); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | } |
||
| 31 |