@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | $this->_cache->add($key, $value); |
42 | 42 | $this->_keyList->add($key); |
43 | - if($this->_keyList->getCount() > $this->_cacheSize) |
|
43 | + if ($this->_keyList->getCount() > $this->_cacheSize) |
|
44 | 44 | { |
45 | 45 | $oldestKey = $this->_keyList->removeAt(0); |
46 | 46 | $this->_cache->remove($oldestKey); |
@@ -30,12 +30,12 @@ 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 | - if($args[$i] instanceof SimpleXMLElement) |
|
36 | - $tokens['{' . $i . '}'] = $this->implodeNode($args[$i]); |
|
35 | + if ($args[$i] instanceof SimpleXMLElement) |
|
36 | + $tokens['{'.$i.'}'] = $this->implodeNode($args[$i]); |
|
37 | 37 | else |
38 | - $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
|
38 | + $tokens['{'.$i.'}'] = TPropertyValue::ensureString($args[$i]); |
|
39 | 39 | } |
40 | 40 | parent::__construct(strtr($errorMessage, $tokens)); |
41 | 41 | } |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | protected function implodeNode($node) |
48 | 48 | { |
49 | 49 | $attributes = []; |
50 | - foreach($node->attributes() as $k => $v) |
|
51 | - $attributes[] = $k . '="' . (string)$v . '"'; |
|
52 | - return '<' . $node->getName() . ' ' . implode(' ', $attributes) . '>'; |
|
50 | + foreach ($node->attributes() as $k => $v) |
|
51 | + $attributes[] = $k.'="'.(string) $v.'"'; |
|
52 | + return '<'.$node->getName().' '.implode(' ', $attributes).'>'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | { |
60 | 60 | $lang = Prado::getPreferredLanguage(); |
61 | 61 | $dir = dirname(__FILE__); |
62 | - $msgFile = $dir . '/messages-' . $lang . '.txt'; |
|
63 | - if(!is_file($msgFile)) |
|
64 | - $msgFile = $dir . '/messages.txt'; |
|
62 | + $msgFile = $dir.'/messages-'.$lang.'.txt'; |
|
63 | + if (!is_file($msgFile)) |
|
64 | + $msgFile = $dir.'/messages.txt'; |
|
65 | 65 | return $msgFile; |
66 | 66 | } |
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -32,10 +32,11 @@ discard block |
||
32 | 32 | $tokens = []; |
33 | 33 | for($i = 0;$i < $n;++$i) |
34 | 34 | { |
35 | - if($args[$i] instanceof SimpleXMLElement) |
|
36 | - $tokens['{' . $i . '}'] = $this->implodeNode($args[$i]); |
|
37 | - else |
|
38 | - $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
|
35 | + if($args[$i] instanceof SimpleXMLElement) { |
|
36 | + $tokens['{' . $i . '}'] = $this->implodeNode($args[$i]); |
|
37 | + } else { |
|
38 | + $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
|
39 | + } |
|
39 | 40 | } |
40 | 41 | parent::__construct(strtr($errorMessage, $tokens)); |
41 | 42 | } |
@@ -47,8 +48,9 @@ discard block |
||
47 | 48 | protected function implodeNode($node) |
48 | 49 | { |
49 | 50 | $attributes = []; |
50 | - foreach($node->attributes() as $k => $v) |
|
51 | - $attributes[] = $k . '="' . (string)$v . '"'; |
|
51 | + foreach($node->attributes() as $k => $v) { |
|
52 | + $attributes[] = $k . '="' . (string)$v . '"'; |
|
53 | + } |
|
52 | 54 | return '<' . $node->getName() . ' ' . implode(' ', $attributes) . '>'; |
53 | 55 | } |
54 | 56 | |
@@ -60,8 +62,9 @@ discard block |
||
60 | 62 | $lang = Prado::getPreferredLanguage(); |
61 | 63 | $dir = dirname(__FILE__); |
62 | 64 | $msgFile = $dir . '/messages-' . $lang . '.txt'; |
63 | - if(!is_file($msgFile)) |
|
64 | - $msgFile = $dir . '/messages.txt'; |
|
65 | + if(!is_file($msgFile)) { |
|
66 | + $msgFile = $dir . '/messages.txt'; |
|
67 | + } |
|
65 | 68 | return $msgFile; |
66 | 69 | } |
67 | 70 | } |
68 | 71 | \ No newline at end of file |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | public function getType() |
52 | 52 | { |
53 | - if($this->_type === null) |
|
53 | + if ($this->_type === null) |
|
54 | 54 | return get_class($this); |
55 | 55 | else |
56 | 56 | return $this->_type; |
@@ -50,10 +50,11 @@ |
||
50 | 50 | |
51 | 51 | public function getType() |
52 | 52 | { |
53 | - if($this->_type === null) |
|
54 | - return get_class($this); |
|
55 | - else |
|
56 | - return $this->_type; |
|
53 | + if($this->_type === null) { |
|
54 | + return get_class($this); |
|
55 | + } else { |
|
56 | + return $this->_type; |
|
57 | + } |
|
57 | 58 | } |
58 | 59 | |
59 | 60 | public function setType($value) |
@@ -31,8 +31,8 @@ discard block |
||
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 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function getTypeHandler($class) |
44 | 44 | { |
45 | - if(isset($this->_typeHandlers[$class])) |
|
45 | + if (isset($this->_typeHandlers[$class])) |
|
46 | 46 | return $this->_typeHandlers[$class]; |
47 | 47 | } |
48 | 48 | |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function createInstanceOf($type = '') |
65 | 65 | { |
66 | - if(strlen($type) > 0) |
|
66 | + if (strlen($type) > 0) |
|
67 | 67 | { |
68 | - switch(strtolower($type)) |
|
68 | + switch (strtolower($type)) |
|
69 | 69 | { |
70 | 70 | case 'string': return ''; |
71 | 71 | case 'array': return []; |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | case 'bool': case 'boolean': return false; |
75 | 75 | } |
76 | 76 | |
77 | - if(class_exists('Prado', false)) |
|
77 | + if (class_exists('Prado', false)) |
|
78 | 78 | return Prado::createComponent($type); |
79 | - elseif(class_exists($type, false)) //NO auto loading |
|
79 | + elseif (class_exists($type, false)) //NO auto loading |
|
80 | 80 | return new $type; |
81 | 81 | else |
82 | 82 | throw new TSqlMapException('sqlmap_unable_to_find_class', $type); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function convertToType($type, $value) |
93 | 93 | { |
94 | - switch(strtolower($type)) |
|
94 | + switch (strtolower($type)) |
|
95 | 95 | { |
96 | 96 | case 'integer': case 'int': |
97 | 97 | $type = 'integer'; break; |
@@ -31,9 +31,10 @@ discard block |
||
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 | /** |
@@ -42,8 +43,9 @@ discard block |
||
42 | 43 | */ |
43 | 44 | public function getTypeHandler($class) |
44 | 45 | { |
45 | - if(isset($this->_typeHandlers[$class])) |
|
46 | - return $this->_typeHandlers[$class]; |
|
46 | + if(isset($this->_typeHandlers[$class])) { |
|
47 | + return $this->_typeHandlers[$class]; |
|
48 | + } |
|
47 | 49 | } |
48 | 50 | |
49 | 51 | /** |
@@ -74,12 +76,14 @@ discard block |
||
74 | 76 | case 'bool': case 'boolean': return false; |
75 | 77 | } |
76 | 78 | |
77 | - if(class_exists('Prado', false)) |
|
78 | - return Prado::createComponent($type); |
|
79 | - elseif(class_exists($type, false)) //NO auto loading |
|
79 | + if(class_exists('Prado', false)) { |
|
80 | + return Prado::createComponent($type); |
|
81 | + } elseif(class_exists($type, false)) { |
|
82 | + //NO auto loading |
|
80 | 83 | return new $type; |
81 | - else |
|
82 | - throw new TSqlMapException('sqlmap_unable_to_find_class', $type); |
|
84 | + } else { |
|
85 | + throw new TSqlMapException('sqlmap_unable_to_find_class', $type); |
|
86 | + } |
|
83 | 87 | } |
84 | 88 | } |
85 | 89 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $statement = $mappedStatement->getStatement(); |
60 | 60 | $registry = $mappedStatement->getManager()->getTypeHandlers(); |
61 | 61 | $list = $statement->createInstanceOfListClass($registry); |
62 | - if(!is_object($list)) |
|
62 | + if (!is_object($list)) |
|
63 | 63 | throw new TSqlMapExecutionException('sqlmap_invalid_lazyload_list', $statement->getID()); |
64 | 64 | return new TObjectProxy($handler, $list); |
65 | 65 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | protected function fetchListData() |
81 | 81 | { |
82 | - if($this->_loaded == false) |
|
82 | + if ($this->_loaded == false) |
|
83 | 83 | { |
84 | 84 | $this->_innerList = $this->_statement->executeQueryForList($this->_connection, $this->_param); |
85 | 85 | $this->_loaded = true; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | public function hasMethod($method) |
97 | 97 | { |
98 | 98 | $this->fetchListData(); |
99 | - if(is_object($this->_innerList)) |
|
99 | + if (is_object($this->_innerList)) |
|
100 | 100 | return in_array($method, get_class_methods($this->_innerList)); |
101 | 101 | return false; |
102 | 102 | } |
@@ -59,8 +59,9 @@ discard block |
||
59 | 59 | $statement = $mappedStatement->getStatement(); |
60 | 60 | $registry = $mappedStatement->getManager()->getTypeHandlers(); |
61 | 61 | $list = $statement->createInstanceOfListClass($registry); |
62 | - if(!is_object($list)) |
|
63 | - throw new TSqlMapExecutionException('sqlmap_invalid_lazyload_list', $statement->getID()); |
|
62 | + if(!is_object($list)) { |
|
63 | + throw new TSqlMapExecutionException('sqlmap_invalid_lazyload_list', $statement->getID()); |
|
64 | + } |
|
64 | 65 | return new TObjectProxy($handler, $list); |
65 | 66 | } |
66 | 67 | |
@@ -96,8 +97,9 @@ discard block |
||
96 | 97 | public function hasMethod($method) |
97 | 98 | { |
98 | 99 | $this->fetchListData(); |
99 | - if(is_object($this->_innerList)) |
|
100 | - return in_array($method, get_class_methods($this->_innerList)); |
|
100 | + if(is_object($this->_innerList)) { |
|
101 | + return in_array($method, get_class_methods($this->_innerList)); |
|
102 | + } |
|
101 | 103 | return false; |
102 | 104 | } |
103 | 105 | } |
104 | 106 | \ No newline at end of file |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function get($key) |
29 | 29 | { |
30 | - if($this->_keyList->contains($key)) |
|
30 | + if ($this->_keyList->contains($key)) |
|
31 | 31 | { |
32 | 32 | $this->_keyList->remove($key); |
33 | 33 | $this->_keyList->add($key); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | { |
46 | 46 | $this->_cache->add($key, $value); |
47 | 47 | $this->_keyList->add($key); |
48 | - if($this->_keyList->getCount() > $this->_cacheSize) |
|
48 | + if ($this->_keyList->getCount() > $this->_cacheSize) |
|
49 | 49 | { |
50 | 50 | $oldestKey = $this->_keyList->removeAt(0); |
51 | 51 | $this->_cache->remove($oldestKey); |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | */ |
32 | 32 | protected function createObjectFromNode($node) |
33 | 33 | { |
34 | - if(isset($node['class'])) |
|
34 | + if (isset($node['class'])) |
|
35 | 35 | { |
36 | - $obj = Prado::createComponent((string)$node['class']); |
|
36 | + $obj = Prado::createComponent((string) $node['class']); |
|
37 | 37 | $this->setObjectPropFromNode($obj, $node, ['class']); |
38 | 38 | return $obj; |
39 | 39 | } |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | */ |
51 | 51 | protected function setObjectPropFromNode($obj, $node, $except = []) |
52 | 52 | { |
53 | - foreach($node->attributes() as $name => $value) |
|
53 | + foreach ($node->attributes() as $name => $value) |
|
54 | 54 | { |
55 | - if(!in_array($name, $except)) |
|
55 | + if (!in_array($name, $except)) |
|
56 | 56 | { |
57 | - if($obj->canSetProperty($name)) |
|
58 | - $obj->{$name} = (string)$value; |
|
57 | + if ($obj->canSetProperty($name)) |
|
58 | + $obj->{$name} = (string) $value; |
|
59 | 59 | else |
60 | 60 | throw new TSqlMapConfigurationException( |
61 | 61 | 'sqlmap_invalid_property', $name, get_class($obj), |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | protected function getAbsoluteFilePath($basefile, $resource) |
73 | 73 | { |
74 | 74 | $basedir = dirname($basefile); |
75 | - $file = realpath($basedir . DIRECTORY_SEPARATOR . $resource); |
|
76 | - if(!is_string($file) || !is_file($file)) |
|
75 | + $file = realpath($basedir.DIRECTORY_SEPARATOR.$resource); |
|
76 | + if (!is_string($file) || !is_file($file)) |
|
77 | 77 | $file = realpath($resource); |
78 | - if(is_string($file) && is_file($file)) |
|
78 | + if (is_string($file) && is_file($file)) |
|
79 | 79 | return $file; |
80 | 80 | else |
81 | 81 | throw new TSqlMapConfigurationException( |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | */ |
89 | 89 | protected function loadXmlDocument($filename, TSqlMapXmlConfiguration $config) |
90 | 90 | { |
91 | - if(strpos($filename, '${') !== false) |
|
91 | + if (strpos($filename, '${') !== false) |
|
92 | 92 | $filename = $config->replaceProperties($filename); |
93 | - if(!is_file($filename)) |
|
93 | + if (!is_file($filename)) |
|
94 | 94 | throw new TSqlMapConfigurationException( |
95 | 95 | 'sqlmap_unable_to_find_config', $filename); |
96 | 96 | return simplexml_load_string($config->replaceProperties(file_get_contents($filename))); |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | protected function getElementByIdValue($document, $tag, $value) |
106 | 106 | { |
107 | 107 | //hack to allow upper case and lower case attribute names. |
108 | - foreach(['id','ID','Id', 'iD'] as $id) |
|
108 | + foreach (['id', 'ID', 'Id', 'iD'] as $id) |
|
109 | 109 | { |
110 | 110 | $xpath = "//{$tag}[@{$id}='{$value}']"; |
111 | - foreach($document->xpath($xpath) as $node) |
|
111 | + foreach ($document->xpath($xpath) as $node) |
|
112 | 112 | return $node; |
113 | 113 | } |
114 | 114 | } |
@@ -54,12 +54,13 @@ discard block |
||
54 | 54 | { |
55 | 55 | if(!in_array($name, $except)) |
56 | 56 | { |
57 | - if($obj->canSetProperty($name)) |
|
58 | - $obj->{$name} = (string)$value; |
|
59 | - else |
|
60 | - throw new TSqlMapConfigurationException( |
|
57 | + if($obj->canSetProperty($name)) { |
|
58 | + $obj->{$name} = (string)$value; |
|
59 | + } else { |
|
60 | + throw new TSqlMapConfigurationException( |
|
61 | 61 | 'sqlmap_invalid_property', $name, get_class($obj), |
62 | 62 | $node, $this->getConfigFile()); |
63 | + } |
|
63 | 64 | } |
64 | 65 | } |
65 | 66 | } |
@@ -73,13 +74,15 @@ discard block |
||
73 | 74 | { |
74 | 75 | $basedir = dirname($basefile); |
75 | 76 | $file = realpath($basedir . DIRECTORY_SEPARATOR . $resource); |
76 | - if(!is_string($file) || !is_file($file)) |
|
77 | - $file = realpath($resource); |
|
78 | - if(is_string($file) && is_file($file)) |
|
79 | - return $file; |
|
80 | - else |
|
81 | - throw new TSqlMapConfigurationException( |
|
77 | + if(!is_string($file) || !is_file($file)) { |
|
78 | + $file = realpath($resource); |
|
79 | + } |
|
80 | + if(is_string($file) && is_file($file)) { |
|
81 | + return $file; |
|
82 | + } else { |
|
83 | + throw new TSqlMapConfigurationException( |
|
82 | 84 | 'sqlmap_unable_to_find_resource', $resource); |
85 | + } |
|
83 | 86 | } |
84 | 87 | /** |
85 | 88 | * Load document using simple xml. |
@@ -88,11 +91,13 @@ discard block |
||
88 | 91 | */ |
89 | 92 | protected function loadXmlDocument($filename, TSqlMapXmlConfiguration $config) |
90 | 93 | { |
91 | - if(strpos($filename, '${') !== false) |
|
92 | - $filename = $config->replaceProperties($filename); |
|
93 | - if(!is_file($filename)) |
|
94 | - throw new TSqlMapConfigurationException( |
|
94 | + if(strpos($filename, '${') !== false) { |
|
95 | + $filename = $config->replaceProperties($filename); |
|
96 | + } |
|
97 | + if(!is_file($filename)) { |
|
98 | + throw new TSqlMapConfigurationException( |
|
95 | 99 | 'sqlmap_unable_to_find_config', $filename); |
100 | + } |
|
96 | 101 | return simplexml_load_string($config->replaceProperties(file_get_contents($filename))); |
97 | 102 | } |
98 | 103 | /** |
@@ -108,8 +113,9 @@ discard block |
||
108 | 113 | foreach(['id','ID','Id', 'iD'] as $id) |
109 | 114 | { |
110 | 115 | $xpath = "//{$tag}[@{$id}='{$value}']"; |
111 | - foreach($document->xpath($xpath) as $node) |
|
112 | - return $node; |
|
116 | + foreach($document->xpath($xpath) as $node) { |
|
117 | + return $node; |
|
118 | + } |
|
113 | 119 | } |
114 | 120 | } |
115 | 121 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $mappings = []; |
44 | 44 | preg_match_all(self::PARAMETER_TOKEN_REGEXP, $sqlText, $matches); |
45 | 45 | |
46 | - for($i = 0, $k = count($matches[1]); $i < $k; $i++) |
|
46 | + for ($i = 0, $k = count($matches[1]); $i < $k; $i++) |
|
47 | 47 | { |
48 | 48 | $mappings[] = $this->parseMapping($matches[1][$i], $scope); |
49 | 49 | $sqlText = str_replace($matches[0][$i], '?', $sqlText); |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | $mapping = new TParameterProperty; |
63 | 63 | $properties = explode(',', $token); |
64 | 64 | $mapping->setProperty(trim(array_shift($properties))); |
65 | - foreach($properties as $property) |
|
65 | + foreach ($properties as $property) |
|
66 | 66 | { |
67 | 67 | $prop = explode('=', $property); |
68 | 68 | $name = trim($prop[0]); $value = trim($prop[1]); |
69 | - if($mapping->canSetProperty($name)) |
|
70 | - $mapping->{'set' . $name}($value); |
|
69 | + if ($mapping->canSetProperty($name)) |
|
70 | + $mapping->{'set'.$name}($value); |
|
71 | 71 | else |
72 | 72 | { |
73 | 73 | throw new TSqlMapUndefinedException( |
@@ -66,9 +66,9 @@ |
||
66 | 66 | { |
67 | 67 | $prop = explode('=', $property); |
68 | 68 | $name = trim($prop[0]); $value = trim($prop[1]); |
69 | - if($mapping->canSetProperty($name)) |
|
70 | - $mapping->{'set' . $name}($value); |
|
71 | - else |
|
69 | + if($mapping->canSetProperty($name)) { |
|
70 | + $mapping->{'set' . $name}($value); |
|
71 | + } else |
|
72 | 72 | { |
73 | 73 | throw new TSqlMapUndefinedException( |
74 | 74 | 'sqlmap_undefined_property_inline_map', |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getProperty($index) |
103 | 103 | { |
104 | - if(is_string($index)) |
|
104 | + if (is_string($index)) |
|
105 | 105 | return $this->_propertyMap->itemAt($index); |
106 | - elseif(is_int($index)) |
|
106 | + elseif (is_int($index)) |
|
107 | 107 | return $this->_properties->itemAt($index); |
108 | 108 | else |
109 | 109 | throw new TSqlMapException('sqlmap_index_must_be_string_or_int', $index); |
@@ -147,12 +147,12 @@ discard block |
||
147 | 147 | { |
148 | 148 | $value = $this->getObjectValue($parameterValue, $property); |
149 | 149 | |
150 | - if(($handler = $this->createTypeHandler($property, $registry)) !== null) |
|
150 | + if (($handler = $this->createTypeHandler($property, $registry)) !== null) |
|
151 | 151 | $value = $handler->getParameter($value); |
152 | 152 | |
153 | 153 | $value = $this->nullifyDefaultValue($property, $value); |
154 | 154 | |
155 | - if(($type = $property->getType()) !== null) |
|
155 | + if (($type = $property->getType()) !== null) |
|
156 | 156 | $value = $registry->convertToType($type, $value); |
157 | 157 | |
158 | 158 | return $value; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | $type = $property->getTypeHandler() ? $property->getTypeHandler() : $property->getType(); |
171 | 171 | $handler = $registry->getTypeHandler($type); |
172 | - if($handler === null && $property->getTypeHandler()) |
|
172 | + if ($handler === null && $property->getTypeHandler()) |
|
173 | 173 | $handler = Prado::createComponent($type); |
174 | 174 | return $handler; |
175 | 175 | } |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | */ |
208 | 208 | protected function nullifyDefaultValue($property, $value) |
209 | 209 | { |
210 | - if(($nullValue = $property->getNullValue()) !== null) |
|
210 | + if (($nullValue = $property->getNullValue()) !== null) |
|
211 | 211 | { |
212 | - if($nullValue === $value) |
|
212 | + if ($nullValue === $value) |
|
213 | 213 | $value = null; |
214 | 214 | } |
215 | 215 | return $value; |
@@ -101,12 +101,13 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getProperty($index) |
103 | 103 | { |
104 | - if(is_string($index)) |
|
105 | - return $this->_propertyMap->itemAt($index); |
|
106 | - elseif(is_int($index)) |
|
107 | - return $this->_properties->itemAt($index); |
|
108 | - else |
|
109 | - throw new TSqlMapException('sqlmap_index_must_be_string_or_int', $index); |
|
104 | + if(is_string($index)) { |
|
105 | + return $this->_propertyMap->itemAt($index); |
|
106 | + } elseif(is_int($index)) { |
|
107 | + return $this->_properties->itemAt($index); |
|
108 | + } else { |
|
109 | + throw new TSqlMapException('sqlmap_index_must_be_string_or_int', $index); |
|
110 | + } |
|
110 | 111 | } |
111 | 112 | |
112 | 113 | /** |
@@ -147,13 +148,15 @@ discard block |
||
147 | 148 | { |
148 | 149 | $value = $this->getObjectValue($parameterValue, $property); |
149 | 150 | |
150 | - if(($handler = $this->createTypeHandler($property, $registry)) !== null) |
|
151 | - $value = $handler->getParameter($value); |
|
151 | + if(($handler = $this->createTypeHandler($property, $registry)) !== null) { |
|
152 | + $value = $handler->getParameter($value); |
|
153 | + } |
|
152 | 154 | |
153 | 155 | $value = $this->nullifyDefaultValue($property, $value); |
154 | 156 | |
155 | - if(($type = $property->getType()) !== null) |
|
156 | - $value = $registry->convertToType($type, $value); |
|
157 | + if(($type = $property->getType()) !== null) { |
|
158 | + $value = $registry->convertToType($type, $value); |
|
159 | + } |
|
157 | 160 | |
158 | 161 | return $value; |
159 | 162 | } |
@@ -169,8 +172,9 @@ discard block |
||
169 | 172 | { |
170 | 173 | $type = $property->getTypeHandler() ? $property->getTypeHandler() : $property->getType(); |
171 | 174 | $handler = $registry->getTypeHandler($type); |
172 | - if($handler === null && $property->getTypeHandler()) |
|
173 | - $handler = Prado::createComponent($type); |
|
175 | + if($handler === null && $property->getTypeHandler()) { |
|
176 | + $handler = Prado::createComponent($type); |
|
177 | + } |
|
174 | 178 | return $handler; |
175 | 179 | } |
176 | 180 | |
@@ -186,8 +190,7 @@ discard block |
||
186 | 190 | try |
187 | 191 | { |
188 | 192 | return TPropertyAccess::get($object, $property->getProperty()); |
189 | - } |
|
190 | - catch (TInvalidPropertyException $e) |
|
193 | + } catch (TInvalidPropertyException $e) |
|
191 | 194 | { |
192 | 195 | throw new TSqlMapException( |
193 | 196 | 'sqlmap_unable_to_get_property_for_parameter', |
@@ -209,8 +212,9 @@ discard block |
||
209 | 212 | { |
210 | 213 | if(($nullValue = $property->getNullValue()) !== null) |
211 | 214 | { |
212 | - if($nullValue === $value) |
|
213 | - $value = null; |
|
215 | + if($nullValue === $value) { |
|
216 | + $value = null; |
|
217 | + } |
|
214 | 218 | } |
215 | 219 | return $value; |
216 | 220 | } |