| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | public function onBeforeWrite() |
||
| 14 | { |
||
| 15 | parent::onBeforeWrite(); |
||
| 16 | if ($this->owner->IsSecurityRisk) { |
||
| 17 | $this->owner->IsWhitelisted = false; |
||
| 18 | $securityCheck = EcommerceSecurityEmail::get()->filter(['Title' => $this->owner->Email])->first(); |
||
| 19 | if ($securityCheck) { |
||
| 20 | $securityCheck->Status = 'Bad'; |
||
| 21 | } else { |
||
| 22 | $securityCheck = EcommerceSecurityEmail::create(); |
||
| 23 | $securityCheck->Title = $this->owner->Email; |
||
| 24 | $securityCheck->Status = 'Bad'; |
||
| 25 | } |
||
| 26 | $securityCheck->write(); |
||
| 27 | } |
||
| 28 | } |
||
| 29 | } |
||
| 30 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.