| Conditions | 11 | 
| Paths | 18 | 
| Total Lines | 32 | 
| Code Lines | 20 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 28 | public function process(NoticesContainerInterface $notices)  | 
            ||
| 29 |     { | 
            ||
| 30 |         if ($notices->hasAttention()) { | 
            ||
| 31 |             foreach ($notices->getAttention() as $notice) { | 
            ||
| 32 | new AdminNotice($notice);  | 
            ||
| 33 | }  | 
            ||
| 34 | }  | 
            ||
| 35 |         if ($notices->hasError()) { | 
            ||
| 36 |             $error_string = esc_html__('The following errors occurred:', 'event_espresso'); | 
            ||
| 37 |             foreach ($notices->getError() as $notice) { | 
            ||
| 38 |                 if ($this->getThrowExceptions()) { | 
            ||
| 39 | $error_string .= '<br />' . $notice->message();  | 
            ||
| 40 |                 } else { | 
            ||
| 41 | new AdminNotice($notice);  | 
            ||
| 42 | }  | 
            ||
| 43 | }  | 
            ||
| 44 |             if ($this->getThrowExceptions()) { | 
            ||
| 45 | throw new DomainException($error_string);  | 
            ||
| 46 | }  | 
            ||
| 47 | }  | 
            ||
| 48 |         if ($notices->hasSuccess()) { | 
            ||
| 49 |             foreach ($notices->getSuccess() as $notice) { | 
            ||
| 50 | new AdminNotice($notice);  | 
            ||
| 51 | }  | 
            ||
| 52 | }  | 
            ||
| 53 |         if ($notices->hasInformation()) { | 
            ||
| 54 |             foreach ($notices->getInformation() as $notice) { | 
            ||
| 55 | new AdminNotice($notice);  | 
            ||
| 56 | }  | 
            ||
| 57 | }  | 
            ||
| 58 | $this->clearNotices();  | 
            ||
| 59 | }  | 
            ||
| 60 | |||
| 63 |