| Conditions | 1 |
| Paths | 1 |
| Total Lines | 77 |
| Code Lines | 1 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 80 | public function getSubClient( string $type, string $name = null ) : \Aimeos\Client\Html\Iface |
||
| 81 | { |
||
| 82 | /** client/html/cms/page/contact/decorators/excludes |
||
| 83 | * Excludes decorators added by the "common" option from the cms page contact html client |
||
| 84 | * |
||
| 85 | * Decorators extend the functionality of a class by adding new aspects |
||
| 86 | * (e.g. log what is currently done), executing the methods of the underlying |
||
| 87 | * class only in certain conditions (e.g. only for logged in users) or |
||
| 88 | * modify what is returned to the caller. |
||
| 89 | * |
||
| 90 | * This option allows you to remove a decorator added via |
||
| 91 | * "client/html/common/decorators/default" before they are wrapped |
||
| 92 | * around the html client. |
||
| 93 | * |
||
| 94 | * client/html/cms/page/contact/decorators/excludes = array( 'decorator1' ) |
||
| 95 | * |
||
| 96 | * This would remove the decorator named "decorator1" from the list of |
||
| 97 | * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
||
| 98 | * "client/html/common/decorators/default" to the html client. |
||
| 99 | * |
||
| 100 | * @param array List of decorator names |
||
| 101 | * @since 2021.04 |
||
| 102 | * @category Developer |
||
| 103 | * @see client/html/common/decorators/default |
||
| 104 | * @see client/html/cms/page/contact/decorators/global |
||
| 105 | * @see client/html/cms/page/contact/decorators/local |
||
| 106 | */ |
||
| 107 | |||
| 108 | /** client/html/cms/page/contact/decorators/global |
||
| 109 | * Adds a list of globally available decorators only to the cms page contact html client |
||
| 110 | * |
||
| 111 | * Decorators extend the functionality of a class by adding new aspects |
||
| 112 | * (e.g. log what is currently done), executing the methods of the underlying |
||
| 113 | * class only in certain conditions (e.g. only for logged in users) or |
||
| 114 | * modify what is returned to the caller. |
||
| 115 | * |
||
| 116 | * This option allows you to wrap global decorators |
||
| 117 | * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
||
| 118 | * |
||
| 119 | * client/html/cms/page/contact/decorators/global = array( 'decorator1' ) |
||
| 120 | * |
||
| 121 | * This would add the decorator named "decorator1" defined by |
||
| 122 | * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
||
| 123 | * |
||
| 124 | * @param array List of decorator names |
||
| 125 | * @since 2021.04 |
||
| 126 | * @category Developer |
||
| 127 | * @see client/html/common/decorators/default |
||
| 128 | * @see client/html/cms/page/contact/decorators/excludes |
||
| 129 | * @see client/html/cms/page/contact/decorators/local |
||
| 130 | */ |
||
| 131 | |||
| 132 | /** client/html/cms/page/contact/decorators/local |
||
| 133 | * Adds a list of local decorators only to the cms page contact html client |
||
| 134 | * |
||
| 135 | * Decorators extend the functionality of a class by adding new aspects |
||
| 136 | * (e.g. log what is currently done), executing the methods of the underlying |
||
| 137 | * class only in certain conditions (e.g. only for logged in users) or |
||
| 138 | * modify what is returned to the caller. |
||
| 139 | * |
||
| 140 | * This option allows you to wrap local decorators |
||
| 141 | * ("\Aimeos\Client\Html\Cms\Decorator\*") around the html client. |
||
| 142 | * |
||
| 143 | * client/html/cms/page/contact/decorators/local = array( 'decorator2' ) |
||
| 144 | * |
||
| 145 | * This would add the decorator named "decorator2" defined by |
||
| 146 | * "\Aimeos\Client\Html\Cms\Decorator\Decorator2" only to the html client. |
||
| 147 | * |
||
| 148 | * @param array List of decorator names |
||
| 149 | * @since 2021.04 |
||
| 150 | * @category Developer |
||
| 151 | * @see client/html/common/decorators/default |
||
| 152 | * @see client/html/cms/page/contact/decorators/excludes |
||
| 153 | * @see client/html/cms/page/contact/decorators/global |
||
| 154 | */ |
||
| 155 | |||
| 156 | return $this->createSubClient( 'cms/page/contact/' . $type, $name ); |
||
| 157 | } |
||
| 230 |