Conditions | 1 |
Paths | 1 |
Total Lines | 73 |
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 |
||
79 | public function getSubClient( string $type, ?string $name = null ) : \Aimeos\Admin\JQAdm\Iface |
||
80 | { |
||
81 | /** admin/jqadm/dashboard/order/counthour/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/order/counthour/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 2018.01 |
||
101 | * @see admin/jqadm/common/decorators/default |
||
102 | * @see admin/jqadm/dashboard/order/counthour/decorators/global |
||
103 | * @see admin/jqadm/dashboard/order/counthour/decorators/local |
||
104 | */ |
||
105 | |||
106 | /** admin/jqadm/dashboard/order/counthour/decorators/global |
||
107 | * Adds a list of globally available decorators only to the dashboard JQAdm client |
||
108 | * |
||
109 | * Decorators extend the functionality of a class by adding new aspects |
||
110 | * (e.g. log what is currently done), executing the methods of the underlying |
||
111 | * class only in certain conditions (e.g. only for logged in users) or |
||
112 | * modify what is returned to the caller. |
||
113 | * |
||
114 | * This option allows you to wrap global decorators |
||
115 | * ("\Aimeos\Admin\JQAdm\Common\Decorator\*") around the JQAdm client. |
||
116 | * |
||
117 | * admin/jqadm/dashboard/order/counthour/decorators/global = array( 'decorator1' ) |
||
118 | * |
||
119 | * This would add the decorator named "decorator1" defined by |
||
120 | * "\Aimeos\Admin\JQAdm\Common\Decorator\Decorator1" only to the JQAdm client. |
||
121 | * |
||
122 | * @param array List of decorator names |
||
123 | * @since 2018.01 |
||
124 | * @see admin/jqadm/common/decorators/default |
||
125 | * @see admin/jqadm/dashboard/order/counthour/decorators/excludes |
||
126 | * @see admin/jqadm/dashboard/order/counthour/decorators/local |
||
127 | */ |
||
128 | |||
129 | /** admin/jqadm/dashboard/order/counthour/decorators/local |
||
130 | * Adds a list of local decorators only to the dashboard JQAdm client |
||
131 | * |
||
132 | * Decorators extend the functionality of a class by adding new aspects |
||
133 | * (e.g. log what is currently done), executing the methods of the underlying |
||
134 | * class only in certain conditions (e.g. only for logged in users) or |
||
135 | * modify what is returned to the caller. |
||
136 | * |
||
137 | * This option allows you to wrap local decorators |
||
138 | * ("\Aimeos\Admin\JQAdm\Dashboard\Decorator\*") around the JQAdm client. |
||
139 | * |
||
140 | * admin/jqadm/dashboard/order/counthour/decorators/local = array( 'decorator2' ) |
||
141 | * |
||
142 | * This would add the decorator named "decorator2" defined by |
||
143 | * "\Aimeos\Admin\JQAdm\Dashboard\Decorator\Decorator2" only to the JQAdm client. |
||
144 | * |
||
145 | * @param array List of decorator names |
||
146 | * @since 2018.01 |
||
147 | * @see admin/jqadm/common/decorators/default |
||
148 | * @see admin/jqadm/dashboard/order/counthour/decorators/excludes |
||
149 | * @see admin/jqadm/dashboard/order/counthour/decorators/global |
||
150 | */ |
||
151 | return $this->createSubClient( 'dashboard/order/counthour/' . $type, $name ); |
||
152 | } |
||
197 |