@@ -53,7 +53,7 @@ |
||
53 | 53 | $properties = $prepared->getParameterNames(false); |
54 | 54 | //$parameters = $prepared->getParameterValues(); |
55 | 55 | $registry = $manager->getTypeHandlers(); |
56 | - if ($properties) |
|
56 | + if($properties) |
|
57 | 57 | for($i = 0, $k = $properties->getCount(); $i < $k; $i++) |
58 | 58 | { |
59 | 59 | $property = $statement->parameterMap()->getProperty($i); |
@@ -26,18 +26,18 @@ |
||
26 | 26 | private $_keys; |
27 | 27 | private $_method = TMappedStatement::QUERY_FOR_LIST; |
28 | 28 | |
29 | - public function getStatement(){ return $this->_statement; } |
|
30 | - public function setStatement($value){ $this->_statement = $value; } |
|
29 | + public function getStatement() { return $this->_statement; } |
|
30 | + public function setStatement($value) { $this->_statement = $value; } |
|
31 | 31 | |
32 | - public function getResultProperty(){ return $this->_property; } |
|
33 | - public function setResultProperty($value){ $this->_property = $value; } |
|
32 | + public function getResultProperty() { return $this->_property; } |
|
33 | + public function setResultProperty($value) { $this->_property = $value; } |
|
34 | 34 | |
35 | - public function getResultObject(){ return $this->_resultObject; } |
|
36 | - public function setResultObject($value){ $this->_resultObject = $value; } |
|
35 | + public function getResultObject() { return $this->_resultObject; } |
|
36 | + public function setResultObject($value) { $this->_resultObject = $value; } |
|
37 | 37 | |
38 | - public function getKeys(){ return $this->_keys; } |
|
39 | - public function setKeys($value){ $this->_keys = $value; } |
|
38 | + public function getKeys() { return $this->_keys; } |
|
39 | + public function setKeys($value) { $this->_keys = $value; } |
|
40 | 40 | |
41 | - public function getMethod(){ return $this->_method; } |
|
42 | - public function setMethod($value){ $this->_method = $value; } |
|
41 | + public function getMethod() { return $this->_method; } |
|
42 | + public function setMethod($value) { $this->_method = $value; } |
|
43 | 43 | } |
44 | 44 | \ No newline at end of file |
@@ -47,8 +47,9 @@ |
||
47 | 47 | protected function implodeNode($node) |
48 | 48 | { |
49 | 49 | $attributes = []; |
50 | - foreach($node->attributes() as $k => $v) |
|
51 | - $attributes[] = $k . '="' . (string)$v . '"'; |
|
50 | + foreach($node->attributes() as $k => $v) { |
|
51 | + $attributes[] = $k . '="' . (string)$v . '"'; |
|
52 | + } |
|
52 | 53 | return '<' . $node->getName() . ' ' . implode(' ', $attributes) . '>'; |
53 | 54 | } |
54 | 55 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | array_shift($args); |
31 | 31 | $n = count($args); |
32 | 32 | $tokens = []; |
33 | - for($i = 0;$i < $n;++$i) |
|
33 | + for($i = 0; $i < $n; ++$i) |
|
34 | 34 | { |
35 | 35 | if($args[$i] instanceof SimpleXMLElement) |
36 | 36 | $tokens['{' . $i . '}'] = $this->implodeNode($args[$i]); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | $attributes = []; |
50 | 50 | foreach($node->attributes() as $k => $v) |
51 | - $attributes[] = $k . '="' . (string)$v . '"'; |
|
51 | + $attributes[] = $k . '="' . (string) $v . '"'; |
|
52 | 52 | return '<' . $node->getName() . ' ' . implode(' ', $attributes) . '>'; |
53 | 53 | } |
54 | 54 |
@@ -31,9 +31,10 @@ |
||
31 | 31 | */ |
32 | 32 | public function getDbTypeHandler($dbType = 'NULL') |
33 | 33 | { |
34 | - foreach($this->_typeHandlers as $handler) |
|
35 | - if($handler->getDbType() === $dbType) |
|
34 | + foreach($this->_typeHandlers as $handler) { |
|
35 | + if($handler->getDbType() === $dbType) |
|
36 | 36 | return $handler; |
37 | + } |
|
37 | 38 | } |
38 | 39 | |
39 | 40 | /** |
@@ -332,8 +332,7 @@ discard block |
||
332 | 332 | { |
333 | 333 | $configFile = $basePath; |
334 | 334 | $basePath = dirname($configFile); |
335 | - } |
|
336 | - else |
|
335 | + } else |
|
337 | 336 | $configFile = null; |
338 | 337 | |
339 | 338 | // determine runtime path |
@@ -353,8 +352,7 @@ discard block |
||
353 | 352 | } |
354 | 353 | $this->setBasePath($basePath); |
355 | 354 | $this->setRuntimePath($runtimePath); |
356 | - } |
|
357 | - else |
|
355 | + } else |
|
358 | 356 | throw new TConfigurationException('application_runtimepath_invalid', $runtimePath); |
359 | 357 | |
360 | 358 | } |
@@ -383,8 +381,7 @@ discard block |
||
383 | 381 | $this->$method(); |
384 | 382 | $this->_step++; |
385 | 383 | } |
386 | - } |
|
387 | - catch(\Exception $e) |
|
384 | + } catch(\Exception $e) |
|
388 | 385 | { |
389 | 386 | $this->onError($e); |
390 | 387 | } |
@@ -961,16 +958,19 @@ discard block |
||
961 | 958 | return; |
962 | 959 | |
963 | 960 | // set path aliases and using namespaces |
964 | - foreach($config->getAliases() as $alias => $path) |
|
965 | - Prado::setPathOfAlias($alias, $path); |
|
966 | - foreach($config->getUsings() as $using) |
|
967 | - Prado::using($using); |
|
961 | + foreach($config->getAliases() as $alias => $path) { |
|
962 | + Prado::setPathOfAlias($alias, $path); |
|
963 | + } |
|
964 | + foreach($config->getUsings() as $using) { |
|
965 | + Prado::using($using); |
|
966 | + } |
|
968 | 967 | |
969 | 968 | // set application properties |
970 | 969 | if(!$withinService) |
971 | 970 | { |
972 | - foreach($config->getProperties() as $name => $value) |
|
973 | - $this->setSubProperty($name, $value); |
|
971 | + foreach($config->getProperties() as $name => $value) { |
|
972 | + $this->setSubProperty($name, $value); |
|
973 | + } |
|
974 | 974 | } |
975 | 975 | |
976 | 976 | if(empty($this->_services)) |
@@ -982,11 +982,11 @@ discard block |
||
982 | 982 | if(is_array($parameter)) |
983 | 983 | { |
984 | 984 | $component = Prado::createComponent($parameter[0]); |
985 | - foreach($parameter[1] as $name => $value) |
|
986 | - $component->setSubProperty($name, $value); |
|
985 | + foreach($parameter[1] as $name => $value) { |
|
986 | + $component->setSubProperty($name, $value); |
|
987 | + } |
|
987 | 988 | $this->_parameters->add($id, $component); |
988 | - } |
|
989 | - else |
|
989 | + } else |
|
990 | 990 | $this->_parameters->add($id, $parameter); |
991 | 991 | } |
992 | 992 | |
@@ -1000,12 +1000,14 @@ discard block |
||
1000 | 1000 | if($module = $this->internalLoadModule($id)) |
1001 | 1001 | $modules[] = $module; |
1002 | 1002 | } |
1003 | - foreach($modules as $module) |
|
1004 | - $module[0]->init($module[1]); |
|
1003 | + foreach($modules as $module) { |
|
1004 | + $module[0]->init($module[1]); |
|
1005 | + } |
|
1005 | 1006 | |
1006 | 1007 | // load service |
1007 | - foreach($config->getServices() as $serviceID => $serviceConfig) |
|
1008 | - $this->_services[$serviceID] = $serviceConfig; |
|
1008 | + foreach($config->getServices() as $serviceID => $serviceConfig) { |
|
1009 | + $this->_services[$serviceID] = $serviceConfig; |
|
1010 | + } |
|
1009 | 1011 | |
1010 | 1012 | // external configurations |
1011 | 1013 | foreach($config->getExternalConfigurations() as $filePath => $condition) |
@@ -1045,8 +1047,7 @@ discard block |
||
1045 | 1047 | $config->loadFromFile($this->_configFile); |
1046 | 1048 | if($this->_cacheFile !== null) |
1047 | 1049 | file_put_contents($this->_cacheFile, serialize($config), LOCK_EX); |
1048 | - } |
|
1049 | - else |
|
1050 | + } else |
|
1050 | 1051 | $config = unserialize(file_get_contents($this->_cacheFile)); |
1051 | 1052 | |
1052 | 1053 | $this->applyConfiguration($config, false); |
@@ -1077,8 +1078,9 @@ discard block |
||
1077 | 1078 | $service->setID($serviceID); |
1078 | 1079 | $this->setService($service); |
1079 | 1080 | |
1080 | - foreach($initProperties as $name => $value) |
|
1081 | - $service->setSubProperty($name, $value); |
|
1081 | + foreach($initProperties as $name => $value) { |
|
1082 | + $service->setSubProperty($name, $value); |
|
1083 | + } |
|
1082 | 1084 | |
1083 | 1085 | if($configElement !== null) |
1084 | 1086 | { |
@@ -1091,8 +1093,7 @@ discard block |
||
1091 | 1093 | } |
1092 | 1094 | |
1093 | 1095 | $service->init($configElement); |
1094 | - } |
|
1095 | - else |
|
1096 | + } else |
|
1096 | 1097 | throw new THttpException(500, 'application_service_unknown', $serviceID); |
1097 | 1098 | } |
1098 | 1099 |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | // generates unique ID by hashing the runtime path |
307 | 307 | $this->_uniqueID = md5($this->_runtimePath); |
308 | 308 | $this->_parameters = new \Prado\Collections\TMap; |
309 | - $this->_services = [$this->getPageServiceID() => ['TPageService',[],null]]; |
|
309 | + $this->_services = [$this->getPageServiceID() => ['TPageService', [], null]]; |
|
310 | 310 | |
311 | 311 | Prado::setPathOfAlias('Application', $this->_basePath); |
312 | 312 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $this->_step++; |
385 | 385 | } |
386 | 386 | } |
387 | - catch(\Exception $e) |
|
387 | + catch (\Exception $e) |
|
388 | 388 | { |
389 | 389 | $this->onError($e); |
390 | 390 | } |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | */ |
420 | 420 | public function getGlobalState($key, $defaultValue = null) |
421 | 421 | { |
422 | - return isset($this->_globals[$key])?$this->_globals[$key]:$defaultValue; |
|
422 | + return isset($this->_globals[$key]) ? $this->_globals[$key] : $defaultValue; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | // keep the key to avoid reuse of the old module id |
949 | 949 | $this->_lazyModules[$id] = null; |
950 | 950 | |
951 | - return [$module,$configElement]; |
|
951 | + return [$module, $configElement]; |
|
952 | 952 | } |
953 | 953 | /** |
954 | 954 | * Applies an application configuration. |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | } |
975 | 975 | |
976 | 976 | if(empty($this->_services)) |
977 | - $this->_services = [$this->getPageServiceID() => ['Prado\Web\Services\TPageService',[],null]]; |
|
977 | + $this->_services = [$this->getPageServiceID() => ['Prado\Web\Services\TPageService', [], null]]; |
|
978 | 978 | |
979 | 979 | // load parameters |
980 | 980 | foreach($config->getParameters() as $id => $parameter) |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | public function onEndRequest() |
1239 | 1239 | { |
1240 | 1240 | $this->flushOutput(false); // flush all remaining content in the buffer |
1241 | - $this->saveGlobals(); // save global state |
|
1241 | + $this->saveGlobals(); // save global state |
|
1242 | 1242 | $this->raiseEvent('OnEndRequest', $this, null); |
1243 | 1243 | } |
1244 | 1244 | } |
@@ -379,7 +379,7 @@ |
||
379 | 379 | if($this->_requestCompleted) |
380 | 380 | break; |
381 | 381 | $method = self::$_steps[$this->_step]; |
382 | - Prado::trace("Executing $method()", 'Prado\TApplication'); |
|
382 | + Prado::trace("executing $method()", 'Prado\TApplication'); |
|
383 | 383 | $this->$method(); |
384 | 384 | $this->_step++; |
385 | 385 | } |
@@ -431,8 +431,9 @@ discard block |
||
431 | 431 | |
432 | 432 | $fx = array_filter(get_class_methods($this), [$this,'filter_prado_fx']); |
433 | 433 | |
434 | - foreach($fx as $func) |
|
435 | - $this->attachEventHandler($func, [$this,$func]); |
|
434 | + foreach($fx as $func) { |
|
435 | + $this->attachEventHandler($func, [$this,$func]); |
|
436 | + } |
|
436 | 437 | |
437 | 438 | if(is_a($this, 'Prado\\Util\\IDynamicMethods')) { |
438 | 439 | $this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this,'__dycall']); |
@@ -465,8 +466,9 @@ discard block |
||
465 | 466 | |
466 | 467 | $fx = array_filter(get_class_methods($this), [$this,'filter_prado_fx']); |
467 | 468 | |
468 | - foreach($fx as $func) |
|
469 | - $this->detachEventHandler($func, [$this,$func]); |
|
469 | + foreach($fx as $func) { |
|
470 | + $this->detachEventHandler($func, [$this,$func]); |
|
471 | + } |
|
470 | 472 | |
471 | 473 | if(is_a($this, 'Prado\\Util\\IDynamicMethods')) { |
472 | 474 | $this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this,'__dycall']); |
@@ -550,8 +552,7 @@ discard block |
||
550 | 552 | } |
551 | 553 | if($callchain->getCount() > 0) |
552 | 554 | return call_user_func_array([$callchain,'call'], $args); |
553 | - } |
|
554 | - else |
|
555 | + } else |
|
555 | 556 | { |
556 | 557 | foreach($this->_m->toArray() as $behavior) |
557 | 558 | { |
@@ -608,29 +609,25 @@ discard block |
||
608 | 609 | { |
609 | 610 | // getting a property |
610 | 611 | return $this->$getter(); |
611 | - } |
|
612 | - elseif(method_exists($this, $jsgetter = 'getjs' . $name)) |
|
612 | + } elseif(method_exists($this, $jsgetter = 'getjs' . $name)) |
|
613 | 613 | { |
614 | 614 | // getting a javascript property |
615 | 615 | return (string)$this->$jsgetter(); |
616 | - } |
|
617 | - elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) |
|
616 | + } elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) |
|
618 | 617 | { |
619 | 618 | // getting an event (handler list) |
620 | 619 | $name = strtolower($name); |
621 | 620 | if(!isset($this->_e[$name])) |
622 | 621 | $this->_e[$name] = new TPriorityList; |
623 | 622 | return $this->_e[$name]; |
624 | - } |
|
625 | - elseif(strncasecmp($name, 'fx', 2) === 0) |
|
623 | + } elseif(strncasecmp($name, 'fx', 2) === 0) |
|
626 | 624 | { |
627 | 625 | // getting a global event (handler list) |
628 | 626 | $name = strtolower($name); |
629 | 627 | if(!isset(self::$_ue[$name])) |
630 | 628 | self::$_ue[$name] = new TPriorityList; |
631 | 629 | return self::$_ue[$name]; |
632 | - } |
|
633 | - elseif($this->_behaviorsenabled) |
|
630 | + } elseif($this->_behaviorsenabled) |
|
634 | 631 | { |
635 | 632 | // getting a behavior property/event (handler list) |
636 | 633 | if(isset($this->_m[$name])) |
@@ -670,18 +667,15 @@ discard block |
||
670 | 667 | if(strncasecmp($name, 'js', 2) === 0 && $value && !($value instanceof TJavaScriptLiteral)) |
671 | 668 | $value = new TJavaScriptLiteral($value); |
672 | 669 | return $this->$setter($value); |
673 | - } |
|
674 | - elseif(method_exists($this, $jssetter = 'setjs' . $name)) |
|
670 | + } elseif(method_exists($this, $jssetter = 'setjs' . $name)) |
|
675 | 671 | { |
676 | 672 | if($value && !($value instanceof TJavaScriptString)) |
677 | 673 | $value = new TJavaScriptString($value); |
678 | 674 | return $this->$jssetter($value); |
679 | - } |
|
680 | - elseif((strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2) === 0) |
|
675 | + } elseif((strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) || strncasecmp($name, 'fx', 2) === 0) |
|
681 | 676 | { |
682 | 677 | return $this->attachEventHandler($name, $value); |
683 | - } |
|
684 | - elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled) |
|
678 | + } elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled) |
|
685 | 679 | { |
686 | 680 | $sets = 0; |
687 | 681 | foreach($this->_m->toArray() as $behavior) |
@@ -699,8 +693,7 @@ discard block |
||
699 | 693 | if(method_exists($this, 'get' . $name) || method_exists($this, 'getjs' . $name)) |
700 | 694 | { |
701 | 695 | throw new TInvalidOperationException('component_property_readonly', get_class($this), $name); |
702 | - } |
|
703 | - else |
|
696 | + } else |
|
704 | 697 | { |
705 | 698 | throw new TInvalidOperationException('component_property_undefined', get_class($this), $name); |
706 | 699 | } |
@@ -728,13 +721,11 @@ discard block |
||
728 | 721 | { |
729 | 722 | $name = strtolower($name); |
730 | 723 | return isset($this->_e[$name]) && $this->_e[$name]->getCount(); |
731 | - } |
|
732 | - elseif(strncasecmp($name, 'fx', 2) === 0) |
|
724 | + } elseif(strncasecmp($name, 'fx', 2) === 0) |
|
733 | 725 | { |
734 | 726 | $name = strtolower($name); |
735 | 727 | return isset(self::$_ue[$name]) && self::$_ue[$name]->getCount(); |
736 | - } |
|
737 | - elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled) |
|
728 | + } elseif($this->_m !== null && $this->_m->getCount() > 0 && $this->_behaviorsenabled) |
|
738 | 729 | { |
739 | 730 | if(isset($this->_m[$name])) |
740 | 731 | return true; |
@@ -744,8 +735,7 @@ discard block |
||
744 | 735 | return isset($behavior->$name); |
745 | 736 | } |
746 | 737 | |
747 | - } |
|
748 | - else |
|
738 | + } else |
|
749 | 739 | return false; |
750 | 740 | } |
751 | 741 | |
@@ -862,8 +852,9 @@ discard block |
||
862 | 852 | public function getSubProperty($path) |
863 | 853 | { |
864 | 854 | $object = $this; |
865 | - foreach(explode('.', $path) as $property) |
|
866 | - $object = $object->$property; |
|
855 | + foreach(explode('.', $path) as $property) { |
|
856 | + $object = $object->$property; |
|
857 | + } |
|
867 | 858 | return $object; |
868 | 859 | } |
869 | 860 | |
@@ -959,15 +950,13 @@ discard block |
||
959 | 950 | if(!isset($this->_e[$name])) |
960 | 951 | $this->_e[$name] = new TPriorityList; |
961 | 952 | return $this->_e[$name]; |
962 | - } |
|
963 | - elseif(strncasecmp($name, 'fx', 2) === 0) |
|
953 | + } elseif(strncasecmp($name, 'fx', 2) === 0) |
|
964 | 954 | { |
965 | 955 | $name = strtolower($name); |
966 | 956 | if(!isset(self::$_ue[$name])) |
967 | 957 | self::$_ue[$name] = new TPriorityList; |
968 | 958 | return self::$_ue[$name]; |
969 | - } |
|
970 | - elseif($this->_m !== null && $this->_behaviorsenabled) |
|
959 | + } elseif($this->_m !== null && $this->_behaviorsenabled) |
|
971 | 960 | { |
972 | 961 | foreach($this->_m->toArray() as $behavior) |
973 | 962 | { |
@@ -1046,8 +1035,7 @@ discard block |
||
1046 | 1035 | { |
1047 | 1036 | $this->getEventHandlers($name)->remove($handler, $priority); |
1048 | 1037 | return true; |
1049 | - } |
|
1050 | - catch(\Exception $e) |
|
1038 | + } catch(\Exception $e) |
|
1051 | 1039 | { |
1052 | 1040 | } |
1053 | 1041 | } |
@@ -1170,14 +1158,11 @@ discard block |
||
1170 | 1158 | $response = $object->__dycall($name, [$sender,$param,$name]); |
1171 | 1159 | else |
1172 | 1160 | $response = $object->$method($sender, $param, $name); |
1173 | - } |
|
1174 | - else |
|
1161 | + } else |
|
1175 | 1162 | throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, $handler); |
1176 | - } |
|
1177 | - else |
|
1163 | + } else |
|
1178 | 1164 | $response = call_user_func($handler, $sender, $param, $name); |
1179 | - } |
|
1180 | - elseif(is_callable($handler, true)) |
|
1165 | + } elseif(is_callable($handler, true)) |
|
1181 | 1166 | { |
1182 | 1167 | list($object, $method) = $handler; |
1183 | 1168 | if(is_string($object)) |
@@ -1195,12 +1180,10 @@ discard block |
||
1195 | 1180 | $response = $object->__dycall($name, [$sender,$param,$name]); |
1196 | 1181 | else |
1197 | 1182 | $response = $object->$method($sender, $param, $name); |
1198 | - } |
|
1199 | - else |
|
1183 | + } else |
|
1200 | 1184 | throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, $handler[1]); |
1201 | 1185 | } |
1202 | - } |
|
1203 | - else |
|
1186 | + } else |
|
1204 | 1187 | throw new TInvalidDataValueException('component_eventhandler_invalid', get_class($this), $name, gettype($handler)); |
1205 | 1188 | |
1206 | 1189 | $this->dyIntraRaiseEventPostHandler($name, $sender, $param, $handler, $response); |
@@ -1217,8 +1200,7 @@ discard block |
||
1217 | 1200 | $param = $response; |
1218 | 1201 | |
1219 | 1202 | } |
1220 | - } |
|
1221 | - elseif(strncasecmp($name, 'on', 2) === 0 && !$this->hasEvent($name)) |
|
1203 | + } elseif(strncasecmp($name, 'on', 2) === 0 && !$this->hasEvent($name)) |
|
1222 | 1204 | throw new TInvalidOperationException('component_event_undefined', get_class($this), $name); |
1223 | 1205 | |
1224 | 1206 | if($responsetype & TEventResults::EVENT_RESULT_FILTER) |
@@ -1254,8 +1236,7 @@ discard block |
||
1254 | 1236 | if(eval("\$result=$expression;") === false) |
1255 | 1237 | throw new \Exception(''); |
1256 | 1238 | return $result; |
1257 | - } |
|
1258 | - catch(\Exception $e) |
|
1239 | + } catch(\Exception $e) |
|
1259 | 1240 | { |
1260 | 1241 | throw new TInvalidOperationException('component_expression_invalid', get_class($this), $expression, $e->getMessage()); |
1261 | 1242 | } |
@@ -1289,8 +1270,7 @@ discard block |
||
1289 | 1270 | $content = ob_get_contents(); |
1290 | 1271 | ob_end_clean(); |
1291 | 1272 | return $content; |
1292 | - } |
|
1293 | - catch(\Exception $e) |
|
1273 | + } catch(\Exception $e) |
|
1294 | 1274 | { |
1295 | 1275 | throw new TInvalidOperationException('component_statements_invalid', get_class($this), $statements, $e->getMessage()); |
1296 | 1276 | } |
@@ -1501,9 +1481,10 @@ discard block |
||
1501 | 1481 | */ |
1502 | 1482 | public function attachBehaviors($behaviors) |
1503 | 1483 | { |
1504 | - foreach($behaviors as $name => $behavior) |
|
1505 | - if($behavior instanceof TClassBehaviorEventParameter) |
|
1484 | + foreach($behaviors as $name => $behavior) { |
|
1485 | + if($behavior instanceof TClassBehaviorEventParameter) |
|
1506 | 1486 | $this->attachBehavior($behavior->getName(), $behavior->getBehavior(), $behavior->getPriority()); |
1487 | + } |
|
1507 | 1488 | else |
1508 | 1489 | $this->attachBehavior($name, $behavior); |
1509 | 1490 | } |
@@ -1520,9 +1501,10 @@ discard block |
||
1520 | 1501 | { |
1521 | 1502 | if($this->_m !== null) |
1522 | 1503 | { |
1523 | - foreach($behaviors as $name => $behavior) |
|
1524 | - if($behavior instanceof TClassBehaviorEventParameter) |
|
1504 | + foreach($behaviors as $name => $behavior) { |
|
1505 | + if($behavior instanceof TClassBehaviorEventParameter) |
|
1525 | 1506 | $this->detachBehavior($behavior->getName(), $behavior->getPriority()); |
1507 | + } |
|
1526 | 1508 | else |
1527 | 1509 | $this->detachBehavior(is_string($behavior)?$behavior:$name); |
1528 | 1510 | } |
@@ -1536,8 +1518,9 @@ discard block |
||
1536 | 1518 | { |
1537 | 1519 | if($this->_m !== null) |
1538 | 1520 | { |
1539 | - foreach($this->_m->toArray() as $name => $behavior) |
|
1540 | - $this->detachBehavior($name); |
|
1521 | + foreach($this->_m->toArray() as $name => $behavior) { |
|
1522 | + $this->detachBehavior($name); |
|
1523 | + } |
|
1541 | 1524 | $this->_m = null; |
1542 | 1525 | } |
1543 | 1526 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | { |
405 | 405 | $class = get_class($this); |
406 | 406 | $classes = [$class]; |
407 | - while($class = get_parent_class($class)){array_unshift($classes, $class);} |
|
407 | + while($class = get_parent_class($class)) {array_unshift($classes, $class); } |
|
408 | 408 | if($lowercase) |
409 | 409 | return array_map('strtolower', $classes); |
410 | 410 | return $classes; |
@@ -429,13 +429,13 @@ discard block |
||
429 | 429 | if($this->_listeningenabled) |
430 | 430 | return; |
431 | 431 | |
432 | - $fx = array_filter(get_class_methods($this), [$this,'filter_prado_fx']); |
|
432 | + $fx = array_filter(get_class_methods($this), [$this, 'filter_prado_fx']); |
|
433 | 433 | |
434 | 434 | foreach($fx as $func) |
435 | - $this->attachEventHandler($func, [$this,$func]); |
|
435 | + $this->attachEventHandler($func, [$this, $func]); |
|
436 | 436 | |
437 | 437 | if(is_a($this, 'Prado\\Util\\IDynamicMethods')) { |
438 | - $this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this,'__dycall']); |
|
438 | + $this->attachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this, '__dycall']); |
|
439 | 439 | array_push($fx, TComponent::GLOBAL_RAISE_EVENT_LISTENER); |
440 | 440 | } |
441 | 441 | |
@@ -463,13 +463,13 @@ discard block |
||
463 | 463 | if(!$this->_listeningenabled) |
464 | 464 | return; |
465 | 465 | |
466 | - $fx = array_filter(get_class_methods($this), [$this,'filter_prado_fx']); |
|
466 | + $fx = array_filter(get_class_methods($this), [$this, 'filter_prado_fx']); |
|
467 | 467 | |
468 | 468 | foreach($fx as $func) |
469 | - $this->detachEventHandler($func, [$this,$func]); |
|
469 | + $this->detachEventHandler($func, [$this, $func]); |
|
470 | 470 | |
471 | 471 | if(is_a($this, 'Prado\\Util\\IDynamicMethods')) { |
472 | - $this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this,'__dycall']); |
|
472 | + $this->detachEventHandler(TComponent::GLOBAL_RAISE_EVENT_LISTENER, [$this, '__dycall']); |
|
473 | 473 | array_push($fx, TComponent::GLOBAL_RAISE_EVENT_LISTENER); |
474 | 474 | } |
475 | 475 | |
@@ -525,10 +525,10 @@ discard block |
||
525 | 525 | if(count($args) > 0) |
526 | 526 | if($args[0] && !($args[0] instanceof TJavaScriptString)) |
527 | 527 | $args[0] = new TJavaScriptString($args[0]); |
528 | - return call_user_func_array([$this,$jsmethod], $args); |
|
528 | + return call_user_func_array([$this, $jsmethod], $args); |
|
529 | 529 | } |
530 | 530 | |
531 | - if (($getset == 'set') && method_exists($this, 'getjs' . $propname)) |
|
531 | + if(($getset == 'set') && method_exists($this, 'getjs' . $propname)) |
|
532 | 532 | throw new TInvalidOperationException('component_property_readonly', get_class($this), $method); |
533 | 533 | } |
534 | 534 | |
@@ -544,12 +544,12 @@ discard block |
||
544 | 544 | $behavior_args = $args; |
545 | 545 | if($behavior instanceof IClassBehavior) |
546 | 546 | array_unshift($behavior_args, $this); |
547 | - $callchain->addCall([$behavior,$method], $behavior_args); |
|
547 | + $callchain->addCall([$behavior, $method], $behavior_args); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | } |
551 | 551 | if($callchain->getCount() > 0) |
552 | - return call_user_func_array([$callchain,'call'], $args); |
|
552 | + return call_user_func_array([$callchain, 'call'], $args); |
|
553 | 553 | } |
554 | 554 | else |
555 | 555 | { |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | { |
560 | 560 | if($behavior instanceof IClassBehavior) |
561 | 561 | array_unshift($args, $this); |
562 | - return call_user_func_array([$behavior,$method], $args); |
|
562 | + return call_user_func_array([$behavior, $method], $args); |
|
563 | 563 | } |
564 | 564 | } |
565 | 565 | } |
@@ -569,11 +569,11 @@ discard block |
||
569 | 569 | { |
570 | 570 | if($this instanceof IDynamicMethods) |
571 | 571 | return $this->__dycall($method, $args); |
572 | - return isset($args[0])?$args[0]:null; |
|
572 | + return isset($args[0]) ? $args[0] : null; |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | // don't thrown an exception for __magicMethods() or any other weird methods natively implemented by php |
576 | - if (!method_exists($this, $method)) { |
|
576 | + if(!method_exists($this, $method)) { |
|
577 | 577 | throw new TApplicationException('component_method_undefined', get_class($this), $method); |
578 | 578 | } |
579 | 579 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | elseif(method_exists($this, $jsgetter = 'getjs' . $name)) |
613 | 613 | { |
614 | 614 | // getting a javascript property |
615 | - return (string)$this->$jsgetter(); |
|
615 | + return (string) $this->$jsgetter(); |
|
616 | 616 | } |
617 | 617 | elseif(strncasecmp($name, 'on', 2) === 0 && method_exists($this, $name)) |
618 | 618 | { |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | $this->getEventHandlers($name)->remove($handler, $priority); |
1048 | 1048 | return true; |
1049 | 1049 | } |
1050 | - catch(\Exception $e) |
|
1050 | + catch (\Exception $e) |
|
1051 | 1051 | { |
1052 | 1052 | } |
1053 | 1053 | } |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | if(method_exists($object, $method) || strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0) |
1168 | 1168 | { |
1169 | 1169 | if($method == '__dycall') |
1170 | - $response = $object->__dycall($name, [$sender,$param,$name]); |
|
1170 | + $response = $object->__dycall($name, [$sender, $param, $name]); |
|
1171 | 1171 | else |
1172 | 1172 | $response = $object->$method($sender, $param, $name); |
1173 | 1173 | } |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | if(method_exists($object, $method) || strncasecmp($method, 'dy', 2) === 0 || strncasecmp($method, 'fx', 2) === 0) |
1193 | 1193 | { |
1194 | 1194 | if($method == '__dycall') |
1195 | - $response = $object->__dycall($name, [$sender,$param,$name]); |
|
1195 | + $response = $object->__dycall($name, [$sender, $param, $name]); |
|
1196 | 1196 | else |
1197 | 1197 | $response = $object->$method($sender, $param, $name); |
1198 | 1198 | } |
@@ -1206,10 +1206,10 @@ discard block |
||
1206 | 1206 | $this->dyIntraRaiseEventPostHandler($name, $sender, $param, $handler, $response); |
1207 | 1207 | |
1208 | 1208 | if($postfunction) |
1209 | - $response = call_user_func_array($postfunction, [$sender,$param,$this,$response]); |
|
1209 | + $response = call_user_func_array($postfunction, [$sender, $param, $this, $response]); |
|
1210 | 1210 | |
1211 | 1211 | if($responsetype & TEventResults::EVENT_RESULT_ALL) |
1212 | - $responses[] = ['sender' => $sender,'param' => $param,'response' => $response]; |
|
1212 | + $responses[] = ['sender' => $sender, 'param' => $param, 'response' => $response]; |
|
1213 | 1213 | else |
1214 | 1214 | $responses[] = $response; |
1215 | 1215 | |
@@ -1255,7 +1255,7 @@ discard block |
||
1255 | 1255 | throw new \Exception(''); |
1256 | 1256 | return $result; |
1257 | 1257 | } |
1258 | - catch(\Exception $e) |
|
1258 | + catch (\Exception $e) |
|
1259 | 1259 | { |
1260 | 1260 | throw new TInvalidOperationException('component_expression_invalid', get_class($this), $expression, $e->getMessage()); |
1261 | 1261 | } |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | ob_end_clean(); |
1291 | 1291 | return $content; |
1292 | 1292 | } |
1293 | - catch(\Exception $e) |
|
1293 | + catch (\Exception $e) |
|
1294 | 1294 | { |
1295 | 1295 | throw new TInvalidOperationException('component_statements_invalid', get_class($this), $statements, $e->getMessage()); |
1296 | 1296 | } |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | throw new TInvalidOperationException('component_class_behavior_defined', $class, $name); |
1408 | 1408 | $param = new TClassBehaviorEventParameter($class, $name, $behavior, $priority); |
1409 | 1409 | self::$_um[$class] = [$name => $param] + self::$_um[$class]; |
1410 | - $behaviorObject = is_string($behavior)?new $behavior:$behavior; |
|
1410 | + $behaviorObject = is_string($behavior) ? new $behavior : $behavior; |
|
1411 | 1411 | return $behaviorObject->raiseEvent('fxAttachClassBehavior', null, $param); |
1412 | 1412 | } |
1413 | 1413 | |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | $param = self::$_um[$class][$name]; |
1439 | 1439 | $behavior = $param->getBehavior(); |
1440 | 1440 | unset(self::$_um[$class][$name]); |
1441 | - $behaviorObject = is_string($behavior)?new $behavior:$behavior; |
|
1441 | + $behaviorObject = is_string($behavior) ? new $behavior : $behavior; |
|
1442 | 1442 | return $behaviorObject->raiseEvent('fxDetachClassBehavior', null, $param); |
1443 | 1443 | } |
1444 | 1444 | |
@@ -1451,7 +1451,7 @@ discard block |
||
1451 | 1451 | */ |
1452 | 1452 | public function asa($behaviorname) |
1453 | 1453 | { |
1454 | - return isset($this->_m[$behaviorname])?$this->_m[$behaviorname]:null; |
|
1454 | + return isset($this->_m[$behaviorname]) ? $this->_m[$behaviorname] : null; |
|
1455 | 1455 | } |
1456 | 1456 | |
1457 | 1457 | /** |
@@ -1478,7 +1478,7 @@ discard block |
||
1478 | 1478 | if($this instanceof $class) |
1479 | 1479 | return true; |
1480 | 1480 | if($this->_m !== null && $this->_behaviorsenabled) |
1481 | - foreach($this->_m->toArray() as $behavior){ |
|
1481 | + foreach($this->_m->toArray() as $behavior) { |
|
1482 | 1482 | if(($behavior instanceof IBehavior) && !$behavior->getEnabled()) |
1483 | 1483 | continue; |
1484 | 1484 | |
@@ -1524,7 +1524,7 @@ discard block |
||
1524 | 1524 | if($behavior instanceof TClassBehaviorEventParameter) |
1525 | 1525 | $this->detachBehavior($behavior->getName(), $behavior->getPriority()); |
1526 | 1526 | else |
1527 | - $this->detachBehavior(is_string($behavior)?$behavior:$name); |
|
1527 | + $this->detachBehavior(is_string($behavior) ? $behavior : $name); |
|
1528 | 1528 | } |
1529 | 1529 | } |
1530 | 1530 | |
@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | */ |
1679 | 1679 | public function enableBehavior($name) |
1680 | 1680 | { |
1681 | - if($this->_m != null && isset($this->_m[$name])){ |
|
1681 | + if($this->_m != null && isset($this->_m[$name])) { |
|
1682 | 1682 | if($this->_m[$name] instanceof IBehavior) { |
1683 | 1683 | $this->_m[$name]->setEnabled(true); |
1684 | 1684 | $this->dyEnableBehavior($name, $this->_m[$name]); |
@@ -1706,7 +1706,7 @@ discard block |
||
1706 | 1706 | */ |
1707 | 1707 | public function disableBehavior($name) |
1708 | 1708 | { |
1709 | - if($this->_m != null && isset($this->_m[$name])){ |
|
1709 | + if($this->_m != null && isset($this->_m[$name])) { |
|
1710 | 1710 | if($this->_m[$name] instanceof IBehavior) { |
1711 | 1711 | $this->_m[$name]->setEnabled(false); |
1712 | 1712 | $this->dyDisableBehavior($name, $this->_m[$name]); |
@@ -1724,7 +1724,7 @@ discard block |
||
1724 | 1724 | */ |
1725 | 1725 | public function __sleep() |
1726 | 1726 | { |
1727 | - $a = (array)$this; |
|
1727 | + $a = (array) $this; |
|
1728 | 1728 | $a = array_keys($a); |
1729 | 1729 | $exprops = []; |
1730 | 1730 | $this->_getZappableSleepProps($exprops); |
@@ -1743,9 +1743,9 @@ discard block |
||
1743 | 1743 | $exprops[] = "\0Prado\TComponent\0_listeningenabled"; |
1744 | 1744 | if($this->_behaviorsenabled === true) |
1745 | 1745 | $exprops[] = "\0Prado\TComponent\0_behaviorsenabled"; |
1746 | - if ($this->_e === []) |
|
1746 | + if($this->_e === []) |
|
1747 | 1747 | $exprops[] = "\0Prado\TComponent\0_e"; |
1748 | - if ($this->_m === null) |
|
1748 | + if($this->_m === null) |
|
1749 | 1749 | $exprops[] = "\0Prado\TComponent\0_m"; |
1750 | 1750 | } |
1751 | 1751 | } |
1752 | 1752 | \ No newline at end of file |
@@ -103,8 +103,7 @@ discard block |
||
103 | 103 | { |
104 | 104 | $valid |= $action->performAction($args); |
105 | 105 | break; |
106 | - } |
|
107 | - else |
|
106 | + } else |
|
108 | 107 | { |
109 | 108 | $valid = false; |
110 | 109 | } |
@@ -123,8 +122,9 @@ discard block |
||
123 | 122 | echo "usage: php prado-cli.php action <parameter> [optional]\n"; |
124 | 123 | echo "example: php prado-cli.php -c mysite\n\n"; |
125 | 124 | echo "actions:\n"; |
126 | - foreach($this->_actions as $action) |
|
127 | - echo $action->renderHelp(); |
|
125 | + foreach($this->_actions as $action) { |
|
126 | + echo $action->renderHelp(); |
|
127 | + } |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -172,16 +172,19 @@ discard block |
||
172 | 172 | public function renderHelp() |
173 | 173 | { |
174 | 174 | $params = []; |
175 | - foreach($this->parameters as $v) |
|
176 | - $params[] = '<' . $v . '>'; |
|
175 | + foreach($this->parameters as $v) { |
|
176 | + $params[] = '<' . $v . '>'; |
|
177 | + } |
|
177 | 178 | $parameters = implode($params, ' '); |
178 | 179 | $options = []; |
179 | - foreach($this->optional as $v) |
|
180 | - $options[] = '[' . $v . ']'; |
|
180 | + foreach($this->optional as $v) { |
|
181 | + $options[] = '[' . $v . ']'; |
|
182 | + } |
|
181 | 183 | $optional = (strlen($parameters) ? ' ' : '') . implode($options, ' '); |
182 | 184 | $description = ''; |
183 | - foreach(explode("\n", wordwrap($this->description, 65)) as $line) |
|
184 | - $description .= ' ' . $line . "\n"; |
|
185 | + foreach(explode("\n", wordwrap($this->description, 65)) as $line) { |
|
186 | + $description .= ' ' . $line . "\n"; |
|
187 | + } |
|
185 | 188 | return <<<EOD |
186 | 189 | {$this->action} {$parameters}{$optional} |
187 | 190 | {$description} |
@@ -205,8 +208,7 @@ discard block |
||
205 | 208 | } |
206 | 209 | |
207 | 210 | return Prado::getApplication(); |
208 | - } |
|
209 | - else |
|
211 | + } else |
|
210 | 212 | { |
211 | 213 | PradoCommandLineInterpreter::printGreeting(); |
212 | 214 | echo '+' . str_repeat('-', 77) . "+\n"; |
@@ -522,9 +524,10 @@ discard block |
||
522 | 524 | if(false !== ($app = $this->initializePradoApplication($app_dir))) |
523 | 525 | { |
524 | 526 | Prado::using('System.Data.ActiveRecord.TActiveRecordConfig'); |
525 | - foreach($app->getModules() as $module) |
|
526 | - if($module instanceof TActiveRecordConfig) |
|
527 | + foreach($app->getModules() as $module) { |
|
528 | + if($module instanceof TActiveRecordConfig) |
|
527 | 529 | return $module; |
530 | + } |
|
528 | 531 | echo '** Unable to find TActiveRecordConfig module in ' . $xml . "\n"; |
529 | 532 | } |
530 | 533 | return false; |
@@ -554,12 +557,12 @@ discard block |
||
554 | 557 | { |
555 | 558 | echo '** Unable to find table or view "' . $tablename . '" in "' . $manager->getDbConnection()->getConnectionString() . "\".\n"; |
556 | 559 | return false; |
557 | - } |
|
558 | - else |
|
560 | + } else |
|
559 | 561 | { |
560 | 562 | $properties = []; |
561 | - foreach($tableInfo->getColumns() as $field => $column) |
|
562 | - $properties[] = $this->generateProperty($field, $column); |
|
563 | + foreach($tableInfo->getColumns() as $field => $column) { |
|
564 | + $properties[] = $this->generateProperty($field, $column); |
|
565 | + } |
|
563 | 566 | } |
564 | 567 | |
565 | 568 | $classname = basename($output, '.php'); |
@@ -699,8 +702,7 @@ discard block |
||
699 | 702 | $args = [$input[0],$input[1], $input[2],$app_dir,'soap']; |
700 | 703 | $cmd = new PradoCommandLineActiveRecordGen; |
701 | 704 | $cmd->performAction($args); |
702 | - } |
|
703 | - else |
|
705 | + } else |
|
704 | 706 | { |
705 | 707 | echo "\n Usage: generate table_name Application.pages.RecordClassName\n"; |
706 | 708 | } |
@@ -729,9 +731,10 @@ discard block |
||
729 | 731 | return false; |
730 | 732 | if (false !== ($app = $this->initializePradoApplication($app_dir))) { |
731 | 733 | Prado::using('System.Data.ActiveRecord.TActiveRecordConfig'); |
732 | - foreach ($app->getModules() as $module) |
|
733 | - if ($module instanceof TActiveRecordConfig) |
|
734 | + foreach ($app->getModules() as $module) { |
|
735 | + if ($module instanceof TActiveRecordConfig) |
|
734 | 736 | return $module; |
737 | + } |
|
735 | 738 | echo '** Unable to find TActiveRecordConfig module in ' . $xml . "\n"; |
736 | 739 | } |
737 | 740 | return false; |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | $this->_prefix = count($args) > 5 ? $args[5] : ''; |
642 | 642 | $this->_postfix = count($args) > 6 ? $args[6] : ''; |
643 | 643 | |
644 | - if ($app_dir !== false) { |
|
644 | + if($app_dir !== false) { |
|
645 | 645 | $config = $this->getActiveRecordConfig($app_dir); |
646 | 646 | |
647 | 647 | $manager = TActiveRecordManager::getInstance(); |
@@ -672,13 +672,13 @@ discard block |
||
672 | 672 | $dataReader = $command->query(); |
673 | 673 | $dataReader->bindColumn(1, $table); |
674 | 674 | $tables = []; |
675 | - while ($dataReader->read() !== false) { |
|
675 | + while($dataReader->read() !== false) { |
|
676 | 676 | $tables[] = $table; |
677 | 677 | } |
678 | 678 | $con->Active = false; |
679 | - foreach ($tables as $key => $table) { |
|
679 | + foreach($tables as $key => $table) { |
|
680 | 680 | $output = $args[1] . "." . $this->_prefix . ucfirst($table) . $this->_postfix; |
681 | - if ($config !== false && $output !== false) { |
|
681 | + if($config !== false && $output !== false) { |
|
682 | 682 | $this->generate("generate " . $table . " " . $output . " " . $this->_soap . " " . $this->_overwrite); |
683 | 683 | } |
684 | 684 | } |
@@ -694,9 +694,9 @@ discard block |
||
694 | 694 | $app_dir = '.'; |
695 | 695 | if(Prado::getApplication() !== null) |
696 | 696 | $app_dir = dirname(Prado::getApplication()->getBasePath()); |
697 | - $args = [$input[0],$input[1], $input[2],$app_dir]; |
|
697 | + $args = [$input[0], $input[1], $input[2], $app_dir]; |
|
698 | 698 | if(count($input) > 3) |
699 | - $args = [$input[0],$input[1], $input[2],$app_dir,'soap']; |
|
699 | + $args = [$input[0], $input[1], $input[2], $app_dir, 'soap']; |
|
700 | 700 | $cmd = new PradoCommandLineActiveRecordGen; |
701 | 701 | $cmd->performAction($args); |
702 | 702 | } |
@@ -707,30 +707,30 @@ discard block |
||
707 | 707 | } |
708 | 708 | |
709 | 709 | protected function getAppDir($dir = ".") { |
710 | - if (is_dir($dir)) |
|
710 | + if(is_dir($dir)) |
|
711 | 711 | return realpath($dir); |
712 | - if (false !== ($app_dir = realpath($dir . '/protected/')) && is_dir($app_dir)) |
|
712 | + if(false !== ($app_dir = realpath($dir . '/protected/')) && is_dir($app_dir)) |
|
713 | 713 | return $app_dir; |
714 | 714 | echo '** Unable to find directory "' . $dir . "\".\n"; |
715 | 715 | return false; |
716 | 716 | } |
717 | 717 | |
718 | 718 | protected function getXmlFile($app_dir) { |
719 | - if (false !== ($xml = realpath($app_dir . '/application.xml')) && is_file($xml)) |
|
719 | + if(false !== ($xml = realpath($app_dir . '/application.xml')) && is_file($xml)) |
|
720 | 720 | return $xml; |
721 | - if (false !== ($xml = realpath($app_dir . '/protected/application.xml')) && is_file($xml)) |
|
721 | + if(false !== ($xml = realpath($app_dir . '/protected/application.xml')) && is_file($xml)) |
|
722 | 722 | return $xml; |
723 | 723 | echo '** Unable to find application.xml in ' . $app_dir . "\n"; |
724 | 724 | return false; |
725 | 725 | } |
726 | 726 | |
727 | 727 | protected function getActiveRecordConfig($app_dir) { |
728 | - if (false === ($xml = $this->getXmlFile($app_dir))) |
|
728 | + if(false === ($xml = $this->getXmlFile($app_dir))) |
|
729 | 729 | return false; |
730 | - if (false !== ($app = $this->initializePradoApplication($app_dir))) { |
|
730 | + if(false !== ($app = $this->initializePradoApplication($app_dir))) { |
|
731 | 731 | Prado::using('System.Data.ActiveRecord.TActiveRecordConfig'); |
732 | - foreach ($app->getModules() as $module) |
|
733 | - if ($module instanceof TActiveRecordConfig) |
|
732 | + foreach($app->getModules() as $module) |
|
733 | + if($module instanceof TActiveRecordConfig) |
|
734 | 734 | return $module; |
735 | 735 | echo '** Unable to find TActiveRecordConfig module in ' . $xml . "\n"; |
736 | 736 | } |
@@ -738,11 +738,11 @@ discard block |
||
738 | 738 | } |
739 | 739 | |
740 | 740 | protected function getOutputFile($app_dir, $namespace) { |
741 | - if (is_file($namespace) && strpos($namespace, $app_dir) === 0) |
|
741 | + if(is_file($namespace) && strpos($namespace, $app_dir) === 0) |
|
742 | 742 | return $namespace; |
743 | 743 | $file = Prado::getPathOfNamespace($namespace, ""); |
744 | - if ($file !== null && false !== ($path = realpath(dirname($file))) && is_dir($path)) { |
|
745 | - if (strpos($path, $app_dir) === 0) |
|
744 | + if($file !== null && false !== ($path = realpath(dirname($file))) && is_dir($path)) { |
|
745 | + if(strpos($path, $app_dir) === 0) |
|
746 | 746 | return $file; |
747 | 747 | } |
748 | 748 | echo '** Output file ' . $file . ' must be within directory ' . $app_dir . "\n"; |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | {$this->action} {$parameters}{$optional} |
187 | 187 | {$description} |
188 | 188 | |
189 | -EOD; |
|
189 | +eod; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | protected function initializePradoApplication($directory) |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | </parameters> |
345 | 345 | --> |
346 | 346 | </application> |
347 | -EOD; |
|
347 | +eod; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | protected function renderHtaccessFile() |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | <h1>Welcome to PRADO!</h1> |
365 | 365 | </body> |
366 | 366 | </html> |
367 | -EOD; |
|
367 | +eod; |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | * @soapproperty |
586 | 586 | */ |
587 | 587 | |
588 | -EOD; |
|
588 | +eod; |
|
589 | 589 | } |
590 | 590 | $prop .= "\tpublic $name;"; |
591 | 591 | return $prop; |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | } |
613 | 613 | } |
614 | 614 | |
615 | -EOD; |
|
615 | +eod; |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | // <editor-fold defaultstate="collapsed" desc="Page Generation"> |
50 | 50 | public function generate($tableName, $viewType) |
51 | 51 | { |
52 | - switch ($viewType) |
|
52 | + switch($viewType) |
|
53 | 53 | { |
54 | 54 | default: |
55 | 55 | case self::LIST_TYPE: |
@@ -90,21 +90,21 @@ discard block |
||
90 | 90 | { |
91 | 91 | $code = ""; |
92 | 92 | $tableInfo = $this->_dbMetaData->getTableInfo($tableName); |
93 | - switch ($type) |
|
93 | + switch($type) |
|
94 | 94 | { |
95 | 95 | case self::LIST_TYPE: |
96 | 96 | break; |
97 | 97 | case self::ADD_TYPE: |
98 | - foreach ($tableInfo->getColumns() as $colField => $colMetadata) |
|
98 | + foreach($tableInfo->getColumns() as $colField => $colMetadata) |
|
99 | 99 | { |
100 | - if (!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey) |
|
100 | + if(!$colMetadata->IsPrimaryKey && !$colMetadata->IsForeignKey) |
|
101 | 101 | { |
102 | 102 | $code .= $this->generateControl($colMetadata); |
103 | 103 | $code .= $this->generateValidators($colMetadata); |
104 | 104 | $code .= "\n"; |
105 | 105 | } |
106 | 106 | } |
107 | - foreach ($tableInfo->getForeignKeys() as $colField => $colMetadata) |
|
107 | + foreach($tableInfo->getForeignKeys() as $colField => $colMetadata) |
|
108 | 108 | { |
109 | 109 | $colField = $this->eq($colMetadata["table"]); |
110 | 110 | $code .= "\t<com:TTextBox ID=$colField />\n"; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | private function generateControl($colMetadata) |
123 | 123 | { |
124 | 124 | $controlType = "TTextBox"; |
125 | - switch ($colMetadata->DbType) |
|
125 | + switch($colMetadata->DbType) |
|
126 | 126 | { |
127 | 127 | |
128 | 128 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | $controlId = $colMetadata->ColumnId; |
136 | 136 | $code = ""; |
137 | - if (!$colMetadata->AllowNull) |
|
137 | + if(!$colMetadata->AllowNull) |
|
138 | 138 | { |
139 | 139 | $code .= "\t<com:TRequiredFieldValidator ControlToValidate=$controlId ValidationGroup=\"addGroup\" Text=\"Field $controlId is required.\" Display=\"Dynamic\" />\n"; |
140 | 140 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $pageContent |
84 | 84 | |
85 | 85 | </com:TContent> |
86 | -EOD; |
|
86 | +eod; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | private function getPageContent($tableName, $type) |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | |
160 | 160 | } |
161 | -EOD; |
|
161 | +eod; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // </editor-fold> |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public function __construct() |
35 | 35 | { |
36 | - if (!class_exists("TActiveRecordManager", false)) |
|
36 | + if(!class_exists("TActiveRecordManager", false)) |
|
37 | 37 | throw new Exception("You need to enable the ActiveRecord module in your application configuration file."); |
38 | 38 | $ar_manager = TActiveRecordManager::getInstance(); |
39 | 39 | $_conn = $ar_manager->getDbConnection(); |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | public function setOpFile($op_file_namespace) |
45 | 45 | { |
46 | 46 | $op_file = Prado::getPathOfNamespace($op_file_namespace); |
47 | - if (empty($op_file)) |
|
47 | + if(empty($op_file)) |
|
48 | 48 | throw new Exception("You need to fix your output folder namespace."); |
49 | - if (!is_dir($op_file)) |
|
49 | + if(!is_dir($op_file)) |
|
50 | 50 | mkdir($op_file, 0777, true); |
51 | 51 | $this->_opFile = $op_file; |
52 | 52 | } |
53 | 53 | |
54 | 54 | public function renderAllTablesInformation() |
55 | 55 | { |
56 | - foreach ($this->getAllTableNames() as $table_name) |
|
56 | + foreach($this->getAllTableNames() as $table_name) |
|
57 | 57 | { |
58 | 58 | echo $table_name . "<br>"; |
59 | 59 | $tableInfo = $this->_dbMetaData->getTableInfo($table_name); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $tableNames = $this->_dbMetaData->findTableNames(); |
70 | 70 | $index = array_search('pradocache', $tableNames); |
71 | - if ($index) |
|
71 | + if($index) |
|
72 | 72 | array_splice($tableNames, $index, 1); |
73 | 73 | return $tableNames; |
74 | 74 | } |