@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | private function _commonGenerate($tableName, $tableInfo) |
| 138 | 138 | { |
| 139 | 139 | if (count($tableInfo->getColumns()) === 0) |
| 140 | - throw new Exception("Unable to find table or view $tableName in " . $this->_dbMetaData->getDbConnection()->getConnectionString() . "."); |
|
| 140 | + throw new Exception("Unable to find table or view $tableName in ".$this->_dbMetaData->getDbConnection()->getConnectionString()."."); |
|
| 141 | 141 | else |
| 142 | 142 | { |
| 143 | 143 | $properties = []; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $clasName = $this->_getProperClassName($tableName); |
| 150 | 150 | $class = $this->generateClass($properties, $tableName, $clasName, $toString); |
| 151 | - $output = $this->_opFile . DIRECTORY_SEPARATOR . $clasName . ".php"; |
|
| 151 | + $output = $this->_opFile.DIRECTORY_SEPARATOR.$clasName.".php"; |
|
| 152 | 152 | file_put_contents($output, $class); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | { |
| 157 | 157 | $table_name_words = str_replace("_", " ", strtolower($tableName)); |
| 158 | 158 | $final_conversion = str_replace(" ", "", ucwords($table_name_words)); |
| 159 | - return $this->_clasPrefix . $final_conversion . $this->_classSufix; |
|
| 159 | + return $this->_clasPrefix.$final_conversion.$this->_classSufix; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | //----------------------------------------------------------------------------- |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | protected function generateProperty($field, $metadata) |
| 165 | 165 | { |
| 166 | 166 | $prop = ''; |
| 167 | - $name = '$' . $field; |
|
| 167 | + $name = '$'.$field; |
|
| 168 | 168 | |
| 169 | 169 | /* TODO use in version 2.0 */ |
| 170 | 170 | // $type = $column->getPHPType(); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | $code = "\tpublic static \$RELATIONS = array ("; |
| 182 | 182 | foreach ($this->_relations[$tablename] as $rel_data) |
| 183 | - $code .= "\n\t\t'" . $rel_data["prop_name"] . "' => array(" . $rel_data["rel_type"] . ", '" . $rel_data["ref_class_name"] . "', '" . $rel_data["prop_ref"] . "'),"; |
|
| 183 | + $code .= "\n\t\t'".$rel_data["prop_name"]."' => array(".$rel_data["rel_type"].", '".$rel_data["ref_class_name"]."', '".$rel_data["prop_ref"]."'),"; |
|
| 184 | 184 | |
| 185 | 185 | $code = substr($code, 0, -1); |
| 186 | 186 | $code .= "\n\t);"; |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | { |
| 59 | 59 | $id = "cb_$tableName"; |
| 60 | 60 | $obj = $this->tableNames->findControl($id); |
| 61 | - if($obj !== null && $obj->Checked) |
|
| 61 | + if ($obj !== null && $obj->Checked) |
|
| 62 | 62 | { |
| 63 | 63 | $scf_generator->generateCRUD($tableName); |
| 64 | 64 | } |
@@ -53,23 +53,23 @@ |
||
| 53 | 53 | { |
| 54 | 54 | default: |
| 55 | 55 | case self::LIST_TYPE: |
| 56 | - $unitName = "list" . ucfirst($tableName); |
|
| 56 | + $unitName = "list".ucfirst($tableName); |
|
| 57 | 57 | break; |
| 58 | 58 | |
| 59 | 59 | case self::ADD_TYPE: |
| 60 | - $unitName = "add" . ucfirst($tableName); |
|
| 60 | + $unitName = "add".ucfirst($tableName); |
|
| 61 | 61 | break; |
| 62 | 62 | |
| 63 | 63 | case self::SHOW_TYPE: |
| 64 | - $unitName = "show" . ucfirst($tableName); |
|
| 64 | + $unitName = "show".ucfirst($tableName); |
|
| 65 | 65 | break; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $class = $this->generateClass($unitName); |
| 69 | - $outputClass = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".php"; |
|
| 69 | + $outputClass = $this->_opFile.DIRECTORY_SEPARATOR.$unitName.".php"; |
|
| 70 | 70 | file_put_contents($outputClass, $class); |
| 71 | 71 | |
| 72 | - $outputPage = $this->_opFile . DIRECTORY_SEPARATOR . $unitName . ".page"; |
|
| 72 | + $outputPage = $this->_opFile.DIRECTORY_SEPARATOR.$unitName.".page"; |
|
| 73 | 73 | $page = $this->generatePage($tableName, $viewType); |
| 74 | 74 | file_put_contents($outputPage, $page); |
| 75 | 75 | } |
@@ -98,10 +98,10 @@ |
||
| 98 | 98 | */ |
| 99 | 99 | public function publishAsset($assetPath, $className = null) |
| 100 | 100 | { |
| 101 | - if($className === null) |
|
| 101 | + if ($className === null) |
|
| 102 | 102 | $className = get_class($this); |
| 103 | 103 | $class = new \ReflectionClass($className); |
| 104 | - $fullPath = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . $assetPath; |
|
| 104 | + $fullPath = dirname($class->getFileName()).DIRECTORY_SEPARATOR.$assetPath; |
|
| 105 | 105 | return $this->publishFilePath($fullPath); |
| 106 | 106 | } |
| 107 | 107 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | public function loadFromFile($fname) |
| 68 | 68 | { |
| 69 | - if(Prado::getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
| 69 | + if (Prado::getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
| 70 | 70 | { |
| 71 | 71 | $fcontent = include $fname; |
| 72 | 72 | $this->loadFromPhp($fcontent, dirname($fname)); |
@@ -95,28 +95,28 @@ discard block |
||
| 95 | 95 | public function loadFromPhp($config, $configPath) |
| 96 | 96 | { |
| 97 | 97 | // application properties |
| 98 | - if(isset($config['application'])) |
|
| 98 | + if (isset($config['application'])) |
|
| 99 | 99 | { |
| 100 | - foreach($config['application'] as $name => $value) |
|
| 100 | + foreach ($config['application'] as $name => $value) |
|
| 101 | 101 | { |
| 102 | 102 | $this->_properties[$name] = $value; |
| 103 | 103 | } |
| 104 | 104 | $this->_empty = false; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if(isset($config['paths']) && is_array($config['paths'])) |
|
| 107 | + if (isset($config['paths']) && is_array($config['paths'])) |
|
| 108 | 108 | $this->loadPathsPhp($config['paths'], $configPath); |
| 109 | 109 | |
| 110 | - if(isset($config['modules']) && is_array($config['modules'])) |
|
| 110 | + if (isset($config['modules']) && is_array($config['modules'])) |
|
| 111 | 111 | $this->loadModulesPhp($config['modules'], $configPath); |
| 112 | 112 | |
| 113 | - if(isset($config['services']) && is_array($config['services'])) |
|
| 113 | + if (isset($config['services']) && is_array($config['services'])) |
|
| 114 | 114 | $this->loadServicesPhp($config['services'], $configPath); |
| 115 | 115 | |
| 116 | - if(isset($config['parameters']) && is_array($config['parameters'])) |
|
| 116 | + if (isset($config['parameters']) && is_array($config['parameters'])) |
|
| 117 | 117 | $this->loadParametersPhp($config['parameters'], $configPath); |
| 118 | 118 | |
| 119 | - if(isset($config['includes']) && is_array($config['includes'])) |
|
| 119 | + if (isset($config['includes']) && is_array($config['includes'])) |
|
| 120 | 120 | $this->loadExternalXml($config['includes'], $configPath); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -128,15 +128,15 @@ discard block |
||
| 128 | 128 | public function loadFromXml($dom, $configPath) |
| 129 | 129 | { |
| 130 | 130 | // application properties |
| 131 | - foreach($dom->getAttributes() as $name => $value) |
|
| 131 | + foreach ($dom->getAttributes() as $name => $value) |
|
| 132 | 132 | { |
| 133 | 133 | $this->_properties[$name] = $value; |
| 134 | 134 | $this->_empty = false; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - foreach($dom->getElements() as $element) |
|
| 137 | + foreach ($dom->getElements() as $element) |
|
| 138 | 138 | { |
| 139 | - switch($element->getTagName()) |
|
| 139 | + switch ($element->getTagName()) |
|
| 140 | 140 | { |
| 141 | 141 | case 'paths': |
| 142 | 142 | $this->loadPathsXml($element, $configPath); |
@@ -167,26 +167,26 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | protected function loadPathsPhp($pathsNode, $configPath) |
| 169 | 169 | { |
| 170 | - if(isset($pathsNode['aliases']) && is_array($pathsNode['aliases'])) |
|
| 170 | + if (isset($pathsNode['aliases']) && is_array($pathsNode['aliases'])) |
|
| 171 | 171 | { |
| 172 | - foreach($pathsNode['aliases'] as $id => $path) |
|
| 172 | + foreach ($pathsNode['aliases'] as $id => $path) |
|
| 173 | 173 | { |
| 174 | 174 | $path = str_replace('\\', '/', $path); |
| 175 | - if(preg_match('/^\\/|.:\\/|.:\\\\/', $path)) // if absolute path |
|
| 175 | + if (preg_match('/^\\/|.:\\/|.:\\\\/', $path)) // if absolute path |
|
| 176 | 176 | $p = realpath($path); |
| 177 | 177 | else |
| 178 | - $p = realpath($configPath . DIRECTORY_SEPARATOR . $path); |
|
| 179 | - if($p === false || !is_dir($p)) |
|
| 178 | + $p = realpath($configPath.DIRECTORY_SEPARATOR.$path); |
|
| 179 | + if ($p === false || !is_dir($p)) |
|
| 180 | 180 | throw new TConfigurationException('appconfig_aliaspath_invalid', $id, $path); |
| 181 | - if(isset($this->_aliases[$id])) |
|
| 181 | + if (isset($this->_aliases[$id])) |
|
| 182 | 182 | throw new TConfigurationException('appconfig_alias_redefined', $id); |
| 183 | 183 | $this->_aliases[$id] = $p; |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if(isset($pathsNode['using']) && is_array($pathsNode['using'])) |
|
| 187 | + if (isset($pathsNode['using']) && is_array($pathsNode['using'])) |
|
| 188 | 188 | { |
| 189 | - foreach($pathsNode['using'] as $namespace) |
|
| 189 | + foreach ($pathsNode['using'] as $namespace) |
|
| 190 | 190 | { |
| 191 | 191 | $this->_usings[] = $namespace; |
| 192 | 192 | } |
@@ -200,22 +200,22 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | protected function loadPathsXml($pathsNode, $configPath) |
| 202 | 202 | { |
| 203 | - foreach($pathsNode->getElements() as $element) |
|
| 203 | + foreach ($pathsNode->getElements() as $element) |
|
| 204 | 204 | { |
| 205 | - switch($element->getTagName()) |
|
| 205 | + switch ($element->getTagName()) |
|
| 206 | 206 | { |
| 207 | 207 | case 'alias': |
| 208 | 208 | { |
| 209 | - if(($id = $element->getAttribute('id')) !== null && ($path = $element->getAttribute('path')) !== null) |
|
| 209 | + if (($id = $element->getAttribute('id')) !== null && ($path = $element->getAttribute('path')) !== null) |
|
| 210 | 210 | { |
| 211 | 211 | $path = str_replace('\\', '/', $path); |
| 212 | - if(preg_match('/^\\/|.:\\/|.:\\\\/', $path)) // if absolute path |
|
| 212 | + if (preg_match('/^\\/|.:\\/|.:\\\\/', $path)) // if absolute path |
|
| 213 | 213 | $p = realpath($path); |
| 214 | 214 | else |
| 215 | - $p = realpath($configPath . DIRECTORY_SEPARATOR . $path); |
|
| 216 | - if($p === false || !is_dir($p)) |
|
| 215 | + $p = realpath($configPath.DIRECTORY_SEPARATOR.$path); |
|
| 216 | + if ($p === false || !is_dir($p)) |
|
| 217 | 217 | throw new TConfigurationException('appconfig_aliaspath_invalid', $id, $path); |
| 218 | - if(isset($this->_aliases[$id])) |
|
| 218 | + if (isset($this->_aliases[$id])) |
|
| 219 | 219 | throw new TConfigurationException('appconfig_alias_redefined', $id); |
| 220 | 220 | $this->_aliases[$id] = $p; |
| 221 | 221 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | case 'using': |
| 228 | 228 | { |
| 229 | - if(($namespace = $element->getAttribute('namespace')) !== null) |
|
| 229 | + if (($namespace = $element->getAttribute('namespace')) !== null) |
|
| 230 | 230 | $this->_usings[] = $namespace; |
| 231 | 231 | else |
| 232 | 232 | throw new TConfigurationException('appconfig_using_invalid'); |
@@ -246,20 +246,20 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | protected function loadModulesPhp($modulesNode, $configPath) |
| 248 | 248 | { |
| 249 | - foreach($modulesNode as $id => $module) |
|
| 249 | + foreach ($modulesNode as $id => $module) |
|
| 250 | 250 | { |
| 251 | - if(!isset($module['class'])) |
|
| 251 | + if (!isset($module['class'])) |
|
| 252 | 252 | throw new TConfigurationException('appconfig_moduletype_required', $id); |
| 253 | 253 | $type = $module['class']; |
| 254 | 254 | unset($module['class']); |
| 255 | 255 | $properties = []; |
| 256 | - if(isset($module['properties'])) |
|
| 256 | + if (isset($module['properties'])) |
|
| 257 | 257 | { |
| 258 | 258 | $properties = $module['properties']; |
| 259 | 259 | unset($module['properties']); |
| 260 | 260 | } |
| 261 | 261 | $properties['id'] = $id; |
| 262 | - $this->_modules[$id] = [$type,$properties,$module]; |
|
| 262 | + $this->_modules[$id] = [$type, $properties, $module]; |
|
| 263 | 263 | $this->_empty = false; |
| 264 | 264 | } |
| 265 | 265 | } |
@@ -271,20 +271,20 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | protected function loadModulesXml($modulesNode, $configPath) |
| 273 | 273 | { |
| 274 | - foreach($modulesNode->getElements() as $element) |
|
| 274 | + foreach ($modulesNode->getElements() as $element) |
|
| 275 | 275 | { |
| 276 | - if($element->getTagName() === 'module') |
|
| 276 | + if ($element->getTagName() === 'module') |
|
| 277 | 277 | { |
| 278 | 278 | $properties = $element->getAttributes(); |
| 279 | 279 | $id = $properties->itemAt('id'); |
| 280 | 280 | $type = $properties->remove('class'); |
| 281 | - if($type === null) |
|
| 281 | + if ($type === null) |
|
| 282 | 282 | throw new TConfigurationException('appconfig_moduletype_required', $id); |
| 283 | 283 | $element->setParent(null); |
| 284 | - if($id === null) |
|
| 285 | - $this->_modules[] = [$type,$properties->toArray(),$element]; |
|
| 284 | + if ($id === null) |
|
| 285 | + $this->_modules[] = [$type, $properties->toArray(), $element]; |
|
| 286 | 286 | else |
| 287 | - $this->_modules[$id] = [$type,$properties->toArray(),$element]; |
|
| 287 | + $this->_modules[$id] = [$type, $properties->toArray(), $element]; |
|
| 288 | 288 | $this->_empty = false; |
| 289 | 289 | } |
| 290 | 290 | else |
@@ -299,15 +299,15 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | protected function loadServicesPhp($servicesNode, $configPath) |
| 301 | 301 | { |
| 302 | - foreach($servicesNode as $id => $service) |
|
| 302 | + foreach ($servicesNode as $id => $service) |
|
| 303 | 303 | { |
| 304 | - if(!isset($service['class'])) |
|
| 304 | + if (!isset($service['class'])) |
|
| 305 | 305 | throw new TConfigurationException('appconfig_servicetype_required'); |
| 306 | 306 | $type = $service['class']; |
| 307 | 307 | $properties = isset($service['properties']) ? $service['properties'] : []; |
| 308 | 308 | unset($service['properties']); |
| 309 | 309 | $properties['id'] = $id; |
| 310 | - $this->_services[$id] = [$type,$properties,$service]; |
|
| 310 | + $this->_services[$id] = [$type, $properties, $service]; |
|
| 311 | 311 | $this->_empty = false; |
| 312 | 312 | } |
| 313 | 313 | } |
@@ -319,17 +319,17 @@ discard block |
||
| 319 | 319 | */ |
| 320 | 320 | protected function loadServicesXml($servicesNode, $configPath) |
| 321 | 321 | { |
| 322 | - foreach($servicesNode->getElements() as $element) |
|
| 322 | + foreach ($servicesNode->getElements() as $element) |
|
| 323 | 323 | { |
| 324 | - if($element->getTagName() === 'service') |
|
| 324 | + if ($element->getTagName() === 'service') |
|
| 325 | 325 | { |
| 326 | 326 | $properties = $element->getAttributes(); |
| 327 | - if(($id = $properties->itemAt('id')) === null) |
|
| 327 | + if (($id = $properties->itemAt('id')) === null) |
|
| 328 | 328 | throw new TConfigurationException('appconfig_serviceid_required'); |
| 329 | - if(($type = $properties->remove('class')) === null) |
|
| 329 | + if (($type = $properties->remove('class')) === null) |
|
| 330 | 330 | throw new TConfigurationException('appconfig_servicetype_required', $id); |
| 331 | 331 | $element->setParent(null); |
| 332 | - $this->_services[$id] = [$type,$properties->toArray(),$element]; |
|
| 332 | + $this->_services[$id] = [$type, $properties->toArray(), $element]; |
|
| 333 | 333 | $this->_empty = false; |
| 334 | 334 | } |
| 335 | 335 | else |
@@ -344,17 +344,17 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | protected function loadParametersPhp($parametersNode, $configPath) |
| 346 | 346 | { |
| 347 | - foreach($parametersNode as $id => $parameter) |
|
| 347 | + foreach ($parametersNode as $id => $parameter) |
|
| 348 | 348 | { |
| 349 | - if(is_array($parameter)) |
|
| 349 | + if (is_array($parameter)) |
|
| 350 | 350 | { |
| 351 | - if(isset($parameter['class'])) |
|
| 351 | + if (isset($parameter['class'])) |
|
| 352 | 352 | { |
| 353 | 353 | $type = $parameter['class']; |
| 354 | 354 | unset($parameter['class']); |
| 355 | 355 | $properties = isset($service['properties']) ? $service['properties'] : []; |
| 356 | 356 | $properties['id'] = $id; |
| 357 | - $this->_parameters[$id] = [$type,$properties]; |
|
| 357 | + $this->_parameters[$id] = [$type, $properties]; |
|
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | else |
@@ -371,22 +371,22 @@ discard block |
||
| 371 | 371 | */ |
| 372 | 372 | protected function loadParametersXml($parametersNode, $configPath) |
| 373 | 373 | { |
| 374 | - foreach($parametersNode->getElements() as $element) |
|
| 374 | + foreach ($parametersNode->getElements() as $element) |
|
| 375 | 375 | { |
| 376 | - if($element->getTagName() === 'parameter') |
|
| 376 | + if ($element->getTagName() === 'parameter') |
|
| 377 | 377 | { |
| 378 | 378 | $properties = $element->getAttributes(); |
| 379 | - if(($id = $properties->remove('id')) === null) |
|
| 379 | + if (($id = $properties->remove('id')) === null) |
|
| 380 | 380 | throw new TConfigurationException('appconfig_parameterid_required'); |
| 381 | - if(($type = $properties->remove('class')) === null) |
|
| 381 | + if (($type = $properties->remove('class')) === null) |
|
| 382 | 382 | { |
| 383 | - if(($value = $properties->remove('value')) === null) |
|
| 383 | + if (($value = $properties->remove('value')) === null) |
|
| 384 | 384 | $this->_parameters[$id] = $element; |
| 385 | 385 | else |
| 386 | 386 | $this->_parameters[$id] = $value; |
| 387 | 387 | } |
| 388 | 388 | else |
| 389 | - $this->_parameters[$id] = [$type,$properties->toArray()]; |
|
| 389 | + $this->_parameters[$id] = [$type, $properties->toArray()]; |
|
| 390 | 390 | $this->_empty = false; |
| 391 | 391 | } |
| 392 | 392 | else |
@@ -401,14 +401,14 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | protected function loadExternalPhp($includeNode, $configPath) |
| 403 | 403 | { |
| 404 | - foreach($includeNode as $include) |
|
| 404 | + foreach ($includeNode as $include) |
|
| 405 | 405 | { |
| 406 | - $when = isset($include['when'])?true:false; |
|
| 407 | - if(!isset($include['file'])) |
|
| 406 | + $when = isset($include['when']) ?true:false; |
|
| 407 | + if (!isset($include['file'])) |
|
| 408 | 408 | throw new TConfigurationException('appconfig_includefile_required'); |
| 409 | 409 | $filePath = $include['file']; |
| 410 | - if(isset($this->_includes[$filePath])) |
|
| 411 | - $this->_includes[$filePath] = '(' . $this->_includes[$filePath] . ') || (' . $when . ')'; |
|
| 410 | + if (isset($this->_includes[$filePath])) |
|
| 411 | + $this->_includes[$filePath] = '('.$this->_includes[$filePath].') || ('.$when.')'; |
|
| 412 | 412 | else |
| 413 | 413 | $$this->_includes[$filePath] = $when; |
| 414 | 414 | $this->_empty = false; |
@@ -422,12 +422,12 @@ discard block |
||
| 422 | 422 | */ |
| 423 | 423 | protected function loadExternalXml($includeNode, $configPath) |
| 424 | 424 | { |
| 425 | - if(($when = $includeNode->getAttribute('when')) === null) |
|
| 425 | + if (($when = $includeNode->getAttribute('when')) === null) |
|
| 426 | 426 | $when = true; |
| 427 | - if(($filePath = $includeNode->getAttribute('file')) === null) |
|
| 427 | + if (($filePath = $includeNode->getAttribute('file')) === null) |
|
| 428 | 428 | throw new TConfigurationException('appconfig_includefile_required'); |
| 429 | - if(isset($this->_includes[$filePath])) |
|
| 430 | - $this->_includes[$filePath] = '(' . $this->_includes[$filePath] . ') || (' . $when . ')'; |
|
| 429 | + if (isset($this->_includes[$filePath])) |
|
| 430 | + $this->_includes[$filePath] = '('.$this->_includes[$filePath].') || ('.$when.')'; |
|
| 431 | 431 | else |
| 432 | 432 | $this->_includes[$filePath] = $when; |
| 433 | 433 | $this->_empty = false; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function current() |
| 71 | 71 | { |
| 72 | - return isset($_SESSION[$this->_key])?$_SESSION[$this->_key]:null; |
|
| 72 | + return isset($_SESSION[$this->_key]) ? $_SESSION[$this->_key] : null; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | $this->_key = next($this->_keys); |
| 84 | 84 | } |
| 85 | - while(!isset($_SESSION[$this->_key]) && $this->_key !== false); |
|
| 85 | + while (!isset($_SESSION[$this->_key]) && $this->_key !== false); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -73,19 +73,19 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function init($config) |
| 75 | 75 | { |
| 76 | - if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
| 76 | + if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
| 77 | 77 | { |
| 78 | - if(is_array($config)) |
|
| 78 | + if (is_array($config)) |
|
| 79 | 79 | { |
| 80 | - foreach($config as $id => $feed) |
|
| 80 | + foreach ($config as $id => $feed) |
|
| 81 | 81 | $this->_feeds[$id] = $feed; |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | else |
| 85 | 85 | { |
| 86 | - foreach($config->getElementsByTagName('feed') as $feed) |
|
| 86 | + foreach ($config->getElementsByTagName('feed') as $feed) |
|
| 87 | 87 | { |
| 88 | - if(($id = $feed->getAttributes()->remove('id')) !== null) |
|
| 88 | + if (($id = $feed->getAttributes()->remove('id')) !== null) |
|
| 89 | 89 | $this->_feeds[$id] = $feed; |
| 90 | 90 | else |
| 91 | 91 | throw new TConfigurationException('feedservice_id_required'); |
@@ -108,18 +108,18 @@ discard block |
||
| 108 | 108 | public function run() |
| 109 | 109 | { |
| 110 | 110 | $id = $this->getRequest()->getServiceParameter(); |
| 111 | - if(isset($this->_feeds[$id])) |
|
| 111 | + if (isset($this->_feeds[$id])) |
|
| 112 | 112 | { |
| 113 | 113 | $feedConfig = $this->_feeds[$id]; |
| 114 | 114 | $properties = []; |
| 115 | 115 | $feed = null; |
| 116 | - if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
| 116 | + if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
| 117 | 117 | { |
| 118 | - if(isset($feedConfig['class'])) |
|
| 118 | + if (isset($feedConfig['class'])) |
|
| 119 | 119 | { |
| 120 | 120 | $feed = Prado::createComponent($feedConfig['class']); |
| 121 | - if($service instanceof IFeedContentProvider) |
|
| 122 | - $properties = isset($feedConfig['properties'])?$feedConfig['properties']:[]; |
|
| 121 | + if ($service instanceof IFeedContentProvider) |
|
| 122 | + $properties = isset($feedConfig['properties']) ? $feedConfig['properties'] : []; |
|
| 123 | 123 | else |
| 124 | 124 | throw new TConfigurationException('jsonservice_response_type_invalid', $id); |
| 125 | 125 | } |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | else |
| 130 | 130 | { |
| 131 | 131 | $properties = $feedConfig->getAttributes(); |
| 132 | - if(($class = $properties->remove('class')) !== null) |
|
| 132 | + if (($class = $properties->remove('class')) !== null) |
|
| 133 | 133 | { |
| 134 | 134 | $feed = Prado::createComponent($class); |
| 135 | - if(!($feed instanceof IFeedContentProvider)) |
|
| 135 | + if (!($feed instanceof IFeedContentProvider)) |
|
| 136 | 136 | throw new TConfigurationException('feedservice_feedtype_invalid', $id); |
| 137 | 137 | } |
| 138 | 138 | else |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // init feed properties |
| 143 | - foreach($properties as $name => $value) |
|
| 143 | + foreach ($properties as $name => $value) |
|
| 144 | 144 | $feed->setSubproperty($name, $value); |
| 145 | 145 | $feed->init($feedConfig); |
| 146 | 146 | |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | { |
| 64 | 64 | $this->rpcServer = $rpcServer; |
| 65 | 65 | |
| 66 | - foreach($this->registerMethods() as $_methodName => $_methodDetails) |
|
| 66 | + foreach ($this->registerMethods() as $_methodName => $_methodDetails) |
|
| 67 | 67 | $this->rpcServer->addRpcMethod($_methodName, $_methodDetails); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function init($config) |
| 121 | 121 | { |
| 122 | - if($this->_configFile !== null) |
|
| 122 | + if ($this->_configFile !== null) |
|
| 123 | 123 | { |
| 124 | - if(is_file($this->_configFile)) |
|
| 124 | + if (is_file($this->_configFile)) |
|
| 125 | 125 | { |
| 126 | 126 | $dom = new TXmlDocument; |
| 127 | 127 | $dom->loadFromFile($this->_configFile); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | protected function resolveRequest() |
| 146 | 146 | { |
| 147 | 147 | $serverID = $this->getRequest()->getServiceParameter(); |
| 148 | - if(($pos = strrpos($serverID, '.wsdl')) === strlen($serverID) - 5) |
|
| 148 | + if (($pos = strrpos($serverID, '.wsdl')) === strlen($serverID) - 5) |
|
| 149 | 149 | { |
| 150 | 150 | $serverID = substr($serverID, 0, $pos); |
| 151 | 151 | $this->_wsdlRequest = true; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | else |
| 154 | 154 | $this->_wsdlRequest = false; |
| 155 | 155 | $this->_serverID = $serverID; |
| 156 | - if(!isset($this->_servers[$serverID])) |
|
| 156 | + if (!isset($this->_servers[$serverID])) |
|
| 157 | 157 | throw new THttpException(400, 'soapservice_request_invalid', $serverID); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -164,14 +164,14 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | private function loadConfig($config) |
| 166 | 166 | { |
| 167 | - if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
| 167 | + if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) |
|
| 168 | 168 | { |
| 169 | - if(is_array($config)) |
|
| 169 | + if (is_array($config)) |
|
| 170 | 170 | { |
| 171 | - foreach($config['soap'] as $id => $server) |
|
| 171 | + foreach ($config['soap'] as $id => $server) |
|
| 172 | 172 | { |
| 173 | - $properties = isset($server['properties'])?$server['properties']:[]; |
|
| 174 | - if(isset($this->_servers[$id])) |
|
| 173 | + $properties = isset($server['properties']) ? $server['properties'] : []; |
|
| 174 | + if (isset($this->_servers[$id])) |
|
| 175 | 175 | throw new TConfigurationException('soapservice_serverid_duplicated', $id); |
| 176 | 176 | $this->_servers[$id] = $properties; |
| 177 | 177 | } |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | else |
| 181 | 181 | { |
| 182 | - foreach($config->getElementsByTagName('soap') as $serverXML) |
|
| 182 | + foreach ($config->getElementsByTagName('soap') as $serverXML) |
|
| 183 | 183 | { |
| 184 | 184 | $properties = $serverXML->getAttributes(); |
| 185 | - if(($id = $properties->remove('id')) === null) |
|
| 185 | + if (($id = $properties->remove('id')) === null) |
|
| 186 | 186 | throw new TConfigurationException('soapservice_serverid_required'); |
| 187 | - if(isset($this->_servers[$id])) |
|
| 187 | + if (isset($this->_servers[$id])) |
|
| 188 | 188 | throw new TConfigurationException('soapservice_serverid_duplicated', $id); |
| 189 | 189 | $this->_servers[$id] = $properties; |
| 190 | 190 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | public function setConfigFile($value) |
| 208 | 208 | { |
| 209 | - if(($this->_configFile = Prado::getPathOfNamespace($value, Prado::getApplication()->getConfigurationFileExt())) === null) |
|
| 209 | + if (($this->_configFile = Prado::getPathOfNamespace($value, Prado::getApplication()->getConfigurationFileExt())) === null) |
|
| 210 | 210 | throw new TConfigurationException('soapservice_configfile_invalid', $value); |
| 211 | 211 | } |
| 212 | 212 | |
@@ -249,19 +249,19 @@ discard block |
||
| 249 | 249 | { |
| 250 | 250 | $properties = $this->_servers[$this->_serverID]; |
| 251 | 251 | $serverClass = null; |
| 252 | - if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP && isset($config['class'])) |
|
| 252 | + if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP && isset($config['class'])) |
|
| 253 | 253 | $serverClass = $config['class']; |
| 254 | - elseif($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_XML) |
|
| 254 | + elseif ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_XML) |
|
| 255 | 255 | $serverClass = $properties->remove('class'); |
| 256 | - if($serverClass === null) |
|
| 256 | + if ($serverClass === null) |
|
| 257 | 257 | $serverClass = self::DEFAULT_SOAP_SERVER; |
| 258 | 258 | Prado::using($serverClass); |
| 259 | - $className = ($pos = strrpos($serverClass, '.')) !== false?substr($serverClass, $pos + 1):$serverClass; |
|
| 260 | - if($className !== self::DEFAULT_SOAP_SERVER && !is_subclass_of($className, self::DEFAULT_SOAP_SERVER)) |
|
| 259 | + $className = ($pos = strrpos($serverClass, '.')) !== false ?substr($serverClass, $pos + 1) : $serverClass; |
|
| 260 | + if ($className !== self::DEFAULT_SOAP_SERVER && !is_subclass_of($className, self::DEFAULT_SOAP_SERVER)) |
|
| 261 | 261 | throw new TConfigurationException('soapservice_server_invalid', $serverClass); |
| 262 | 262 | $server = new $className; |
| 263 | 263 | $server->setID($this->_serverID); |
| 264 | - foreach($properties as $name => $value) |
|
| 264 | + foreach ($properties as $name => $value) |
|
| 265 | 265 | $server->setSubproperty($name, $value); |
| 266 | 266 | return $server; |
| 267 | 267 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | $server = $this->createServer(); |
| 279 | 279 | $this->getResponse()->setContentType('text/xml'); |
| 280 | 280 | $this->getResponse()->setCharset($server->getEncoding()); |
| 281 | - if($this->getIsWsdlRequest()) |
|
| 281 | + if ($this->getIsWsdlRequest()) |
|
| 282 | 282 | { |
| 283 | 283 | // server WSDL file |
| 284 | 284 | Prado::trace("Generating WSDL", 'Prado\Web\Services\TSoapService'); |