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