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