@@ -25,6 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Initializes the module. |
27 | 27 | * @param TXmlElement the configuration for the module |
28 | + * @return void |
|
28 | 29 | */ |
29 | 30 | public function init($config); |
30 | 31 | /** |
@@ -33,6 +34,7 @@ discard block |
||
33 | 34 | public function getID(); |
34 | 35 | /** |
35 | 36 | * @param string ID of the module |
37 | + * @return void |
|
36 | 38 | */ |
37 | 39 | public function setID($id); |
38 | 40 | } |
39 | 41 | \ No newline at end of file |
@@ -25,6 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Initializes the service. |
27 | 27 | * @param TXmlElement the configuration for the service |
28 | + * @return void |
|
28 | 29 | */ |
29 | 30 | public function init($config); |
30 | 31 | /** |
@@ -33,6 +34,7 @@ discard block |
||
33 | 34 | public function getID(); |
34 | 35 | /** |
35 | 36 | * @param string ID of the service |
37 | + * @return void |
|
36 | 38 | */ |
37 | 39 | public function setID($id); |
38 | 40 | /** |
@@ -41,10 +43,12 @@ discard block |
||
41 | 43 | public function getEnabled(); |
42 | 44 | /** |
43 | 45 | * @param boolean whether the service is enabled |
46 | + * @return void |
|
44 | 47 | */ |
45 | 48 | public function setEnabled($value); |
46 | 49 | /** |
47 | 50 | * Runs the service. |
51 | + * @return void |
|
48 | 52 | */ |
49 | 53 | public function run(); |
50 | 54 | } |
51 | 55 | \ No newline at end of file |
@@ -31,6 +31,7 @@ |
||
31 | 31 | /** |
32 | 32 | * Saves state into a persistent storage. |
33 | 33 | * @param mixed the state to be saved |
34 | + * @return void |
|
34 | 35 | */ |
35 | 36 | public function save($state); |
36 | 37 | } |
37 | 38 | \ No newline at end of file |
@@ -28,6 +28,7 @@ discard block |
||
28 | 28 | public function getName(); |
29 | 29 | /** |
30 | 30 | * @param string username |
31 | + * @return void |
|
31 | 32 | */ |
32 | 33 | public function setName($value); |
33 | 34 | /** |
@@ -36,6 +37,7 @@ discard block |
||
36 | 37 | public function getIsGuest(); |
37 | 38 | /** |
38 | 39 | * @param boolean if the user is a guest |
40 | + * @return void |
|
39 | 41 | */ |
40 | 42 | public function setIsGuest($value); |
41 | 43 | /** |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
168 | - * @return array list of IP rules. |
|
168 | + * @return string list of IP rules. |
|
169 | 169 | * @since 3.1.1 |
170 | 170 | */ |
171 | 171 | public function getIPRules() |
@@ -223,11 +223,17 @@ discard block |
||
223 | 223 | return 0; |
224 | 224 | } |
225 | 225 | |
226 | + /** |
|
227 | + * @param IUser $user |
|
228 | + */ |
|
226 | 229 | private function isUserMatched($user) |
227 | 230 | { |
228 | 231 | return ($this->_everyone || ($this->_guest && $user->getIsGuest()) || ($this->_authenticated && !$user->getIsGuest()) || in_array(strtolower($user->getName()),$this->_users)); |
229 | 232 | } |
230 | 233 | |
234 | + /** |
|
235 | + * @param IUser $user |
|
236 | + */ |
|
231 | 237 | private function isRoleMatched($user) |
232 | 238 | { |
233 | 239 | foreach($this->_roles as $role) |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | * @param string verb, can be empty, 'get', or 'post' |
75 | 75 | * @param string IP rules (separated by comma, can contain wild card *) |
76 | 76 | */ |
77 | - public function __construct($action,$users,$roles,$verb='',$ipRules='') |
|
77 | + public function __construct($action, $users, $roles, $verb='', $ipRules='') |
|
78 | 78 | { |
79 | 79 | $action=strtolower(trim($action)); |
80 | 80 | if($action==='allow' || $action==='deny') |
81 | 81 | $this->_action=$action; |
82 | 82 | else |
83 | - throw new TInvalidDataValueException('authorizationrule_action_invalid',$action); |
|
83 | + throw new TInvalidDataValueException('authorizationrule_action_invalid', $action); |
|
84 | 84 | $this->_users=array(); |
85 | 85 | $this->_roles=array(); |
86 | 86 | $this->_ipRules=array(); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | if(trim($users)==='') |
92 | 92 | $users='*'; |
93 | - foreach(explode(',',$users) as $user) |
|
93 | + foreach(explode(',', $users) as $user) |
|
94 | 94 | { |
95 | 95 | if(($user=trim(strtolower($user)))!=='') |
96 | 96 | { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | if(trim($roles)==='') |
112 | 112 | $roles='*'; |
113 | - foreach(explode(',',$roles) as $role) |
|
113 | + foreach(explode(',', $roles) as $role) |
|
114 | 114 | { |
115 | 115 | if(($role=trim(strtolower($role)))!=='') |
116 | 116 | $this->_roles[]=$role; |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | if($verb==='*' || $verb==='get' || $verb==='post') |
122 | 122 | $this->_verb=$verb; |
123 | 123 | else |
124 | - throw new TInvalidDataValueException('authorizationrule_verb_invalid',$verb); |
|
124 | + throw new TInvalidDataValueException('authorizationrule_verb_invalid', $verb); |
|
125 | 125 | |
126 | 126 | if(trim($ipRules)==='') |
127 | 127 | $ipRules='*'; |
128 | - foreach(explode(',',$ipRules) as $ipRule) |
|
128 | + foreach(explode(',', $ipRules) as $ipRule) |
|
129 | 129 | { |
130 | 130 | if(($ipRule=trim($ipRule))!=='') |
131 | 131 | $this->_ipRules[]=$ipRule; |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | * @param string the request IP address |
204 | 204 | * @return integer 1 if the user is allowed, -1 if the user is denied, 0 if the rule does not apply to the user |
205 | 205 | */ |
206 | - public function isUserAllowed(IUser $user,$verb,$ip) |
|
206 | + public function isUserAllowed(IUser $user, $verb, $ip) |
|
207 | 207 | { |
208 | 208 | if($this->isVerbMatched($verb) && $this->isIpMatched($ip) && $this->isUserMatched($user) && $this->isRoleMatched($user)) |
209 | - return ($this->_action==='allow')?1:-1; |
|
209 | + return ($this->_action==='allow') ? 1 : -1; |
|
210 | 210 | else |
211 | 211 | return 0; |
212 | 212 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | return 1; |
218 | 218 | foreach($this->_ipRules as $rule) |
219 | 219 | { |
220 | - if($rule==='*' || $rule===$ip || (($pos=strpos($rule,'*'))!==false && strncmp($ip,$rule,$pos)===0)) |
|
220 | + if($rule==='*' || $rule===$ip || (($pos=strpos($rule, '*'))!==false && strncmp($ip, $rule, $pos)===0)) |
|
221 | 221 | return 1; |
222 | 222 | } |
223 | 223 | return 0; |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | private function isUserMatched($user) |
227 | 227 | { |
228 | - return ($this->_everyone || ($this->_guest && $user->getIsGuest()) || ($this->_authenticated && !$user->getIsGuest()) || in_array(strtolower($user->getName()),$this->_users)); |
|
228 | + return ($this->_everyone || ($this->_guest && $user->getIsGuest()) || ($this->_authenticated && !$user->getIsGuest()) || in_array(strtolower($user->getName()), $this->_users)); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | private function isRoleMatched($user) |
@@ -240,6 +240,6 @@ discard block |
||
240 | 240 | |
241 | 241 | private function isVerbMatched($verb) |
242 | 242 | { |
243 | - return ($this->_verb==='*' || strcasecmp($verb,$this->_verb)===0); |
|
243 | + return ($this->_verb==='*' || strcasecmp($verb, $this->_verb)===0); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | \ No newline at end of file |
@@ -98,8 +98,7 @@ |
||
98 | 98 | { |
99 | 99 | $this->_everyone=true; |
100 | 100 | break; |
101 | - } |
|
102 | - else if($user==='?') |
|
101 | + } else if($user==='?') |
|
103 | 102 | $this->_guest=true; |
104 | 103 | else if($user==='@') |
105 | 104 | $this->_authenticated=true; |
@@ -61,6 +61,7 @@ |
||
61 | 61 | /** |
62 | 62 | * Parses the application configuration file. |
63 | 63 | * @param string configuration file name |
64 | + * @param string $fname |
|
64 | 65 | * @throws TConfigurationException if there is any parsing error |
65 | 66 | */ |
66 | 67 | public function loadFromFile($fname) |
@@ -69,8 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $fcontent = include $fname; |
71 | 71 | $this->loadFromPhp($fcontent,dirname($fname)); |
72 | - } |
|
73 | - else |
|
72 | + } else |
|
74 | 73 | { |
75 | 74 | $dom=new TXmlDocument; |
76 | 75 | $dom->loadFromFile($fname); |
@@ -217,8 +216,7 @@ discard block |
||
217 | 216 | if(isset($this->_aliases[$id])) |
218 | 217 | throw new TConfigurationException('appconfig_alias_redefined',$id); |
219 | 218 | $this->_aliases[$id]=$p; |
220 | - } |
|
221 | - else |
|
219 | + } else |
|
222 | 220 | throw new TConfigurationException('appconfig_alias_invalid'); |
223 | 221 | $this->_empty=false; |
224 | 222 | break; |
@@ -285,8 +283,7 @@ discard block |
||
285 | 283 | else |
286 | 284 | $this->_modules[$id]=array($type,$properties->toArray(),$element); |
287 | 285 | $this->_empty=false; |
288 | - } |
|
289 | - else |
|
286 | + } else |
|
290 | 287 | throw new TConfigurationException('appconfig_modules_invalid',$element->getTagName()); |
291 | 288 | } |
292 | 289 | } |
@@ -330,8 +327,7 @@ discard block |
||
330 | 327 | $element->setParent(null); |
331 | 328 | $this->_services[$id]=array($type,$properties->toArray(),$element); |
332 | 329 | $this->_empty=false; |
333 | - } |
|
334 | - else |
|
330 | + } else |
|
335 | 331 | throw new TConfigurationException('appconfig_services_invalid',$element->getTagName()); |
336 | 332 | } |
337 | 333 | } |
@@ -355,8 +351,7 @@ discard block |
||
355 | 351 | $properties['id'] = $id; |
356 | 352 | $this->_parameters[$id] = array($type,$properties); |
357 | 353 | } |
358 | - } |
|
359 | - else |
|
354 | + } else |
|
360 | 355 | { |
361 | 356 | $this->_parameters[$id] = $parameter; |
362 | 357 | } |
@@ -383,12 +378,10 @@ discard block |
||
383 | 378 | $this->_parameters[$id]=$element; |
384 | 379 | else |
385 | 380 | $this->_parameters[$id]=$value; |
386 | - } |
|
387 | - else |
|
381 | + } else |
|
388 | 382 | $this->_parameters[$id]=array($type,$properties->toArray()); |
389 | 383 | $this->_empty=false; |
390 | - } |
|
391 | - else |
|
384 | + } else |
|
392 | 385 | throw new TConfigurationException('appconfig_parameters_invalid',$element->getTagName()); |
393 | 386 | } |
394 | 387 | } |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | { |
68 | 68 | if(Prado::getApplication()->getConfigurationType()==TApplication::CONFIG_TYPE_PHP) |
69 | 69 | { |
70 | - $fcontent = include $fname; |
|
71 | - $this->loadFromPhp($fcontent,dirname($fname)); |
|
70 | + $fcontent=include $fname; |
|
71 | + $this->loadFromPhp($fcontent, dirname($fname)); |
|
72 | 72 | } |
73 | 73 | else |
74 | 74 | { |
75 | 75 | $dom=new TXmlDocument; |
76 | 76 | $dom->loadFromFile($fname); |
77 | - $this->loadFromXml($dom,dirname($fname)); |
|
77 | + $this->loadFromXml($dom, dirname($fname)); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -100,23 +100,23 @@ discard block |
||
100 | 100 | { |
101 | 101 | $this->_properties[$name]=$value; |
102 | 102 | } |
103 | - $this->_empty = false; |
|
103 | + $this->_empty=false; |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | if(isset($config['paths']) && is_array($config['paths'])) |
107 | - $this->loadPathsPhp($config['paths'],$configPath); |
|
107 | + $this->loadPathsPhp($config['paths'], $configPath); |
|
108 | 108 | |
109 | 109 | if(isset($config['modules']) && is_array($config['modules'])) |
110 | - $this->loadModulesPhp($config['modules'],$configPath); |
|
110 | + $this->loadModulesPhp($config['modules'], $configPath); |
|
111 | 111 | |
112 | 112 | if(isset($config['services']) && is_array($config['services'])) |
113 | - $this->loadServicesPhp($config['services'],$configPath); |
|
113 | + $this->loadServicesPhp($config['services'], $configPath); |
|
114 | 114 | |
115 | 115 | if(isset($config['parameters']) && is_array($config['parameters'])) |
116 | 116 | $this->loadParametersPhp($config['parameters'], $configPath); |
117 | 117 | |
118 | 118 | if(isset($config['includes']) && is_array($config['includes'])) |
119 | - $this->loadExternalXml($config['includes'],$configPath); |
|
119 | + $this->loadExternalXml($config['includes'], $configPath); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param TXmlElement the XML element |
125 | 125 | * @param string the context path (for specifying relative paths) |
126 | 126 | */ |
127 | - public function loadFromXml($dom,$configPath) |
|
127 | + public function loadFromXml($dom, $configPath) |
|
128 | 128 | { |
129 | 129 | // application properties |
130 | 130 | foreach($dom->getAttributes() as $name=>$value) |
@@ -138,19 +138,19 @@ discard block |
||
138 | 138 | switch($element->getTagName()) |
139 | 139 | { |
140 | 140 | case 'paths': |
141 | - $this->loadPathsXml($element,$configPath); |
|
141 | + $this->loadPathsXml($element, $configPath); |
|
142 | 142 | break; |
143 | 143 | case 'modules': |
144 | - $this->loadModulesXml($element,$configPath); |
|
144 | + $this->loadModulesXml($element, $configPath); |
|
145 | 145 | break; |
146 | 146 | case 'services': |
147 | - $this->loadServicesXml($element,$configPath); |
|
147 | + $this->loadServicesXml($element, $configPath); |
|
148 | 148 | break; |
149 | 149 | case 'parameters': |
150 | - $this->loadParametersXml($element,$configPath); |
|
150 | + $this->loadParametersXml($element, $configPath); |
|
151 | 151 | break; |
152 | 152 | case 'include': |
153 | - $this->loadExternalXml($element,$configPath); |
|
153 | + $this->loadExternalXml($element, $configPath); |
|
154 | 154 | break; |
155 | 155 | default: |
156 | 156 | //throw new TConfigurationException('appconfig_tag_invalid',$element->getTagName()); |
@@ -170,15 +170,15 @@ discard block |
||
170 | 170 | { |
171 | 171 | foreach($pathsNode['aliases'] as $id=>$path) |
172 | 172 | { |
173 | - $path=str_replace('\\','/',$path); |
|
174 | - if(preg_match('/^\\/|.:\\/|.:\\\\/',$path)) // if absolute path |
|
173 | + $path=str_replace('\\', '/', $path); |
|
174 | + if(preg_match('/^\\/|.:\\/|.:\\\\/', $path)) // if absolute path |
|
175 | 175 | $p=realpath($path); |
176 | 176 | else |
177 | 177 | $p=realpath($configPath.DIRECTORY_SEPARATOR.$path); |
178 | 178 | if($p===false || !is_dir($p)) |
179 | - throw new TConfigurationException('appconfig_aliaspath_invalid',$id,$path); |
|
179 | + throw new TConfigurationException('appconfig_aliaspath_invalid', $id, $path); |
|
180 | 180 | if(isset($this->_aliases[$id])) |
181 | - throw new TConfigurationException('appconfig_alias_redefined',$id); |
|
181 | + throw new TConfigurationException('appconfig_alias_redefined', $id); |
|
182 | 182 | $this->_aliases[$id]=$p; |
183 | 183 | } |
184 | 184 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | { |
188 | 188 | foreach($pathsNode['using'] as $namespace) |
189 | 189 | { |
190 | - $this->_usings[] = $namespace; |
|
190 | + $this->_usings[]=$namespace; |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @param TXmlElement the paths XML node |
198 | 198 | * @param string the context path (for specifying relative paths) |
199 | 199 | */ |
200 | - protected function loadPathsXml($pathsNode,$configPath) |
|
200 | + protected function loadPathsXml($pathsNode, $configPath) |
|
201 | 201 | { |
202 | 202 | foreach($pathsNode->getElements() as $element) |
203 | 203 | { |
@@ -207,15 +207,15 @@ discard block |
||
207 | 207 | { |
208 | 208 | if(($id=$element->getAttribute('id'))!==null && ($path=$element->getAttribute('path'))!==null) |
209 | 209 | { |
210 | - $path=str_replace('\\','/',$path); |
|
211 | - if(preg_match('/^\\/|.:\\/|.:\\\\/',$path)) // if absolute path |
|
210 | + $path=str_replace('\\', '/', $path); |
|
211 | + if(preg_match('/^\\/|.:\\/|.:\\\\/', $path)) // if absolute path |
|
212 | 212 | $p=realpath($path); |
213 | 213 | else |
214 | 214 | $p=realpath($configPath.DIRECTORY_SEPARATOR.$path); |
215 | 215 | if($p===false || !is_dir($p)) |
216 | - throw new TConfigurationException('appconfig_aliaspath_invalid',$id,$path); |
|
216 | + throw new TConfigurationException('appconfig_aliaspath_invalid', $id, $path); |
|
217 | 217 | if(isset($this->_aliases[$id])) |
218 | - throw new TConfigurationException('appconfig_alias_redefined',$id); |
|
218 | + throw new TConfigurationException('appconfig_alias_redefined', $id); |
|
219 | 219 | $this->_aliases[$id]=$p; |
220 | 220 | } |
221 | 221 | else |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | break; |
234 | 234 | } |
235 | 235 | default: |
236 | - throw new TConfigurationException('appconfig_paths_invalid',$element->getTagName()); |
|
236 | + throw new TConfigurationException('appconfig_paths_invalid', $element->getTagName()); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | } |
@@ -248,17 +248,17 @@ discard block |
||
248 | 248 | foreach($modulesNode as $id=>$module) |
249 | 249 | { |
250 | 250 | if(!isset($module['class'])) |
251 | - throw new TConfigurationException('appconfig_moduletype_required',$id); |
|
252 | - $type = $module['class']; |
|
251 | + throw new TConfigurationException('appconfig_moduletype_required', $id); |
|
252 | + $type=$module['class']; |
|
253 | 253 | unset($module['class']); |
254 | - $properties = array(); |
|
254 | + $properties=array(); |
|
255 | 255 | if(isset($module['properties'])) |
256 | 256 | { |
257 | - $properties = $module['properties']; |
|
257 | + $properties=$module['properties']; |
|
258 | 258 | unset($module['properties']); |
259 | 259 | } |
260 | - $properties['id'] = $id; |
|
261 | - $this->_modules[$id]=array($type,$properties,$module); |
|
260 | + $properties['id']=$id; |
|
261 | + $this->_modules[$id]=array($type, $properties, $module); |
|
262 | 262 | $this->_empty=false; |
263 | 263 | } |
264 | 264 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * @param TXmlElement the modules XML node |
269 | 269 | * @param string the context path (for specifying relative paths) |
270 | 270 | */ |
271 | - protected function loadModulesXml($modulesNode,$configPath) |
|
271 | + protected function loadModulesXml($modulesNode, $configPath) |
|
272 | 272 | { |
273 | 273 | foreach($modulesNode->getElements() as $element) |
274 | 274 | { |
@@ -278,16 +278,16 @@ discard block |
||
278 | 278 | $id=$properties->itemAt('id'); |
279 | 279 | $type=$properties->remove('class'); |
280 | 280 | if($type===null) |
281 | - throw new TConfigurationException('appconfig_moduletype_required',$id); |
|
281 | + throw new TConfigurationException('appconfig_moduletype_required', $id); |
|
282 | 282 | $element->setParent(null); |
283 | 283 | if($id===null) |
284 | - $this->_modules[]=array($type,$properties->toArray(),$element); |
|
284 | + $this->_modules[]=array($type, $properties->toArray(), $element); |
|
285 | 285 | else |
286 | - $this->_modules[$id]=array($type,$properties->toArray(),$element); |
|
286 | + $this->_modules[$id]=array($type, $properties->toArray(), $element); |
|
287 | 287 | $this->_empty=false; |
288 | 288 | } |
289 | 289 | else |
290 | - throw new TConfigurationException('appconfig_modules_invalid',$element->getTagName()); |
|
290 | + throw new TConfigurationException('appconfig_modules_invalid', $element->getTagName()); |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
@@ -296,18 +296,18 @@ discard block |
||
296 | 296 | * @param array the services PHP array |
297 | 297 | * @param string the context path (for specifying relative paths) |
298 | 298 | */ |
299 | - protected function loadServicesPhp($servicesNode,$configPath) |
|
299 | + protected function loadServicesPhp($servicesNode, $configPath) |
|
300 | 300 | { |
301 | 301 | foreach($servicesNode as $id => $service) |
302 | 302 | { |
303 | 303 | if(!isset($service['class'])) |
304 | 304 | throw new TConfigurationException('appconfig_servicetype_required'); |
305 | - $type = $service['class']; |
|
306 | - $properties = isset($service['properties']) ? $service['properties'] : array(); |
|
305 | + $type=$service['class']; |
|
306 | + $properties=isset($service['properties']) ? $service['properties'] : array(); |
|
307 | 307 | unset($service['properties']); |
308 | - $properties['id'] = $id; |
|
309 | - $this->_services[$id] = array($type,$properties,$service); |
|
310 | - $this->_empty = false; |
|
308 | + $properties['id']=$id; |
|
309 | + $this->_services[$id]=array($type, $properties, $service); |
|
310 | + $this->_empty=false; |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @param TXmlElement the services XML node |
317 | 317 | * @param string the context path (for specifying relative paths) |
318 | 318 | */ |
319 | - protected function loadServicesXml($servicesNode,$configPath) |
|
319 | + protected function loadServicesXml($servicesNode, $configPath) |
|
320 | 320 | { |
321 | 321 | foreach($servicesNode->getElements() as $element) |
322 | 322 | { |
@@ -326,13 +326,13 @@ discard block |
||
326 | 326 | if(($id=$properties->itemAt('id'))===null) |
327 | 327 | throw new TConfigurationException('appconfig_serviceid_required'); |
328 | 328 | if(($type=$properties->remove('class'))===null) |
329 | - throw new TConfigurationException('appconfig_servicetype_required',$id); |
|
329 | + throw new TConfigurationException('appconfig_servicetype_required', $id); |
|
330 | 330 | $element->setParent(null); |
331 | - $this->_services[$id]=array($type,$properties->toArray(),$element); |
|
331 | + $this->_services[$id]=array($type, $properties->toArray(), $element); |
|
332 | 332 | $this->_empty=false; |
333 | 333 | } |
334 | 334 | else |
335 | - throw new TConfigurationException('appconfig_services_invalid',$element->getTagName()); |
|
335 | + throw new TConfigurationException('appconfig_services_invalid', $element->getTagName()); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * @param array the parameters PHP array |
342 | 342 | * @param string the context path (for specifying relative paths) |
343 | 343 | */ |
344 | - protected function loadParametersPhp($parametersNode,$configPath) |
|
344 | + protected function loadParametersPhp($parametersNode, $configPath) |
|
345 | 345 | { |
346 | 346 | foreach($parametersNode as $id => $parameter) |
347 | 347 | { |
@@ -349,16 +349,16 @@ discard block |
||
349 | 349 | { |
350 | 350 | if(isset($parameter['class'])) |
351 | 351 | { |
352 | - $type = $parameter['class']; |
|
352 | + $type=$parameter['class']; |
|
353 | 353 | unset($parameter['class']); |
354 | - $properties = isset($service['properties']) ? $service['properties'] : array(); |
|
355 | - $properties['id'] = $id; |
|
356 | - $this->_parameters[$id] = array($type,$properties); |
|
354 | + $properties=isset($service['properties']) ? $service['properties'] : array(); |
|
355 | + $properties['id']=$id; |
|
356 | + $this->_parameters[$id]=array($type, $properties); |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 | else |
360 | 360 | { |
361 | - $this->_parameters[$id] = $parameter; |
|
361 | + $this->_parameters[$id]=$parameter; |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * @param TXmlElement the parameters XML node |
369 | 369 | * @param string the context path (for specifying relative paths) |
370 | 370 | */ |
371 | - protected function loadParametersXml($parametersNode,$configPath) |
|
371 | + protected function loadParametersXml($parametersNode, $configPath) |
|
372 | 372 | { |
373 | 373 | foreach($parametersNode->getElements() as $element) |
374 | 374 | { |
@@ -385,11 +385,11 @@ discard block |
||
385 | 385 | $this->_parameters[$id]=$value; |
386 | 386 | } |
387 | 387 | else |
388 | - $this->_parameters[$id]=array($type,$properties->toArray()); |
|
388 | + $this->_parameters[$id]=array($type, $properties->toArray()); |
|
389 | 389 | $this->_empty=false; |
390 | 390 | } |
391 | 391 | else |
392 | - throw new TConfigurationException('appconfig_parameters_invalid',$element->getTagName()); |
|
392 | + throw new TConfigurationException('appconfig_parameters_invalid', $element->getTagName()); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
@@ -398,14 +398,14 @@ discard block |
||
398 | 398 | * @param array the application PHP array |
399 | 399 | * @param string the context path (for specifying relative paths) |
400 | 400 | */ |
401 | - protected function loadExternalPhp($includeNode,$configPath) |
|
401 | + protected function loadExternalPhp($includeNode, $configPath) |
|
402 | 402 | { |
403 | 403 | foreach($includeNode as $include) |
404 | 404 | { |
405 | - $when = isset($include['when'])?true:false; |
|
405 | + $when=isset($include['when']) ?true:false; |
|
406 | 406 | if(!isset($include['file'])) |
407 | 407 | throw new TConfigurationException('appconfig_includefile_required'); |
408 | - $filePath = $include['file']; |
|
408 | + $filePath=$include['file']; |
|
409 | 409 | if(isset($this->_includes[$filePath])) |
410 | 410 | $this->_includes[$filePath]='('.$this->_includes[$filePath].') || ('.$when.')'; |
411 | 411 | else |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | * @param TXmlElement the application DOM element |
420 | 420 | * @param string the context path (for specifying relative paths) |
421 | 421 | */ |
422 | - protected function loadExternalXml($includeNode,$configPath) |
|
422 | + protected function loadExternalXml($includeNode, $configPath) |
|
423 | 423 | { |
424 | 424 | if(($when=$includeNode->getAttribute('when'))===null) |
425 | 425 | $when=true; |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * </code> |
423 | 423 | * to be executed when listen is called. All attached behaviors are notified through dyListen. |
424 | 424 | * |
425 | - * @return numeric the number of global events that were registered to the global event registry |
|
425 | + * @return null|integer the number of global events that were registered to the global event registry |
|
426 | 426 | */ |
427 | 427 | public function listen() { |
428 | 428 | if($this->_listeningenabled) |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * </code> |
457 | 457 | * to be executed when listen is called. All attached behaviors are notified through dyUnlisten. |
458 | 458 | * |
459 | - * @return numeric the number of global events that were unregistered from the global event registry |
|
459 | + * @return null|integer the number of global events that were unregistered from the global event registry |
|
460 | 460 | */ |
461 | 461 | public function unlisten() { |
462 | 462 | if(!$this->_listeningenabled) |
@@ -793,6 +793,7 @@ discard block |
||
793 | 793 | * A property is defined if there is a getter or setter method |
794 | 794 | * defined in the class. Note, property names are case-insensitive. |
795 | 795 | * @param string the property name |
796 | + * @param string $name |
|
796 | 797 | * @return boolean whether the property is defined |
797 | 798 | */ |
798 | 799 | public function hasProperty($name) |
@@ -549,8 +549,7 @@ discard block |
||
549 | 549 | } |
550 | 550 | if($callchain->getCount()>0) |
551 | 551 | return call_user_func_array(array($callchain,'call'),$args); |
552 | - } |
|
553 | - else |
|
552 | + } else |
|
554 | 553 | { |
555 | 554 | foreach($this->_m->toArray() as $behavior) |
556 | 555 | { |
@@ -607,29 +606,25 @@ discard block |
||
607 | 606 | { |
608 | 607 | // getting a property |
609 | 608 | return $this->$getter(); |
610 | - } |
|
611 | - else if(method_exists($this,$jsgetter='getjs'.$name)) |
|
609 | + } else if(method_exists($this,$jsgetter='getjs'.$name)) |
|
612 | 610 | { |
613 | 611 | // getting a javascript property |
614 | 612 | return (string)$this->$jsgetter(); |
615 | - } |
|
616 | - else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name)) |
|
613 | + } else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name)) |
|
617 | 614 | { |
618 | 615 | // getting an event (handler list) |
619 | 616 | $name=strtolower($name); |
620 | 617 | if(!isset($this->_e[$name])) |
621 | 618 | $this->_e[$name]=new TPriorityList; |
622 | 619 | return $this->_e[$name]; |
623 | - } |
|
624 | - else if(strncasecmp($name,'fx',2)===0) |
|
620 | + } else if(strncasecmp($name,'fx',2)===0) |
|
625 | 621 | { |
626 | 622 | // getting a global event (handler list) |
627 | 623 | $name=strtolower($name); |
628 | 624 | if(!isset(self::$_ue[$name])) |
629 | 625 | self::$_ue[$name]=new TPriorityList; |
630 | 626 | return self::$_ue[$name]; |
631 | - } |
|
632 | - else if($this->_behaviorsenabled) |
|
627 | + } else if($this->_behaviorsenabled) |
|
633 | 628 | { |
634 | 629 | // getting a behavior property/event (handler list) |
635 | 630 | if(isset($this->_m[$name])) |
@@ -669,18 +664,15 @@ discard block |
||
669 | 664 | if(strncasecmp($name,'js',2)===0&&$value&&!($value instanceof TJavaScriptLiteral)) |
670 | 665 | $value = new TJavaScriptLiteral($value); |
671 | 666 | return $this->$setter($value); |
672 | - } |
|
673 | - else if(method_exists($this,$jssetter='setjs'.$name)) |
|
667 | + } else if(method_exists($this,$jssetter='setjs'.$name)) |
|
674 | 668 | { |
675 | 669 | if($value&&!($value instanceof TJavaScriptString)) |
676 | 670 | $value=new TJavaScriptString($value); |
677 | 671 | return $this->$jssetter($value); |
678 | - } |
|
679 | - else if((strncasecmp($name,'on',2)===0&&method_exists($this,$name))||strncasecmp($name,'fx',2)===0) |
|
672 | + } else if((strncasecmp($name,'on',2)===0&&method_exists($this,$name))||strncasecmp($name,'fx',2)===0) |
|
680 | 673 | { |
681 | 674 | return $this->attachEventHandler($name,$value); |
682 | - } |
|
683 | - else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled) |
|
675 | + } else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled) |
|
684 | 676 | { |
685 | 677 | $sets=0; |
686 | 678 | foreach($this->_m->toArray() as $behavior) |
@@ -698,8 +690,7 @@ discard block |
||
698 | 690 | if(method_exists($this,'get'.$name)||method_exists($this,'getjs'.$name)) |
699 | 691 | { |
700 | 692 | throw new TInvalidOperationException('component_property_readonly',get_class($this),$name); |
701 | - } |
|
702 | - else |
|
693 | + } else |
|
703 | 694 | { |
704 | 695 | throw new TInvalidOperationException('component_property_undefined',get_class($this),$name); |
705 | 696 | } |
@@ -727,13 +718,11 @@ discard block |
||
727 | 718 | { |
728 | 719 | $name=strtolower($name); |
729 | 720 | return isset($this->_e[$name])&&$this->_e[$name]->getCount(); |
730 | - } |
|
731 | - else if(strncasecmp($name,'fx',2)===0) |
|
721 | + } else if(strncasecmp($name,'fx',2)===0) |
|
732 | 722 | { |
733 | 723 | $name=strtolower($name); |
734 | 724 | return isset(self::$_ue[$name])&&self::$_ue[$name]->getCount(); |
735 | - } |
|
736 | - else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled) |
|
725 | + } else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled) |
|
737 | 726 | { |
738 | 727 | if(isset($this->_m[$name])) |
739 | 728 | return true; |
@@ -743,8 +732,7 @@ discard block |
||
743 | 732 | return isset($behavior->$name); |
744 | 733 | } |
745 | 734 | |
746 | - } |
|
747 | - else |
|
735 | + } else |
|
748 | 736 | return false; |
749 | 737 | } |
750 | 738 | |
@@ -958,15 +946,13 @@ discard block |
||
958 | 946 | if(!isset($this->_e[$name])) |
959 | 947 | $this->_e[$name]=new TPriorityList; |
960 | 948 | return $this->_e[$name]; |
961 | - } |
|
962 | - else if(strncasecmp($name,'fx',2)===0) |
|
949 | + } else if(strncasecmp($name,'fx',2)===0) |
|
963 | 950 | { |
964 | 951 | $name=strtolower($name); |
965 | 952 | if(!isset(self::$_ue[$name])) |
966 | 953 | self::$_ue[$name]=new TPriorityList; |
967 | 954 | return self::$_ue[$name]; |
968 | - } |
|
969 | - else if($this->_m!==null&&$this->_behaviorsenabled) |
|
955 | + } else if($this->_m!==null&&$this->_behaviorsenabled) |
|
970 | 956 | { |
971 | 957 | foreach($this->_m->toArray() as $behavior) |
972 | 958 | { |
@@ -1045,8 +1031,7 @@ discard block |
||
1045 | 1031 | { |
1046 | 1032 | $this->getEventHandlers($name)->remove($handler,$priority); |
1047 | 1033 | return true; |
1048 | - } |
|
1049 | - catch(\Exception $e) |
|
1034 | + } catch(\Exception $e) |
|
1050 | 1035 | { |
1051 | 1036 | } |
1052 | 1037 | } |
@@ -1169,14 +1154,11 @@ discard block |
||
1169 | 1154 | $response=$object->__dycall($name,array($sender,$param,$name)); |
1170 | 1155 | else |
1171 | 1156 | $response=$object->$method($sender,$param,$name); |
1172 | - } |
|
1173 | - else |
|
1157 | + } else |
|
1174 | 1158 | throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,$handler); |
1175 | - } |
|
1176 | - else |
|
1159 | + } else |
|
1177 | 1160 | $response=call_user_func($handler,$sender,$param,$name); |
1178 | - } |
|
1179 | - else if(is_callable($handler,true)) |
|
1161 | + } else if(is_callable($handler,true)) |
|
1180 | 1162 | { |
1181 | 1163 | list($object,$method)=$handler; |
1182 | 1164 | if(is_string($object)) |
@@ -1194,12 +1176,10 @@ discard block |
||
1194 | 1176 | $response=$object->__dycall($name,array($sender,$param,$name)); |
1195 | 1177 | else |
1196 | 1178 | $response=$object->$method($sender,$param,$name); |
1197 | - } |
|
1198 | - else |
|
1179 | + } else |
|
1199 | 1180 | throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,$handler[1]); |
1200 | 1181 | } |
1201 | - } |
|
1202 | - else |
|
1182 | + } else |
|
1203 | 1183 | throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,gettype($handler)); |
1204 | 1184 | |
1205 | 1185 | $this->dyIntraRaiseEventPostHandler($name,$sender,$param,$handler,$response); |
@@ -1216,8 +1196,7 @@ discard block |
||
1216 | 1196 | $param=$response; |
1217 | 1197 | |
1218 | 1198 | } |
1219 | - } |
|
1220 | - else if(strncasecmp($name,'on',2)===0&&!$this->hasEvent($name)) |
|
1199 | + } else if(strncasecmp($name,'on',2)===0&&!$this->hasEvent($name)) |
|
1221 | 1200 | throw new TInvalidOperationException('component_event_undefined',get_class($this),$name); |
1222 | 1201 | |
1223 | 1202 | if($responsetype&TEventResults::EVENT_RESULT_FILTER) |
@@ -1253,8 +1232,7 @@ discard block |
||
1253 | 1232 | if(eval("\$result=$expression;")===false) |
1254 | 1233 | throw new \Exception(''); |
1255 | 1234 | return $result; |
1256 | - } |
|
1257 | - catch(\Exception $e) |
|
1235 | + } catch(\Exception $e) |
|
1258 | 1236 | { |
1259 | 1237 | throw new TInvalidOperationException('component_expression_invalid',get_class($this),$expression,$e->getMessage()); |
1260 | 1238 | } |
@@ -1288,8 +1266,7 @@ discard block |
||
1288 | 1266 | $content=ob_get_contents(); |
1289 | 1267 | ob_end_clean(); |
1290 | 1268 | return $content; |
1291 | - } |
|
1292 | - catch(\Exception $e) |
|
1269 | + } catch(\Exception $e) |
|
1293 | 1270 | { |
1294 | 1271 | throw new TInvalidOperationException('component_statements_invalid',get_class($this),$statements,$e->getMessage()); |
1295 | 1272 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * that start with 'fx' are filtered in. |
390 | 390 | */ |
391 | 391 | private function filter_prado_fx($name) { |
392 | - return strncasecmp($name,'fx',2)===0; |
|
392 | + return strncasecmp($name, 'fx', 2)===0; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -399,13 +399,13 @@ discard block |
||
399 | 399 | * @param boolean optional should the names be all lowercase true/false |
400 | 400 | * @return array array of strings being the class hierarchy of $this. |
401 | 401 | */ |
402 | - public function getClassHierarchy($lowercase = false) |
|
402 | + public function getClassHierarchy($lowercase=false) |
|
403 | 403 | { |
404 | 404 | $class=get_class($this); |
405 | 405 | $classes=array($class); |
406 | - while($class=get_parent_class($class)){array_unshift($classes,$class);} |
|
406 | + while($class=get_parent_class($class)) {array_unshift($classes, $class); } |
|
407 | 407 | if($lowercase) |
408 | - return array_map('strtolower',$classes); |
|
408 | + return array_map('strtolower', $classes); |
|
409 | 409 | return $classes; |
410 | 410 | } |
411 | 411 | |
@@ -428,14 +428,14 @@ discard block |
||
428 | 428 | if($this->_listeningenabled) |
429 | 429 | return; |
430 | 430 | |
431 | - $fx=array_filter(get_class_methods($this),array($this,'filter_prado_fx')); |
|
431 | + $fx=array_filter(get_class_methods($this), array($this, 'filter_prado_fx')); |
|
432 | 432 | |
433 | 433 | foreach($fx as $func) |
434 | - $this->attachEventHandler($func,array($this,$func)); |
|
434 | + $this->attachEventHandler($func, array($this, $func)); |
|
435 | 435 | |
436 | - if(is_a($this,'Prado\\Util\\IDynamicMethods')) { |
|
437 | - $this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER,array($this,'__dycall')); |
|
438 | - array_push($fx,TComponent::GLOBAL_RAISE_EVENT_LISTENER); |
|
436 | + if(is_a($this, 'Prado\\Util\\IDynamicMethods')) { |
|
437 | + $this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, array($this, '__dycall')); |
|
438 | + array_push($fx, TComponent::GLOBAL_RAISE_EVENT_LISTENER); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | $this->_listeningenabled=true; |
@@ -462,14 +462,14 @@ discard block |
||
462 | 462 | if(!$this->_listeningenabled) |
463 | 463 | return; |
464 | 464 | |
465 | - $fx=array_filter(get_class_methods($this),array($this,'filter_prado_fx')); |
|
465 | + $fx=array_filter(get_class_methods($this), array($this, 'filter_prado_fx')); |
|
466 | 466 | |
467 | 467 | foreach($fx as $func) |
468 | - $this->detachEventHandler($func,array($this,$func)); |
|
468 | + $this->detachEventHandler($func, array($this, $func)); |
|
469 | 469 | |
470 | - if(is_a($this,'Prado\\Util\\IDynamicMethods')) { |
|
471 | - $this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER,array($this,'__dycall')); |
|
472 | - array_push($fx,TComponent::GLOBAL_RAISE_EVENT_LISTENER); |
|
470 | + if(is_a($this, 'Prado\\Util\\IDynamicMethods')) { |
|
471 | + $this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, array($this, '__dycall')); |
|
472 | + array_push($fx, TComponent::GLOBAL_RAISE_EVENT_LISTENER); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | $this->_listeningenabled=false; |
@@ -514,66 +514,66 @@ discard block |
||
514 | 514 | */ |
515 | 515 | public function __call($method, $args) |
516 | 516 | { |
517 | - $getset=substr($method,0,3); |
|
518 | - if(($getset=='get')||($getset=='set')) |
|
517 | + $getset=substr($method, 0, 3); |
|
518 | + if(($getset=='get') || ($getset=='set')) |
|
519 | 519 | { |
520 | - $propname=substr($method,3); |
|
520 | + $propname=substr($method, 3); |
|
521 | 521 | $jsmethod=$getset.'js'.$propname; |
522 | - if(method_exists($this,$jsmethod)) |
|
522 | + if(method_exists($this, $jsmethod)) |
|
523 | 523 | { |
524 | - if(count($args)>0) |
|
525 | - if($args[0]&&!($args[0] instanceof TJavaScriptString)) |
|
524 | + if(count($args) > 0) |
|
525 | + if($args[0] && !($args[0] instanceof TJavaScriptString)) |
|
526 | 526 | $args[0]=new TJavaScriptString($args[0]); |
527 | - return call_user_func_array(array($this,$jsmethod),$args); |
|
527 | + return call_user_func_array(array($this, $jsmethod), $args); |
|
528 | 528 | } |
529 | 529 | |
530 | - if (($getset=='set')&&method_exists($this,'getjs'.$propname)) |
|
531 | - throw new TInvalidOperationException('component_property_readonly',get_class($this),$method); |
|
530 | + if(($getset=='set') && method_exists($this, 'getjs'.$propname)) |
|
531 | + throw new TInvalidOperationException('component_property_readonly', get_class($this), $method); |
|
532 | 532 | } |
533 | 533 | |
534 | - if($this->_m!==null&&$this->_behaviorsenabled) |
|
534 | + if($this->_m!==null && $this->_behaviorsenabled) |
|
535 | 535 | { |
536 | - if(strncasecmp($method,'dy',2)===0) |
|
536 | + if(strncasecmp($method, 'dy', 2)===0) |
|
537 | 537 | { |
538 | 538 | $callchain=new TCallChain($method); |
539 | 539 | foreach($this->_m->toArray() as $behavior) |
540 | 540 | { |
541 | - if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&(method_exists($behavior,$method)||($behavior instanceof IDynamicMethods))) |
|
541 | + if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && (method_exists($behavior, $method) || ($behavior instanceof IDynamicMethods))) |
|
542 | 542 | { |
543 | 543 | $behavior_args=$args; |
544 | 544 | if($behavior instanceof IClassBehavior) |
545 | - array_unshift($behavior_args,$this); |
|
546 | - $callchain->addCall(array($behavior,$method),$behavior_args); |
|
545 | + array_unshift($behavior_args, $this); |
|
546 | + $callchain->addCall(array($behavior, $method), $behavior_args); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | } |
550 | - if($callchain->getCount()>0) |
|
551 | - return call_user_func_array(array($callchain,'call'),$args); |
|
550 | + if($callchain->getCount() > 0) |
|
551 | + return call_user_func_array(array($callchain, 'call'), $args); |
|
552 | 552 | } |
553 | 553 | else |
554 | 554 | { |
555 | 555 | foreach($this->_m->toArray() as $behavior) |
556 | 556 | { |
557 | - if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&method_exists($behavior,$method)) |
|
557 | + if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && method_exists($behavior, $method)) |
|
558 | 558 | { |
559 | 559 | if($behavior instanceof IClassBehavior) |
560 | - array_unshift($args,$this); |
|
561 | - return call_user_func_array(array($behavior,$method),$args); |
|
560 | + array_unshift($args, $this); |
|
561 | + return call_user_func_array(array($behavior, $method), $args); |
|
562 | 562 | } |
563 | 563 | } |
564 | 564 | } |
565 | 565 | } |
566 | 566 | |
567 | - if(strncasecmp($method,'dy',2)===0||strncasecmp($method,'fx',2)===0) |
|
567 | + if(strncasecmp($method, 'dy', 2)===0 || strncasecmp($method, 'fx', 2)===0) |
|
568 | 568 | { |
569 | 569 | if($this instanceof IDynamicMethods) |
570 | - return $this->__dycall($method,$args); |
|
571 | - return isset($args[0])?$args[0]:null; |
|
570 | + return $this->__dycall($method, $args); |
|
571 | + return isset($args[0]) ? $args[0] : null; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | // don't thrown an exception for __magicMethods() or any other weird methods natively implemented by php |
575 | - if (!method_exists($this, $method)) { |
|
576 | - throw new TApplicationException('component_method_undefined',get_class($this),$method); |
|
575 | + if(!method_exists($this, $method)) { |
|
576 | + throw new TApplicationException('component_method_undefined', get_class($this), $method); |
|
577 | 577 | } |
578 | 578 | } |
579 | 579 | |
@@ -603,17 +603,17 @@ discard block |
||
603 | 603 | */ |
604 | 604 | public function __get($name) |
605 | 605 | { |
606 | - if(method_exists($this,$getter='get'.$name)) |
|
606 | + if(method_exists($this, $getter='get'.$name)) |
|
607 | 607 | { |
608 | 608 | // getting a property |
609 | 609 | return $this->$getter(); |
610 | 610 | } |
611 | - else if(method_exists($this,$jsgetter='getjs'.$name)) |
|
611 | + else if(method_exists($this, $jsgetter='getjs'.$name)) |
|
612 | 612 | { |
613 | 613 | // getting a javascript property |
614 | - return (string)$this->$jsgetter(); |
|
614 | + return (string) $this->$jsgetter(); |
|
615 | 615 | } |
616 | - else if(strncasecmp($name,'on',2)===0 && method_exists($this,$name)) |
|
616 | + else if(strncasecmp($name, 'on', 2)===0 && method_exists($this, $name)) |
|
617 | 617 | { |
618 | 618 | // getting an event (handler list) |
619 | 619 | $name=strtolower($name); |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | $this->_e[$name]=new TPriorityList; |
622 | 622 | return $this->_e[$name]; |
623 | 623 | } |
624 | - else if(strncasecmp($name,'fx',2)===0) |
|
624 | + else if(strncasecmp($name, 'fx', 2)===0) |
|
625 | 625 | { |
626 | 626 | // getting a global event (handler list) |
627 | 627 | $name=strtolower($name); |
@@ -638,13 +638,13 @@ discard block |
||
638 | 638 | { |
639 | 639 | foreach($this->_m->toArray() as $behavior) |
640 | 640 | { |
641 | - if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&& |
|
642 | - (property_exists($behavior,$name)||$behavior->canGetProperty($name)||$behavior->hasEvent($name))) |
|
641 | + if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && |
|
642 | + (property_exists($behavior, $name) || $behavior->canGetProperty($name) || $behavior->hasEvent($name))) |
|
643 | 643 | return $behavior->$name; |
644 | 644 | } |
645 | 645 | } |
646 | 646 | } |
647 | - throw new TInvalidOperationException('component_property_undefined',get_class($this),$name); |
|
647 | + throw new TInvalidOperationException('component_property_undefined', get_class($this), $name); |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | /** |
@@ -662,31 +662,31 @@ discard block |
||
662 | 662 | * @param mixed the property value or event handler |
663 | 663 | * @throws TInvalidOperationException If the property is not defined or read-only. |
664 | 664 | */ |
665 | - public function __set($name,$value) |
|
665 | + public function __set($name, $value) |
|
666 | 666 | { |
667 | - if(method_exists($this,$setter='set'.$name)) |
|
667 | + if(method_exists($this, $setter='set'.$name)) |
|
668 | 668 | { |
669 | - if(strncasecmp($name,'js',2)===0&&$value&&!($value instanceof TJavaScriptLiteral)) |
|
670 | - $value = new TJavaScriptLiteral($value); |
|
669 | + if(strncasecmp($name, 'js', 2)===0 && $value && !($value instanceof TJavaScriptLiteral)) |
|
670 | + $value=new TJavaScriptLiteral($value); |
|
671 | 671 | return $this->$setter($value); |
672 | 672 | } |
673 | - else if(method_exists($this,$jssetter='setjs'.$name)) |
|
673 | + else if(method_exists($this, $jssetter='setjs'.$name)) |
|
674 | 674 | { |
675 | - if($value&&!($value instanceof TJavaScriptString)) |
|
675 | + if($value && !($value instanceof TJavaScriptString)) |
|
676 | 676 | $value=new TJavaScriptString($value); |
677 | 677 | return $this->$jssetter($value); |
678 | 678 | } |
679 | - else if((strncasecmp($name,'on',2)===0&&method_exists($this,$name))||strncasecmp($name,'fx',2)===0) |
|
679 | + else if((strncasecmp($name, 'on', 2)===0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2)===0) |
|
680 | 680 | { |
681 | - return $this->attachEventHandler($name,$value); |
|
681 | + return $this->attachEventHandler($name, $value); |
|
682 | 682 | } |
683 | - else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled) |
|
683 | + else if($this->_m!==null && $this->_m->getCount() > 0 && $this->_behaviorsenabled) |
|
684 | 684 | { |
685 | 685 | $sets=0; |
686 | 686 | foreach($this->_m->toArray() as $behavior) |
687 | 687 | { |
688 | - if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&& |
|
689 | - (property_exists($behavior,$name)||$behavior->canSetProperty($name)||$behavior->hasEvent($name))) { |
|
688 | + if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && |
|
689 | + (property_exists($behavior, $name) || $behavior->canSetProperty($name) || $behavior->hasEvent($name))) { |
|
690 | 690 | $behavior->$name=$value; |
691 | 691 | $sets++; |
692 | 692 | } |
@@ -695,13 +695,13 @@ discard block |
||
695 | 695 | |
696 | 696 | } |
697 | 697 | |
698 | - if(method_exists($this,'get'.$name)||method_exists($this,'getjs'.$name)) |
|
698 | + if(method_exists($this, 'get'.$name) || method_exists($this, 'getjs'.$name)) |
|
699 | 699 | { |
700 | - throw new TInvalidOperationException('component_property_readonly',get_class($this),$name); |
|
700 | + throw new TInvalidOperationException('component_property_readonly', get_class($this), $name); |
|
701 | 701 | } |
702 | 702 | else |
703 | 703 | { |
704 | - throw new TInvalidOperationException('component_property_undefined',get_class($this),$name); |
|
704 | + throw new TInvalidOperationException('component_property_undefined', get_class($this), $name); |
|
705 | 705 | } |
706 | 706 | } |
707 | 707 | |
@@ -719,27 +719,27 @@ discard block |
||
719 | 719 | */ |
720 | 720 | public function __isset($name) |
721 | 721 | { |
722 | - if(method_exists($this,$getter='get'.$name)) |
|
722 | + if(method_exists($this, $getter='get'.$name)) |
|
723 | 723 | return $this->$getter()!==null; |
724 | - else if(method_exists($this,$jsgetter='getjs'.$name)) |
|
724 | + else if(method_exists($this, $jsgetter='getjs'.$name)) |
|
725 | 725 | return $this->$jsgetter()!==null; |
726 | - else if(strncasecmp($name,'on',2)===0&&method_exists($this,$name)) |
|
726 | + else if(strncasecmp($name, 'on', 2)===0 && method_exists($this, $name)) |
|
727 | 727 | { |
728 | 728 | $name=strtolower($name); |
729 | - return isset($this->_e[$name])&&$this->_e[$name]->getCount(); |
|
729 | + return isset($this->_e[$name]) && $this->_e[$name]->getCount(); |
|
730 | 730 | } |
731 | - else if(strncasecmp($name,'fx',2)===0) |
|
731 | + else if(strncasecmp($name, 'fx', 2)===0) |
|
732 | 732 | { |
733 | 733 | $name=strtolower($name); |
734 | - return isset(self::$_ue[$name])&&self::$_ue[$name]->getCount(); |
|
734 | + return isset(self::$_ue[$name]) && self::$_ue[$name]->getCount(); |
|
735 | 735 | } |
736 | - else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled) |
|
736 | + else if($this->_m!==null && $this->_m->getCount() > 0 && $this->_behaviorsenabled) |
|
737 | 737 | { |
738 | 738 | if(isset($this->_m[$name])) |
739 | 739 | return true; |
740 | 740 | foreach($this->_m->toArray() as $behavior) |
741 | 741 | { |
742 | - if((!($behavior instanceof IBehavior)||$behavior->getEnabled())) |
|
742 | + if((!($behavior instanceof IBehavior) || $behavior->getEnabled())) |
|
743 | 743 | return isset($behavior->$name); |
744 | 744 | } |
745 | 745 | |
@@ -760,15 +760,15 @@ discard block |
||
760 | 760 | */ |
761 | 761 | public function __unset($name) |
762 | 762 | { |
763 | - if(method_exists($this,$setter='set'.$name)) |
|
763 | + if(method_exists($this, $setter='set'.$name)) |
|
764 | 764 | $this->$setter(null); |
765 | - else if(method_exists($this,$jssetter='setjs'.$name)) |
|
765 | + else if(method_exists($this, $jssetter='setjs'.$name)) |
|
766 | 766 | $this->$jssetter(null); |
767 | - else if(strncasecmp($name,'on',2)===0&&method_exists($this,$name)) |
|
767 | + else if(strncasecmp($name, 'on', 2)===0 && method_exists($this, $name)) |
|
768 | 768 | $this->_e[strtolower($name)]->clear(); |
769 | - else if(strncasecmp($name,'fx',2)===0) |
|
769 | + else if(strncasecmp($name, 'fx', 2)===0) |
|
770 | 770 | $this->getEventHandlers($name)->remove(array($this, $name)); |
771 | - else if($this->_m!==null&&$this->_m->getCount()>0&&$this->_behaviorsenabled) |
|
771 | + else if($this->_m!==null && $this->_m->getCount() > 0 && $this->_behaviorsenabled) |
|
772 | 772 | { |
773 | 773 | if(isset($this->_m[$name])) |
774 | 774 | $this->detachBehavior($name); |
@@ -776,16 +776,16 @@ discard block |
||
776 | 776 | $unset=0; |
777 | 777 | foreach($this->_m->toArray() as $behavior) |
778 | 778 | { |
779 | - if((!($behavior instanceof IBehavior)||$behavior->getEnabled())) { |
|
779 | + if((!($behavior instanceof IBehavior) || $behavior->getEnabled())) { |
|
780 | 780 | unset($behavior->$name); |
781 | 781 | $unset++; |
782 | 782 | } |
783 | 783 | } |
784 | - if(!$unset&&method_exists($this,'get'.$name)) |
|
785 | - throw new TInvalidOperationException('component_property_readonly',get_class($this),$name); |
|
784 | + if(!$unset && method_exists($this, 'get'.$name)) |
|
785 | + throw new TInvalidOperationException('component_property_readonly', get_class($this), $name); |
|
786 | 786 | } |
787 | - } else if(method_exists($this,'get'.$name)) |
|
788 | - throw new TInvalidOperationException('component_property_readonly',get_class($this),$name); |
|
787 | + } else if(method_exists($this, 'get'.$name)) |
|
788 | + throw new TInvalidOperationException('component_property_readonly', get_class($this), $name); |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | /** |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | */ |
798 | 798 | public function hasProperty($name) |
799 | 799 | { |
800 | - return $this->canGetProperty($name)||$this->canSetProperty($name); |
|
800 | + return $this->canGetProperty($name) || $this->canSetProperty($name); |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | /** |
@@ -811,13 +811,13 @@ discard block |
||
811 | 811 | */ |
812 | 812 | public function canGetProperty($name) |
813 | 813 | { |
814 | - if(method_exists($this,'get'.$name)||method_exists($this,'getjs'.$name)) |
|
814 | + if(method_exists($this, 'get'.$name) || method_exists($this, 'getjs'.$name)) |
|
815 | 815 | return true; |
816 | - else if($this->_m!==null&&$this->_behaviorsenabled) |
|
816 | + else if($this->_m!==null && $this->_behaviorsenabled) |
|
817 | 817 | { |
818 | 818 | foreach($this->_m->toArray() as $behavior) |
819 | 819 | { |
820 | - if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&$behavior->canGetProperty($name)) |
|
820 | + if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canGetProperty($name)) |
|
821 | 821 | return true; |
822 | 822 | } |
823 | 823 | } |
@@ -835,13 +835,13 @@ discard block |
||
835 | 835 | */ |
836 | 836 | public function canSetProperty($name) |
837 | 837 | { |
838 | - if(method_exists($this,'set'.$name)||method_exists($this,'setjs'.$name)) |
|
838 | + if(method_exists($this, 'set'.$name) || method_exists($this, 'setjs'.$name)) |
|
839 | 839 | return true; |
840 | - else if($this->_m!==null&&$this->_behaviorsenabled) |
|
840 | + else if($this->_m!==null && $this->_behaviorsenabled) |
|
841 | 841 | { |
842 | 842 | foreach($this->_m->toArray() as $behavior) |
843 | 843 | { |
844 | - if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&$behavior->canSetProperty($name)) |
|
844 | + if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->canSetProperty($name)) |
|
845 | 845 | return true; |
846 | 846 | } |
847 | 847 | } |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | public function getSubProperty($path) |
862 | 862 | { |
863 | 863 | $object=$this; |
864 | - foreach(explode('.',$path) as $property) |
|
864 | + foreach(explode('.', $path) as $property) |
|
865 | 865 | $object=$object->$property; |
866 | 866 | return $object; |
867 | 867 | } |
@@ -876,15 +876,15 @@ discard block |
||
876 | 876 | * @param string property path |
877 | 877 | * @param mixed the property path value |
878 | 878 | */ |
879 | - public function setSubProperty($path,$value) |
|
879 | + public function setSubProperty($path, $value) |
|
880 | 880 | { |
881 | 881 | $object=$this; |
882 | - if(($pos=strrpos($path,'.'))===false) |
|
882 | + if(($pos=strrpos($path, '.'))===false) |
|
883 | 883 | $property=$path; |
884 | 884 | else |
885 | 885 | { |
886 | - $object=$this->getSubProperty(substr($path,0,$pos)); |
|
887 | - $property=substr($path,$pos+1); |
|
886 | + $object=$this->getSubProperty(substr($path, 0, $pos)); |
|
887 | + $property=substr($path, $pos + 1); |
|
888 | 888 | } |
889 | 889 | $object->$property=$value; |
890 | 890 | } |
@@ -903,14 +903,14 @@ discard block |
||
903 | 903 | */ |
904 | 904 | public function hasEvent($name) |
905 | 905 | { |
906 | - if((strncasecmp($name,'on',2)===0&&method_exists($this,$name))||strncasecmp($name,'fx',2)===0||strncasecmp($name,'dy',2)===0) |
|
906 | + if((strncasecmp($name, 'on', 2)===0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2)===0 || strncasecmp($name, 'dy', 2)===0) |
|
907 | 907 | return true; |
908 | 908 | |
909 | - else if($this->_m!==null&&$this->_behaviorsenabled) |
|
909 | + else if($this->_m!==null && $this->_behaviorsenabled) |
|
910 | 910 | { |
911 | 911 | foreach($this->_m->toArray() as $behavior) |
912 | 912 | { |
913 | - if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&$behavior->hasEvent($name)) |
|
913 | + if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name)) |
|
914 | 914 | return true; |
915 | 915 | } |
916 | 916 | } |
@@ -927,16 +927,16 @@ discard block |
||
927 | 927 | public function hasEventHandler($name) |
928 | 928 | { |
929 | 929 | $name=strtolower($name); |
930 | - if(strncasecmp($name,'fx',2)===0) |
|
931 | - return isset(self::$_ue[$name])&&self::$_ue[$name]->getCount()>0; |
|
930 | + if(strncasecmp($name, 'fx', 2)===0) |
|
931 | + return isset(self::$_ue[$name]) && self::$_ue[$name]->getCount() > 0; |
|
932 | 932 | else |
933 | 933 | { |
934 | - if(isset($this->_e[$name])&&$this->_e[$name]->getCount()>0) |
|
934 | + if(isset($this->_e[$name]) && $this->_e[$name]->getCount() > 0) |
|
935 | 935 | return true; |
936 | - else if($this->_m!==null&&$this->_behaviorsenabled) { |
|
936 | + else if($this->_m!==null && $this->_behaviorsenabled) { |
|
937 | 937 | foreach($this->_m->toArray() as $behavior) |
938 | 938 | { |
939 | - if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&$behavior->hasEventHandler($name)) |
|
939 | + if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEventHandler($name)) |
|
940 | 940 | return true; |
941 | 941 | } |
942 | 942 | } |
@@ -952,29 +952,29 @@ discard block |
||
952 | 952 | */ |
953 | 953 | public function getEventHandlers($name) |
954 | 954 | { |
955 | - if(strncasecmp($name,'on',2)===0&&method_exists($this,$name)) |
|
955 | + if(strncasecmp($name, 'on', 2)===0 && method_exists($this, $name)) |
|
956 | 956 | { |
957 | 957 | $name=strtolower($name); |
958 | 958 | if(!isset($this->_e[$name])) |
959 | 959 | $this->_e[$name]=new TPriorityList; |
960 | 960 | return $this->_e[$name]; |
961 | 961 | } |
962 | - else if(strncasecmp($name,'fx',2)===0) |
|
962 | + else if(strncasecmp($name, 'fx', 2)===0) |
|
963 | 963 | { |
964 | 964 | $name=strtolower($name); |
965 | 965 | if(!isset(self::$_ue[$name])) |
966 | 966 | self::$_ue[$name]=new TPriorityList; |
967 | 967 | return self::$_ue[$name]; |
968 | 968 | } |
969 | - else if($this->_m!==null&&$this->_behaviorsenabled) |
|
969 | + else if($this->_m!==null && $this->_behaviorsenabled) |
|
970 | 970 | { |
971 | 971 | foreach($this->_m->toArray() as $behavior) |
972 | 972 | { |
973 | - if((!($behavior instanceof IBehavior)||$behavior->getEnabled())&&$behavior->hasEvent($name)) |
|
973 | + if((!($behavior instanceof IBehavior) || $behavior->getEnabled()) && $behavior->hasEvent($name)) |
|
974 | 974 | return $behavior->getEventHandlers($name); |
975 | 975 | } |
976 | 976 | } |
977 | - throw new TInvalidOperationException('component_event_undefined',get_class($this),$name); |
|
977 | + throw new TInvalidOperationException('component_event_undefined', get_class($this), $name); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | /** |
@@ -1022,9 +1022,9 @@ discard block |
||
1022 | 1022 | * default priority of 10.0 within {@link TPriorityList} |
1023 | 1023 | * @throws TInvalidOperationException if the event does not exist |
1024 | 1024 | */ |
1025 | - public function attachEventHandler($name,$handler,$priority=null) |
|
1025 | + public function attachEventHandler($name, $handler, $priority=null) |
|
1026 | 1026 | { |
1027 | - $this->getEventHandlers($name)->add($handler,$priority); |
|
1027 | + $this->getEventHandlers($name)->add($handler, $priority); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | /** |
@@ -1037,13 +1037,13 @@ discard block |
||
1037 | 1037 | * to an item of any priority within {@link TPriorityList}; null means the default priority |
1038 | 1038 | * @return boolean if the removal is successful |
1039 | 1039 | */ |
1040 | - public function detachEventHandler($name,$handler,$priority=false) |
|
1040 | + public function detachEventHandler($name, $handler, $priority=false) |
|
1041 | 1041 | { |
1042 | 1042 | if($this->hasEventHandler($name)) |
1043 | 1043 | { |
1044 | 1044 | try |
1045 | 1045 | { |
1046 | - $this->getEventHandlers($name)->remove($handler,$priority); |
|
1046 | + $this->getEventHandlers($name)->remove($handler, $priority); |
|
1047 | 1047 | return true; |
1048 | 1048 | } |
1049 | 1049 | catch(\Exception $e) |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | * @throws TInvalidOperationException if the event is undefined |
1126 | 1126 | * @throws TInvalidDataValueException If an event handler is invalid |
1127 | 1127 | */ |
1128 | - public function raiseEvent($name,$sender,$param,$responsetype=null,$postfunction=null) |
|
1128 | + public function raiseEvent($name, $sender, $param, $responsetype=null, $postfunction=null) |
|
1129 | 1129 | { |
1130 | 1130 | $p=$param; |
1131 | 1131 | if(is_callable($responsetype)) |
@@ -1140,90 +1140,90 @@ discard block |
||
1140 | 1140 | $name=strtolower($name); |
1141 | 1141 | $responses=array(); |
1142 | 1142 | |
1143 | - $name=$this->dyPreRaiseEvent($name,$sender,$param,$responsetype,$postfunction); |
|
1143 | + $name=$this->dyPreRaiseEvent($name, $sender, $param, $responsetype, $postfunction); |
|
1144 | 1144 | |
1145 | - if($this->hasEventHandler($name)||$this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER)) |
|
1145 | + if($this->hasEventHandler($name) || $this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER)) |
|
1146 | 1146 | { |
1147 | 1147 | $handlers=$this->getEventHandlers($name); |
1148 | 1148 | $handlerArray=$handlers->toArray(); |
1149 | - if(strncasecmp($name,'fx',2)===0&&$this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER)) |
|
1149 | + if(strncasecmp($name, 'fx', 2)===0 && $this->hasEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER)) |
|
1150 | 1150 | { |
1151 | 1151 | $globalhandlers=$this->getEventHandlers(TComponent::GLOBAL_RAISE_EVENT_LISTENER); |
1152 | - $handlerArray=array_merge($globalhandlers->toArrayBelowPriority(0),$handlerArray,$globalhandlers->toArrayAbovePriority(0)); |
|
1152 | + $handlerArray=array_merge($globalhandlers->toArrayBelowPriority(0), $handlerArray, $globalhandlers->toArrayAbovePriority(0)); |
|
1153 | 1153 | } |
1154 | 1154 | $response=null; |
1155 | 1155 | foreach($handlerArray as $handler) |
1156 | 1156 | { |
1157 | - if($this->dyIntraRaiseEventTestHandler($handler,$sender,$param,$name)===false) |
|
1157 | + if($this->dyIntraRaiseEventTestHandler($handler, $sender, $param, $name)===false) |
|
1158 | 1158 | continue; |
1159 | 1159 | |
1160 | 1160 | if(is_string($handler)) |
1161 | 1161 | { |
1162 | - if(($pos=strrpos($handler,'.'))!==false) |
|
1162 | + if(($pos=strrpos($handler, '.'))!==false) |
|
1163 | 1163 | { |
1164 | - $object=$this->getSubProperty(substr($handler,0,$pos)); |
|
1165 | - $method=substr($handler,$pos+1); |
|
1166 | - if(method_exists($object,$method)||strncasecmp($method,'dy',2)===0||strncasecmp($method,'fx',2)===0) |
|
1164 | + $object=$this->getSubProperty(substr($handler, 0, $pos)); |
|
1165 | + $method=substr($handler, $pos + 1); |
|
1166 | + if(method_exists($object, $method) || strncasecmp($method, 'dy', 2)===0 || strncasecmp($method, 'fx', 2)===0) |
|
1167 | 1167 | { |
1168 | 1168 | if($method=='__dycall') |
1169 | - $response=$object->__dycall($name,array($sender,$param,$name)); |
|
1169 | + $response=$object->__dycall($name, array($sender, $param, $name)); |
|
1170 | 1170 | else |
1171 | - $response=$object->$method($sender,$param,$name); |
|
1171 | + $response=$object->$method($sender, $param, $name); |
|
1172 | 1172 | } |
1173 | 1173 | else |
1174 | - throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,$handler); |
|
1174 | + throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, $handler); |
|
1175 | 1175 | } |
1176 | 1176 | else |
1177 | - $response=call_user_func($handler,$sender,$param,$name); |
|
1177 | + $response=call_user_func($handler, $sender, $param, $name); |
|
1178 | 1178 | } |
1179 | - else if(is_callable($handler,true)) |
|
1179 | + else if(is_callable($handler, true)) |
|
1180 | 1180 | { |
1181 | - list($object,$method)=$handler; |
|
1181 | + list($object, $method)=$handler; |
|
1182 | 1182 | if(is_string($object)) |
1183 | - $response=call_user_func($handler,$sender,$param,$name); |
|
1183 | + $response=call_user_func($handler, $sender, $param, $name); |
|
1184 | 1184 | else |
1185 | 1185 | { |
1186 | - if(($pos=strrpos($method,'.'))!==false) |
|
1186 | + if(($pos=strrpos($method, '.'))!==false) |
|
1187 | 1187 | { |
1188 | - $object=$this->getSubProperty(substr($method,0,$pos)); |
|
1189 | - $method=substr($method,$pos+1); |
|
1188 | + $object=$this->getSubProperty(substr($method, 0, $pos)); |
|
1189 | + $method=substr($method, $pos + 1); |
|
1190 | 1190 | } |
1191 | - if(method_exists($object,$method)||strncasecmp($method,'dy',2)===0||strncasecmp($method,'fx',2)===0) |
|
1191 | + if(method_exists($object, $method) || strncasecmp($method, 'dy', 2)===0 || strncasecmp($method, 'fx', 2)===0) |
|
1192 | 1192 | { |
1193 | 1193 | if($method=='__dycall') |
1194 | - $response=$object->__dycall($name,array($sender,$param,$name)); |
|
1194 | + $response=$object->__dycall($name, array($sender, $param, $name)); |
|
1195 | 1195 | else |
1196 | - $response=$object->$method($sender,$param,$name); |
|
1196 | + $response=$object->$method($sender, $param, $name); |
|
1197 | 1197 | } |
1198 | 1198 | else |
1199 | - throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,$handler[1]); |
|
1199 | + throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, $handler[1]); |
|
1200 | 1200 | } |
1201 | 1201 | } |
1202 | 1202 | else |
1203 | - throw new TInvalidDataValueException('component_eventhandler_invalid',get_class($this),$name,gettype($handler)); |
|
1203 | + throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, gettype($handler)); |
|
1204 | 1204 | |
1205 | - $this->dyIntraRaiseEventPostHandler($name,$sender,$param,$handler,$response); |
|
1205 | + $this->dyIntraRaiseEventPostHandler($name, $sender, $param, $handler, $response); |
|
1206 | 1206 | |
1207 | 1207 | if($postfunction) |
1208 | - $response=call_user_func_array($postfunction,array($sender,$param,$this,$response)); |
|
1208 | + $response=call_user_func_array($postfunction, array($sender, $param, $this, $response)); |
|
1209 | 1209 | |
1210 | - if($responsetype&TEventResults::EVENT_RESULT_ALL) |
|
1211 | - $responses[]=array('sender'=>$sender,'param'=>$param,'response'=>$response); |
|
1210 | + if($responsetype & TEventResults::EVENT_RESULT_ALL) |
|
1211 | + $responses[]=array('sender'=>$sender, 'param'=>$param, 'response'=>$response); |
|
1212 | 1212 | else |
1213 | 1213 | $responses[]=$response; |
1214 | 1214 | |
1215 | - if($response!==null&&($responsetype&TEventResults::EVENT_RESULT_FEED_FORWARD)) |
|
1215 | + if($response!==null && ($responsetype & TEventResults::EVENT_RESULT_FEED_FORWARD)) |
|
1216 | 1216 | $param=$response; |
1217 | 1217 | |
1218 | 1218 | } |
1219 | 1219 | } |
1220 | - else if(strncasecmp($name,'on',2)===0&&!$this->hasEvent($name)) |
|
1221 | - throw new TInvalidOperationException('component_event_undefined',get_class($this),$name); |
|
1220 | + else if(strncasecmp($name, 'on', 2)===0 && !$this->hasEvent($name)) |
|
1221 | + throw new TInvalidOperationException('component_event_undefined', get_class($this), $name); |
|
1222 | 1222 | |
1223 | - if($responsetype&TEventResults::EVENT_RESULT_FILTER) |
|
1223 | + if($responsetype & TEventResults::EVENT_RESULT_FILTER) |
|
1224 | 1224 | $responses=array_filter($responses); |
1225 | 1225 | |
1226 | - $responses=$this->dyPostRaiseEvent($responses,$name,$sender,$param,$responsetype,$postfunction); |
|
1226 | + $responses=$this->dyPostRaiseEvent($responses, $name, $sender, $param, $responsetype, $postfunction); |
|
1227 | 1227 | |
1228 | 1228 | return $responses; |
1229 | 1229 | } |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | } |
1257 | 1257 | catch(\Exception $e) |
1258 | 1258 | { |
1259 | - throw new TInvalidOperationException('component_expression_invalid',get_class($this),$expression,$e->getMessage()); |
|
1259 | + throw new TInvalidOperationException('component_expression_invalid', get_class($this), $expression, $e->getMessage()); |
|
1260 | 1260 | } |
1261 | 1261 | } |
1262 | 1262 | |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | } |
1292 | 1292 | catch(\Exception $e) |
1293 | 1293 | { |
1294 | - throw new TInvalidOperationException('component_statements_invalid',get_class($this),$statements,$e->getMessage()); |
|
1294 | + throw new TInvalidOperationException('component_statements_invalid', get_class($this), $statements, $e->getMessage()); |
|
1295 | 1295 | } |
1296 | 1296 | } |
1297 | 1297 | |
@@ -1351,9 +1351,9 @@ discard block |
||
1351 | 1351 | * @param $param TClassBehaviorEventParameter |
1352 | 1352 | * @since 3.2.3 |
1353 | 1353 | */ |
1354 | - public function fxAttachClassBehavior($sender,$param) { |
|
1355 | - if(in_array($param->getClass(),$this->getClassHierarchy(true))) |
|
1356 | - return $this->attachBehavior($param->getName(),$param->getBehavior(),$param->getPriority()); |
|
1354 | + public function fxAttachClassBehavior($sender, $param) { |
|
1355 | + if(in_array($param->getClass(), $this->getClassHierarchy(true))) |
|
1356 | + return $this->attachBehavior($param->getName(), $param->getBehavior(), $param->getPriority()); |
|
1357 | 1357 | } |
1358 | 1358 | |
1359 | 1359 | |
@@ -1365,9 +1365,9 @@ discard block |
||
1365 | 1365 | * @param $param TClassBehaviorEventParameter |
1366 | 1366 | * @since 3.2.3 |
1367 | 1367 | */ |
1368 | - public function fxDetachClassBehavior($sender,$param) { |
|
1369 | - if(in_array($param->getClass(),$this->getClassHierarchy(true))) |
|
1370 | - return $this->detachBehavior($param->getName(),$param->getPriority()); |
|
1368 | + public function fxDetachClassBehavior($sender, $param) { |
|
1369 | + if(in_array($param->getClass(), $this->getClassHierarchy(true))) |
|
1370 | + return $this->detachBehavior($param->getName(), $param->getPriority()); |
|
1371 | 1371 | } |
1372 | 1372 | |
1373 | 1373 | |
@@ -1389,8 +1389,8 @@ discard block |
||
1389 | 1389 | * @throws TInvalidOperationException if the class behavior is already defined |
1390 | 1390 | * @since 3.2.3 |
1391 | 1391 | */ |
1392 | - public static function attachClassBehavior($name,$behavior,$class=null,$priority=null) { |
|
1393 | - if(!$class&&function_exists('get_called_class')) |
|
1392 | + public static function attachClassBehavior($name, $behavior, $class=null, $priority=null) { |
|
1393 | + if(!$class && function_exists('get_called_class')) |
|
1394 | 1394 | $class=get_called_class(); |
1395 | 1395 | if(!$class) |
1396 | 1396 | throw new TInvalidOperationException('component_no_class_provided_nor_late_binding'); |
@@ -1403,11 +1403,11 @@ discard block |
||
1403 | 1403 | if(empty(self::$_um[$class])) |
1404 | 1404 | self::$_um[$class]=array(); |
1405 | 1405 | if(isset(self::$_um[$class][$name])) |
1406 | - throw new TInvalidOperationException('component_class_behavior_defined',$class,$name); |
|
1407 | - $param=new TClassBehaviorEventParameter($class,$name,$behavior,$priority); |
|
1408 | - self::$_um[$class]=array($name=>$param)+self::$_um[$class]; |
|
1409 | - $behaviorObject=is_string($behavior)?new $behavior:$behavior; |
|
1410 | - return $behaviorObject->raiseEvent('fxAttachClassBehavior',null,$param); |
|
1406 | + throw new TInvalidOperationException('component_class_behavior_defined', $class, $name); |
|
1407 | + $param=new TClassBehaviorEventParameter($class, $name, $behavior, $priority); |
|
1408 | + self::$_um[$class]=array($name=>$param) + self::$_um[$class]; |
|
1409 | + $behaviorObject=is_string($behavior) ? new $behavior : $behavior; |
|
1410 | + return $behaviorObject->raiseEvent('fxAttachClassBehavior', null, $param); |
|
1411 | 1411 | } |
1412 | 1412 | |
1413 | 1413 | |
@@ -1423,8 +1423,8 @@ discard block |
||
1423 | 1423 | * not supplied as a parameter. |
1424 | 1424 | * @since 3.2.3 |
1425 | 1425 | */ |
1426 | - public static function detachClassBehavior($name,$class=null,$priority=false) { |
|
1427 | - if(!$class&&function_exists('get_called_class')) |
|
1426 | + public static function detachClassBehavior($name, $class=null, $priority=false) { |
|
1427 | + if(!$class && function_exists('get_called_class')) |
|
1428 | 1428 | $class=get_called_class(); |
1429 | 1429 | if(!$class) |
1430 | 1430 | throw new TInvalidOperationException('component_no_class_provided_nor_late_binding'); |
@@ -1432,13 +1432,13 @@ discard block |
||
1432 | 1432 | $class=strtolower($class); |
1433 | 1433 | if(!is_string($name)) |
1434 | 1434 | $name=get_class($name); |
1435 | - if(empty(self::$_um[$class])||!isset(self::$_um[$class][$name])) |
|
1435 | + if(empty(self::$_um[$class]) || !isset(self::$_um[$class][$name])) |
|
1436 | 1436 | return false; |
1437 | 1437 | $param=self::$_um[$class][$name]; |
1438 | 1438 | $behavior=$param->getBehavior(); |
1439 | 1439 | unset(self::$_um[$class][$name]); |
1440 | - $behaviorObject=is_string($behavior)?new $behavior:$behavior; |
|
1441 | - return $behaviorObject->raiseEvent('fxDetachClassBehavior',null,$param); |
|
1440 | + $behaviorObject=is_string($behavior) ? new $behavior : $behavior; |
|
1441 | + return $behaviorObject->raiseEvent('fxDetachClassBehavior', null, $param); |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | /** |
@@ -1450,7 +1450,7 @@ discard block |
||
1450 | 1450 | */ |
1451 | 1451 | public function asa($behaviorname) |
1452 | 1452 | { |
1453 | - return isset($this->_m[$behaviorname])?$this->_m[$behaviorname]:null; |
|
1453 | + return isset($this->_m[$behaviorname]) ? $this->_m[$behaviorname] : null; |
|
1454 | 1454 | } |
1455 | 1455 | |
1456 | 1456 | /** |
@@ -1476,15 +1476,15 @@ discard block |
||
1476 | 1476 | { |
1477 | 1477 | if($this instanceof $class) |
1478 | 1478 | return true; |
1479 | - if($this->_m!==null&&$this->_behaviorsenabled) |
|
1480 | - foreach($this->_m->toArray() as $behavior){ |
|
1481 | - if(($behavior instanceof IBehavior)&&!$behavior->getEnabled()) |
|
1479 | + if($this->_m!==null && $this->_behaviorsenabled) |
|
1480 | + foreach($this->_m->toArray() as $behavior) { |
|
1481 | + if(($behavior instanceof IBehavior) && !$behavior->getEnabled()) |
|
1482 | 1482 | continue; |
1483 | 1483 | |
1484 | - $check = null; |
|
1485 | - if(($behavior->isa('\Prado\Util\IInstanceCheck'))&&$check=$behavior->isinstanceof($class,$this)) |
|
1484 | + $check=null; |
|
1485 | + if(($behavior->isa('\Prado\Util\IInstanceCheck')) && $check=$behavior->isinstanceof($class, $this)) |
|
1486 | 1486 | return true; |
1487 | - if($check===null&&($behavior->isa($class))) |
|
1487 | + if($check===null && ($behavior->isa($class))) |
|
1488 | 1488 | return true; |
1489 | 1489 | } |
1490 | 1490 | return false; |
@@ -1502,9 +1502,9 @@ discard block |
||
1502 | 1502 | { |
1503 | 1503 | foreach($behaviors as $name=>$behavior) |
1504 | 1504 | if($behavior instanceof TClassBehaviorEventParameter) |
1505 | - $this->attachBehavior($behavior->getName(),$behavior->getBehavior(),$behavior->getPriority()); |
|
1505 | + $this->attachBehavior($behavior->getName(), $behavior->getBehavior(), $behavior->getPriority()); |
|
1506 | 1506 | else |
1507 | - $this->attachBehavior($name,$behavior); |
|
1507 | + $this->attachBehavior($name, $behavior); |
|
1508 | 1508 | } |
1509 | 1509 | |
1510 | 1510 | /** |
@@ -1521,9 +1521,9 @@ discard block |
||
1521 | 1521 | { |
1522 | 1522 | foreach($behaviors as $name=>$behavior) |
1523 | 1523 | if($behavior instanceof TClassBehaviorEventParameter) |
1524 | - $this->detachBehavior($behavior->getName(),$behavior->getPriority()); |
|
1524 | + $this->detachBehavior($behavior->getName(), $behavior->getPriority()); |
|
1525 | 1525 | else |
1526 | - $this->detachBehavior(is_string($behavior)?$behavior:$name); |
|
1526 | + $this->detachBehavior(is_string($behavior) ? $behavior : $name); |
|
1527 | 1527 | } |
1528 | 1528 | } |
1529 | 1529 | |
@@ -1561,19 +1561,19 @@ discard block |
||
1561 | 1561 | * @return IBehavior the behavior object |
1562 | 1562 | * @since 3.2.3 |
1563 | 1563 | */ |
1564 | - public function attachBehavior($name,$behavior,$priority=null) |
|
1564 | + public function attachBehavior($name, $behavior, $priority=null) |
|
1565 | 1565 | { |
1566 | 1566 | if(is_string($behavior)) |
1567 | 1567 | $behavior=Prado::createComponent($behavior); |
1568 | 1568 | if(!($behavior instanceof IBaseBehavior)) |
1569 | - throw new TInvalidDataTypeException('component_not_a_behavior',get_class($behavior)); |
|
1569 | + throw new TInvalidDataTypeException('component_not_a_behavior', get_class($behavior)); |
|
1570 | 1570 | if($behavior instanceof IBehavior) |
1571 | 1571 | $behavior->setEnabled(true); |
1572 | 1572 | if($this->_m===null) |
1573 | 1573 | $this->_m=new TPriorityMap; |
1574 | 1574 | $behavior->attach($this); |
1575 | - $this->dyAttachBehavior($name,$behavior); |
|
1576 | - $this->_m->add($name,$behavior,$priority); |
|
1575 | + $this->dyAttachBehavior($name, $behavior); |
|
1576 | + $this->_m->add($name, $behavior, $priority); |
|
1577 | 1577 | return $behavior; |
1578 | 1578 | } |
1579 | 1579 | |
@@ -1594,14 +1594,14 @@ discard block |
||
1594 | 1594 | * @return IBehavior the detached behavior. Null if the behavior does not exist. |
1595 | 1595 | * @since 3.2.3 |
1596 | 1596 | */ |
1597 | - public function detachBehavior($name,$priority=false) |
|
1597 | + public function detachBehavior($name, $priority=false) |
|
1598 | 1598 | { |
1599 | - if($this->_m!=null&&isset($this->_m[$name])) |
|
1599 | + if($this->_m!=null && isset($this->_m[$name])) |
|
1600 | 1600 | { |
1601 | 1601 | $this->_m[$name]->detach($this); |
1602 | 1602 | $behavior=$this->_m->itemAt($name); |
1603 | - $this->_m->remove($name,$priority); |
|
1604 | - $this->dyDetachBehavior($name,$behavior); |
|
1603 | + $this->_m->remove($name, $priority); |
|
1604 | + $this->dyDetachBehavior($name, $behavior); |
|
1605 | 1605 | return $behavior; |
1606 | 1606 | } |
1607 | 1607 | } |
@@ -1677,10 +1677,10 @@ discard block |
||
1677 | 1677 | */ |
1678 | 1678 | public function enableBehavior($name) |
1679 | 1679 | { |
1680 | - if($this->_m!=null&&isset($this->_m[$name])){ |
|
1680 | + if($this->_m!=null && isset($this->_m[$name])) { |
|
1681 | 1681 | if($this->_m[$name] instanceof IBehavior) { |
1682 | 1682 | $this->_m[$name]->setEnabled(true); |
1683 | - $this->dyEnableBehavior($name,$this->_m[$name]); |
|
1683 | + $this->dyEnableBehavior($name, $this->_m[$name]); |
|
1684 | 1684 | return true; |
1685 | 1685 | } |
1686 | 1686 | return false; |
@@ -1705,10 +1705,10 @@ discard block |
||
1705 | 1705 | */ |
1706 | 1706 | public function disableBehavior($name) |
1707 | 1707 | { |
1708 | - if($this->_m!=null&&isset($this->_m[$name])){ |
|
1708 | + if($this->_m!=null && isset($this->_m[$name])) { |
|
1709 | 1709 | if($this->_m[$name] instanceof IBehavior) { |
1710 | 1710 | $this->_m[$name]->setEnabled(false); |
1711 | - $this->dyDisableBehavior($name,$this->_m[$name]); |
|
1711 | + $this->dyDisableBehavior($name, $this->_m[$name]); |
|
1712 | 1712 | return true; |
1713 | 1713 | } |
1714 | 1714 | return false; |
@@ -1723,9 +1723,9 @@ discard block |
||
1723 | 1723 | */ |
1724 | 1724 | public function __sleep() |
1725 | 1725 | { |
1726 | - $a = (array)$this; |
|
1727 | - $a = array_keys($a); |
|
1728 | - $exprops = array(); |
|
1726 | + $a=(array) $this; |
|
1727 | + $a=array_keys($a); |
|
1728 | + $exprops=array(); |
|
1729 | 1729 | $this->_getZappableSleepProps($exprops); |
1730 | 1730 | return array_diff($a, $exprops); |
1731 | 1731 | } |
@@ -1739,12 +1739,12 @@ discard block |
||
1739 | 1739 | protected function _getZappableSleepProps(&$exprops) |
1740 | 1740 | { |
1741 | 1741 | if($this->_listeningenabled===false) |
1742 | - $exprops[] = "\0Prado\TComponent\0_listeningenabled"; |
|
1742 | + $exprops[]="\0Prado\TComponent\0_listeningenabled"; |
|
1743 | 1743 | if($this->_behaviorsenabled===true) |
1744 | - $exprops[] = "\0Prado\TComponent\0_behaviorsenabled"; |
|
1745 | - if ($this->_e===array()) |
|
1746 | - $exprops[] = "\0Prado\TComponent\0_e"; |
|
1747 | - if ($this->_m===null) |
|
1748 | - $exprops[] = "\0Prado\TComponent\0_m"; |
|
1744 | + $exprops[]="\0Prado\TComponent\0_behaviorsenabled"; |
|
1745 | + if($this->_e===array()) |
|
1746 | + $exprops[]="\0Prado\TComponent\0_e"; |
|
1747 | + if($this->_m===null) |
|
1748 | + $exprops[]="\0Prado\TComponent\0_m"; |
|
1749 | 1749 | } |
1750 | 1750 | } |
1751 | 1751 | \ No newline at end of file |
@@ -55,6 +55,9 @@ discard block |
||
55 | 55 | $this->reflect(); |
56 | 56 | } |
57 | 57 | |
58 | + /** |
|
59 | + * @param \ReflectionMethod $method |
|
60 | + */ |
|
58 | 61 | private function isPropertyMethod($method) |
59 | 62 | { |
60 | 63 | $methodName=$method->getName(); |
@@ -63,6 +66,9 @@ discard block |
||
63 | 66 | && isset($methodName[3]); |
64 | 67 | } |
65 | 68 | |
69 | + /** |
|
70 | + * @param \ReflectionMethod $method |
|
71 | + */ |
|
66 | 72 | private function isEventMethod($method) |
67 | 73 | { |
68 | 74 | $methodName=$method->getName(); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function __construct($component) |
48 | 48 | { |
49 | - if(is_string($component) && class_exists($component,false)) |
|
49 | + if(is_string($component) && class_exists($component, false)) |
|
50 | 50 | $this->_className=$component; |
51 | 51 | else if(is_object($component)) |
52 | 52 | $this->_className=get_class($component); |
@@ -59,14 +59,14 @@ discard block |
||
59 | 59 | { |
60 | 60 | $methodName=$method->getName(); |
61 | 61 | return $method->getNumberOfRequiredParameters()===0 |
62 | - && strncasecmp($methodName,'get',3)===0 |
|
62 | + && strncasecmp($methodName, 'get', 3)===0 |
|
63 | 63 | && isset($methodName[3]); |
64 | 64 | } |
65 | 65 | |
66 | 66 | private function isEventMethod($method) |
67 | 67 | { |
68 | 68 | $methodName=$method->getName(); |
69 | - return strncasecmp($methodName,'on',2)===0 |
|
69 | + return strncasecmp($methodName, 'on', 2)===0 |
|
70 | 70 | && isset($methodName[2]); |
71 | 71 | } |
72 | 72 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $properties=array(); |
77 | 77 | $events=array(); |
78 | 78 | $methods=array(); |
79 | - $isComponent=is_subclass_of($this->_className,'TComponent') || strcasecmp($this->_className,'TComponent')===0; |
|
79 | + $isComponent=is_subclass_of($this->_className, 'TComponent') || strcasecmp($this->_className, 'TComponent')===0; |
|
80 | 80 | foreach($class->getMethods() as $method) |
81 | 81 | { |
82 | 82 | if($method->isPublic() || $method->isProtected()) |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | if(!$method->isStatic() && $isComponent) |
86 | 86 | { |
87 | 87 | if($this->isPropertyMethod($method)) |
88 | - $properties[substr($methodName,3)]=$method; |
|
88 | + $properties[substr($methodName, 3)]=$method; |
|
89 | 89 | else if($this->isEventMethod($method)) |
90 | 90 | { |
91 | 91 | $methodName[0]='O'; |
92 | 92 | $events[$methodName]=$method; |
93 | 93 | } |
94 | 94 | } |
95 | - if(strncmp($methodName,'__',2)!==0) |
|
95 | + if(strncmp($methodName, '__', 2)!==0) |
|
96 | 96 | $methods[$methodName]=$method; |
97 | 97 | } |
98 | 98 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | protected function determinePropertyType($method) |
143 | 143 | { |
144 | 144 | $comment=$method->getDocComment(); |
145 | - if(preg_match('/@return\\s+(.*?)\\s+/',$comment,$matches)) |
|
145 | + if(preg_match('/@return\\s+(.*?)\\s+/', $comment, $matches)) |
|
146 | 146 | return $matches[1]; |
147 | 147 | else |
148 | 148 | return '{unknown}'; |
@@ -27,11 +27,14 @@ |
||
27 | 27 | /** |
28 | 28 | * Attaches the behavior object to the component. |
29 | 29 | * @param CComponent the component that this behavior is to be attached to. |
30 | + * @param \Prado\TComponent $component |
|
31 | + * @return void |
|
30 | 32 | */ |
31 | 33 | public function attach($component); |
32 | 34 | /** |
33 | 35 | * Detaches the behavior object from the component. |
34 | 36 | * @param CComponent the component that this behavior is to be detached from. |
37 | + * @return void |
|
35 | 38 | */ |
36 | 39 | public function detach($component); |
37 | 40 | } |
38 | 41 | \ No newline at end of file |