| Conditions | 2 |
| Paths | 2 |
| Total Lines | 64 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 55 | public function initialize() |
||
| 56 | { |
||
| 57 | $this->setBlockType(self::BLOCK_TYPE); |
||
| 58 | $this->setSupportedRoutes( |
||
| 59 | array( |
||
| 60 | 'EventEspresso\core\domain\entities\route_match\specifications\admin\EspressoStandardPostTypeEditor', |
||
| 61 | 'EventEspresso\core\domain\entities\route_match\specifications\admin\WordPressPostTypeEditor', |
||
| 62 | 'EventEspresso\core\domain\entities\route_match\specifications\frontend\EspressoBlockRenderer', |
||
| 63 | 'EventEspresso\core\domain\entities\route_match\specifications\frontend\AnyFrontendRequest' |
||
| 64 | ) |
||
| 65 | ); |
||
| 66 | $EVT_ID = $this->request->getRequestParam('page') === 'espresso_events' |
||
| 67 | ? $this->request->getRequestParam('post', 0) |
||
| 68 | : 0; |
||
| 69 | $this->setAttributes( |
||
| 70 | array( |
||
| 71 | 'eventId' => array( |
||
| 72 | 'type' => 'number', |
||
| 73 | 'default' => $EVT_ID, |
||
| 74 | ), |
||
| 75 | 'datetimeId' => array( |
||
| 76 | 'type' => 'number', |
||
| 77 | 'default' => 0, |
||
| 78 | ), |
||
| 79 | 'ticketId' => array( |
||
| 80 | 'type' => 'number', |
||
| 81 | 'default' => 0, |
||
| 82 | ), |
||
| 83 | 'status' => array( |
||
| 84 | 'type' => 'string', |
||
| 85 | 'default' => EEM_Registration::status_id_approved, |
||
| 86 | ), |
||
| 87 | 'limit' => array( |
||
| 88 | 'type' => 'number', |
||
| 89 | 'default' => 10, |
||
| 90 | ), |
||
| 91 | 'order' => array( |
||
| 92 | 'type' => 'string', |
||
| 93 | 'default' => 'ASC' |
||
| 94 | ), |
||
| 95 | 'orderBy' => array( |
||
| 96 | 'type' => 'string', |
||
| 97 | 'default' => 'lastThenFirstName', |
||
| 98 | ), |
||
| 99 | 'showGravatar' => array( |
||
| 100 | 'type' => 'boolean', |
||
| 101 | 'default' => false, |
||
| 102 | ), |
||
| 103 | 'avatarClass' => array( |
||
| 104 | 'type' => 'string', |
||
| 105 | 'default' => 'contact', |
||
| 106 | ), |
||
| 107 | 'avatarSize' => array( |
||
| 108 | 'type' => 'number', |
||
| 109 | 'default' => 24, |
||
| 110 | ), |
||
| 111 | 'displayOnArchives' => array( |
||
| 112 | 'type' => 'boolean', |
||
| 113 | 'default' => false, |
||
| 114 | ), |
||
| 115 | ) |
||
| 116 | ); |
||
| 117 | $this->setDynamic(); |
||
| 118 | } |
||
| 119 | |||
| 193 |