Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:58
created
framework/Data/SqlMap/DataMapper/TObjectProxy.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 	 */
44 44
 	public function __call($method, $params)
45 45
 	{
46
-		if($this->_handler->hasMethod($method))
46
+		if ($this->_handler->hasMethod($method))
47 47
 			return $this->_handler->intercept($method, $params);
48 48
 		else
49 49
 			return call_user_func_array([$this->_object, $method], $params);
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,9 +43,10 @@
 block discarded – undo
43 43
 	 */
44 44
 	public function __call($method, $params)
45 45
 	{
46
-		if($this->_handler->hasMethod($method))
47
-			return $this->_handler->intercept($method, $params);
48
-		else
49
-			return call_user_func_array([$this->_object, $method], $params);
46
+		if($this->_handler->hasMethod($method)) {
47
+					return $this->_handler->intercept($method, $params);
48
+		} else {
49
+					return call_user_func_array([$this->_object, $method], $params);
50
+		}
50 51
 	}
51 52
 }
52 53
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlConfigBuilder.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
Braces   +22 added lines, -16 removed lines patch added patch discarded remove patch
@@ -54,12 +54,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	/**
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TInlineParameterMapParser.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@
 block discarded – undo
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',
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TParameterMap.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Braces   +20 added lines, -16 removed lines patch added patch discarded remove patch
@@ -101,12 +101,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TResultMap.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		$handler = $registry->getTypeHandler($this->getClass());
166 166
 		try
167 167
 		{
168
-			if($handler !== null)
168
+			if ($handler !== null)
169 169
 				return $handler->createNewInstance();
170 170
 			else
171 171
 				return $registry->createInstanceOf($this->getClass());
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
 	public function resolveSubMap($registry, $row)
188 188
 	{
189 189
 		$subMap = $this;
190
-		if(($disc = $this->getDiscriminator()) !== null)
190
+		if (($disc = $this->getDiscriminator()) !== null)
191 191
 		{
192 192
 			$value = $disc->getMapping()->getPropertyValue($registry, $row);
193
-			$subMap = $disc->getSubMap((string)$value);
193
+			$subMap = $disc->getSubMap((string) $value);
194 194
 
195
-			if($subMap === null)
195
+			if ($subMap === null)
196 196
 				$subMap = $this;
197
-			elseif($subMap !== $this)
197
+			elseif ($subMap !== $this)
198 198
 				$subMap = $subMap->resolveSubMap($registry, $row);
199 199
 		}
200 200
 		return $subMap;
Please login to merge, or discard this patch.
Braces   +11 added lines, -10 removed lines patch added patch discarded remove patch
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
 		$handler = $registry->getTypeHandler($this->getClass());
166 166
 		try
167 167
 		{
168
-			if($handler !== null)
169
-				return $handler->createNewInstance();
170
-			else
171
-				return $registry->createInstanceOf($this->getClass());
172
-		}
173
-		catch (TSqlMapException $e)
168
+			if($handler !== null) {
169
+							return $handler->createNewInstance();
170
+			} else {
171
+							return $registry->createInstanceOf($this->getClass());
172
+			}
173
+		} catch (TSqlMapException $e)
174 174
 		{
175 175
 			throw new TSqlMapException(
176 176
 				'sqlmap_unable_to_create_new_instance',
@@ -192,10 +192,11 @@  discard block
 block discarded – undo
192 192
 			$value = $disc->getMapping()->getPropertyValue($registry, $row);
193 193
 			$subMap = $disc->getSubMap((string)$value);
194 194
 
195
-			if($subMap === null)
196
-				$subMap = $this;
197
-			elseif($subMap !== $this)
198
-				$subMap = $subMap->resolveSubMap($registry, $row);
195
+			if($subMap === null) {
196
+							$subMap = $this;
197
+			} elseif($subMap !== $this) {
198
+							$subMap = $subMap->resolveSubMap($registry, $row);
199
+			}
199 200
 		}
200 201
 		return $subMap;
201 202
 	}
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TParameterProperty.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -138,12 +138,24 @@
 block discarded – undo
138 138
 	public function __sleep()
139 139
 	{
140 140
 		$exprops = []; $cn = 'TParameterProperty';
141
-		if ($this->_typeHandler === null) $exprops[] = "\0$cn\0_typeHandler";
142
-		if ($this->_type === null) $exprops[] = "\0$cn\0_type";
143
-		if ($this->_column === null) $exprops[] = "\0$cn\0_column";
144
-		if ($this->_dbType === null) $exprops[] = "\0$cn\0_dbType";
145
-		if ($this->_property === null) $exprops[] = "\0$cn\0_property";
146
-		if ($this->_nullValue === null) $exprops[] = "\0$cn\0_nullValue";
141
+		if ($this->_typeHandler === null) {
142
+			$exprops[] = "\0$cn\0_typeHandler";
143
+		}
144
+		if ($this->_type === null) {
145
+			$exprops[] = "\0$cn\0_type";
146
+		}
147
+		if ($this->_column === null) {
148
+			$exprops[] = "\0$cn\0_column";
149
+		}
150
+		if ($this->_dbType === null) {
151
+			$exprops[] = "\0$cn\0_dbType";
152
+		}
153
+		if ($this->_property === null) {
154
+			$exprops[] = "\0$cn\0_property";
155
+		}
156
+		if ($this->_nullValue === null) {
157
+			$exprops[] = "\0$cn\0_nullValue";
158
+		}
147 159
 		return array_diff(parent::__sleep(), $exprops);
148 160
 	}
149 161
 }
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSimpleDynamicParser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 		$matches = [];
35 35
 		$mappings = [];
36 36
 		preg_match_all(self::PARAMETER_TOKEN_REGEXP, $sqlText, $matches);
37
-		for($i = 0, $k = count($matches[1]); $i < $k; $i++)
37
+		for ($i = 0, $k = count($matches[1]); $i < $k; $i++)
38 38
 		{
39 39
 			$mappings[] = $matches[1][$i];
40 40
 			$sqlText = str_replace($matches[0][$i], self::DYNAMIC_TOKEN, $sqlText);
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlMappingConfiguration.php 2 patches
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -77,39 +77,39 @@  discard block
 block discarded – undo
77 77
 		$this->_document = $document;
78 78
 
79 79
 		static $bCacheDependencies;
80
-		if($bCacheDependencies === null)
80
+		if ($bCacheDependencies === null)
81 81
 			$bCacheDependencies = true; //Prado::getApplication()->getMode() !== TApplicationMode::Performance;
82 82
 
83
-		if($bCacheDependencies)
83
+		if ($bCacheDependencies)
84 84
 			$this->_manager->getCacheDependencies()
85 85
 					->getDependencies()
86 86
 					->add(new TFileCacheDependency($filename));
87 87
 
88
-		foreach($document->xpath('//resultMap') as $node)
88
+		foreach ($document->xpath('//resultMap') as $node)
89 89
 			$this->loadResultMap($node);
90 90
 
91
-		foreach($document->xpath('//parameterMap') as $node)
91
+		foreach ($document->xpath('//parameterMap') as $node)
92 92
 			$this->loadParameterMap($node);
93 93
 
94
-		foreach($document->xpath('//statement') as $node)
94
+		foreach ($document->xpath('//statement') as $node)
95 95
 			$this->loadStatementTag($node);
96 96
 
97
-		foreach($document->xpath('//select') as $node)
97
+		foreach ($document->xpath('//select') as $node)
98 98
 			$this->loadSelectTag($node);
99 99
 
100
-		foreach($document->xpath('//insert') as $node)
100
+		foreach ($document->xpath('//insert') as $node)
101 101
 			$this->loadInsertTag($node);
102 102
 
103
-		foreach($document->xpath('//update') as $node)
103
+		foreach ($document->xpath('//update') as $node)
104 104
 			$this->loadUpdateTag($node);
105 105
 
106
-		foreach($document->xpath('//delete') as $node)
106
+		foreach ($document->xpath('//delete') as $node)
107 107
 			$this->loadDeleteTag($node);
108 108
 
109
-		foreach($document->xpath('//procedure') as $node)
109
+		foreach ($document->xpath('//procedure') as $node)
110 110
 			$this->loadProcedureTag($node);
111 111
 
112
-		foreach($document->xpath('//cacheModel') as $node)
112
+		foreach ($document->xpath('//cacheModel') as $node)
113 113
 				$this->loadCacheModel($node);
114 114
 
115 115
 		$this->registerCacheTriggers();
@@ -124,16 +124,16 @@  discard block
 block discarded – undo
124 124
 		$resultMap = $this->createResultMap($node);
125 125
 
126 126
 		//find extended result map.
127
-		if(strlen($extendMap = $resultMap->getExtends()) > 0)
127
+		if (strlen($extendMap = $resultMap->getExtends()) > 0)
128 128
 		{
129
-			if(!$this->_manager->getResultMaps()->contains($extendMap))
129
+			if (!$this->_manager->getResultMaps()->contains($extendMap))
130 130
 			{
131 131
 				$extendNode = $this->getElementByIdValue($this->_document, 'resultMap', $extendMap);
132
-				if($extendNode !== null)
132
+				if ($extendNode !== null)
133 133
 					$this->loadResultMap($extendNode);
134 134
 			}
135 135
 
136
-			if(!$this->_manager->getResultMaps()->contains($extendMap))
136
+			if (!$this->_manager->getResultMaps()->contains($extendMap))
137 137
 				throw new TSqlMapConfigurationException(
138 138
 					'sqlmap_unable_to_find_parent_result_map', $node, $this->_configFile, $extendMap);
139 139
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		}
143 143
 
144 144
 		//add the result map
145
-		if(!$this->_manager->getResultMaps()->contains($resultMap->getID()))
145
+		if (!$this->_manager->getResultMaps()->contains($resultMap->getID()))
146 146
 			$this->_manager->addResultMap($resultMap);
147 147
 	}
148 148
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 		$this->setObjectPropFromNode($resultMap, $node);
159 159
 
160 160
 		//result nodes
161
-		foreach($node->result as $result)
161
+		foreach ($node->result as $result)
162 162
 		{
163 163
 			$property = new TResultProperty($resultMap);
164 164
 			$this->setObjectPropFromNode($property, $result);
@@ -167,16 +167,16 @@  discard block
 block discarded – undo
167 167
 
168 168
 		//create the discriminator
169 169
 		$discriminator = null;
170
-		if(isset($node->discriminator))
170
+		if (isset($node->discriminator))
171 171
 		{
172 172
 			$discriminator = new TDiscriminator();
173 173
 			$this->setObjectPropFromNode($discriminator, $node->discriminator);
174 174
 			$discriminator->initMapping($resultMap);
175 175
 		}
176 176
 
177
-		foreach($node->xpath('subMap') as $subMapNode)
177
+		foreach ($node->xpath('subMap') as $subMapNode)
178 178
 		{
179
-			if($discriminator === null)
179
+			if ($discriminator === null)
180 180
 				throw new TSqlMapConfigurationException(
181 181
 					'sqlmap_undefined_discriminator', $node, $this->_configFile, $subMapNode);
182 182
 			$subMap = new TSubMap;
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			$discriminator->addSubMap($subMap);
185 185
 		}
186 186
 
187
-		if($discriminator !== null)
187
+		if ($discriminator !== null)
188 188
 			$resultMap->setDiscriminator($discriminator);
189 189
 
190 190
 		return $resultMap;
@@ -199,21 +199,21 @@  discard block
 block discarded – undo
199 199
 	{
200 200
 		$parameterMap = $this->createParameterMap($node);
201 201
 
202
-		if(strlen($extendMap = $parameterMap->getExtends()) > 0)
202
+		if (strlen($extendMap = $parameterMap->getExtends()) > 0)
203 203
 		{
204
-			if(!$this->_manager->getParameterMaps()->contains($extendMap))
204
+			if (!$this->_manager->getParameterMaps()->contains($extendMap))
205 205
 			{
206 206
 				$extendNode = $this->getElementByIdValue($this->_document, 'parameterMap', $extendMap);
207
-				if($extendNode !== null)
207
+				if ($extendNode !== null)
208 208
 					$this->loadParameterMap($extendNode);
209 209
 			}
210 210
 
211
-			if(!$this->_manager->getParameterMaps()->contains($extendMap))
211
+			if (!$this->_manager->getParameterMaps()->contains($extendMap))
212 212
 				throw new TSqlMapConfigurationException(
213 213
 					'sqlmap_unable_to_find_parent_parameter_map', $node, $this->_configFile, $extendMap);
214 214
 			$superMap = $this->_manager->getParameterMap($extendMap);
215 215
 			$index = 0;
216
-			foreach($superMap->getPropertyNames() as $propertyName)
216
+			foreach ($superMap->getPropertyNames() as $propertyName)
217 217
 				$parameterMap->insertProperty($index++, $superMap->getProperty($propertyName));
218 218
 		}
219 219
 		$this->_manager->addParameterMap($parameterMap);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	{
229 229
 		$parameterMap = new TParameterMap();
230 230
 		$this->setObjectPropFromNode($parameterMap, $node);
231
-		foreach($node->parameter as $parameter)
231
+		foreach ($node->parameter as $parameter)
232 232
 		{
233 233
 			$property = new TParameterProperty();
234 234
 			$this->setObjectPropFromNode($property, $parameter);
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	protected function processSqlStatement($statement, $node)
260 260
 	{
261
-		$commandText = (string)$node;
262
-		if(strlen($extend = $statement->getExtends()) > 0)
261
+		$commandText = (string) $node;
262
+		if (strlen($extend = $statement->getExtends()) > 0)
263 263
 		{
264 264
 			$superNode = $this->getElementByIdValue($this->_document, '*', $extend);
265
-			if($superNode !== null)
266
-				$commandText = (string)$superNode . $commandText;
265
+			if ($superNode !== null)
266
+				$commandText = (string) $superNode.$commandText;
267 267
 			else
268 268
 				throw new TSqlMapConfigurationException(
269 269
 						'sqlmap_unable_to_find_parent_sql', $extend, $this->_configFile, $node);
@@ -285,23 +285,23 @@  discard block
 block discarded – undo
285 285
 		$scope['node'] = $node;
286 286
 
287 287
 		$sqlStatement = preg_replace(self::ESCAPED_INLINE_SYMBOL_REGEXP, self::INLINE_PLACEHOLDER, $sqlStatement);
288
-		if($statement->parameterMap() === null)
288
+		if ($statement->parameterMap() === null)
289 289
 		{
290 290
 			// Build a Parametermap with the inline parameters.
291 291
 			// if they exist. Then delete inline infos from sqltext.
292 292
 			$parameterParser = new TInlineParameterMapParser;
293 293
 			$sqlText = $parameterParser->parse($sqlStatement, $scope);
294
-			if(count($sqlText['parameters']) > 0)
294
+			if (count($sqlText['parameters']) > 0)
295 295
 			{
296 296
 				$map = new TParameterMap();
297
-				$map->setID($statement->getID() . '-InLineParameterMap');
297
+				$map->setID($statement->getID().'-InLineParameterMap');
298 298
 				$statement->setInlineParameterMap($map);
299
-				foreach($sqlText['parameters'] as $property)
299
+				foreach ($sqlText['parameters'] as $property)
300 300
 					$map->addProperty($property);
301 301
 			}
302 302
 			$sqlStatement = $sqlText['sql'];
303 303
 		}
304
-		$sqlStatement = preg_replace('/' . self::INLINE_PLACEHOLDER . '/', self::INLINE_SYMBOL, $sqlStatement);
304
+		$sqlStatement = preg_replace('/'.self::INLINE_PLACEHOLDER.'/', self::INLINE_SYMBOL, $sqlStatement);
305 305
 
306 306
 		$this->prepareSql($statement, $sqlStatement, $node);
307 307
 	}
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
 		$simpleDynamic = new TSimpleDynamicParser;
319 319
 		$sqlStatement = preg_replace(self::ESCAPED_SIMPLE_MARK_REGEXP, self::SIMPLE_PLACEHOLDER, $sqlStatement);
320 320
 		$dynamics = $simpleDynamic->parse($sqlStatement);
321
-		if(count($dynamics['parameters']) > 0)
321
+		if (count($dynamics['parameters']) > 0)
322 322
 		{
323 323
 			$sql = new TSimpleDynamicSql($dynamics['parameters']);
324 324
 			$sqlStatement = $dynamics['sql'];
325 325
 		}
326 326
 		else
327 327
 			$sql = new TStaticSql();
328
-		$sqlStatement = preg_replace('/' . self::SIMPLE_PLACEHOLDER . '/', self::SIMPLE_MARK, $sqlStatement);
328
+		$sqlStatement = preg_replace('/'.self::SIMPLE_PLACEHOLDER.'/', self::SIMPLE_MARK, $sqlStatement);
329 329
 		$sql->buildPreparedStatement($statement, $sqlStatement);
330 330
 		$statement->setSqlText($sql);
331 331
 	}
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 		$this->setObjectPropFromNode($select, $node);
341 341
 		$this->processSqlStatement($select, $node);
342 342
 		$mappedStatement = new TMappedStatement($this->_manager, $select);
343
-		if(strlen($select->getCacheModel()) > 0)
343
+		if (strlen($select->getCacheModel()) > 0)
344 344
 			$mappedStatement = new TCachingStatement($mappedStatement);
345 345
 
346 346
 		$this->_manager->addMappedStatement($mappedStatement);
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	{
368 368
 		$insert = new TSqlMapInsert;
369 369
 		$this->setObjectPropFromNode($insert, $node);
370
-		if(isset($node->selectKey))
370
+		if (isset($node->selectKey))
371 371
 			$this->loadSelectKeyTag($insert, $node->selectKey);
372 372
 		return $insert;
373 373
 	}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 		$selectKey = new TSqlMapSelectKey;
382 382
 		$this->setObjectPropFromNode($selectKey, $node);
383 383
 		$selectKey->setID($insert->getID());
384
-		$selectKey->setID($insert->getID() . '.SelectKey');
384
+		$selectKey->setID($insert->getID().'.SelectKey');
385 385
 		$this->processSqlStatement($selectKey, $node);
386 386
 		$insert->setSelectKey($selectKey);
387 387
 		$mappedStatement = new TMappedStatement($this->_manager, $selectKey);
@@ -431,24 +431,24 @@  discard block
 block discarded – undo
431 431
 	protected function loadCacheModel($node)
432 432
 	{
433 433
 		$cacheModel = new TSqlMapCacheModel;
434
-		$properties = ['id','implementation'];
435
-		foreach($node->attributes() as $name => $value)
434
+		$properties = ['id', 'implementation'];
435
+		foreach ($node->attributes() as $name => $value)
436 436
 		{
437
-			if(in_array(strtolower($name), $properties))
438
-				$cacheModel->{'set' . $name}((string)$value);
437
+			if (in_array(strtolower($name), $properties))
438
+				$cacheModel->{'set'.$name}((string) $value);
439 439
 		}
440 440
 		$cache = Prado::createComponent($cacheModel->getImplementationClass(), $cacheModel);
441 441
 		$this->setObjectPropFromNode($cache, $node, $properties);
442 442
 
443
-		foreach($node->xpath('property') as $propertyNode)
443
+		foreach ($node->xpath('property') as $propertyNode)
444 444
 		{
445 445
 			$name = $propertyNode->attributes()->name;
446
-			if($name === null || $name === '') continue;
446
+			if ($name === null || $name === '') continue;
447 447
 
448 448
 			$value = $propertyNode->attributes()->value;
449
-			if($value === null || $value === '') continue;
449
+			if ($value === null || $value === '') continue;
450 450
 
451
-			if(!TPropertyAccess::has($cache, $name)) continue;
451
+			if (!TPropertyAccess::has($cache, $name)) continue;
452 452
 
453 453
 			TPropertyAccess::set($cache, $name, $value);
454 454
 		}
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 
458 458
 		$cacheModel->initialize($cache);
459 459
 		$this->_manager->addCacheModel($cacheModel);
460
-		foreach($node->xpath('flushOnExecute') as $flush)
460
+		foreach ($node->xpath('flushOnExecute') as $flush)
461 461
 			$this->loadFlushOnCache($cacheModel, $node, $flush);
462 462
 	}
463 463
 
@@ -469,26 +469,26 @@  discard block
 block discarded – undo
469 469
 	protected function loadFlushInterval($cacheModel, $node)
470 470
 	{
471 471
 		$flushInterval = $node->xpath('flushInterval');
472
-		if($flushInterval === null || count($flushInterval) === 0) return;
472
+		if ($flushInterval === null || count($flushInterval) === 0) return;
473 473
 		$duration = 0;
474
-		foreach($flushInterval[0]->attributes() as $name => $value)
474
+		foreach ($flushInterval[0]->attributes() as $name => $value)
475 475
 		{
476
-			switch(strToLower($name))
476
+			switch (strToLower($name))
477 477
 			{
478 478
 				case 'seconds':
479
-					$duration += (integer)$value;
479
+					$duration += (integer) $value;
480 480
 				break;
481 481
 				case 'minutes':
482
-					$duration += 60 * (integer)$value;
482
+					$duration += 60 * (integer) $value;
483 483
 				break;
484 484
 				case 'hours':
485
-					$duration += 3600 * (integer)$value;
485
+					$duration += 3600 * (integer) $value;
486 486
 				break;
487 487
 				case 'days':
488
-					$duration += 86400 * (integer)$value;
488
+					$duration += 86400 * (integer) $value;
489 489
 				break;
490 490
 				case 'duration':
491
-					$duration = (integer)$value;
491
+					$duration = (integer) $value;
492 492
 				break 2; // switch, foreach
493 493
 			}
494 494
 		}
@@ -504,12 +504,12 @@  discard block
 block discarded – undo
504 504
 	protected function loadFlushOnCache($cacheModel, $parent, $node)
505 505
 	{
506 506
 		$id = $cacheModel->getID();
507
-		if(!isset($this->_FlushOnExecuteStatements[$id]))
507
+		if (!isset($this->_FlushOnExecuteStatements[$id]))
508 508
 			$this->_FlushOnExecuteStatements[$id] = [];
509
-		foreach($node->attributes() as $name => $value)
509
+		foreach ($node->attributes() as $name => $value)
510 510
 		{
511
-			if(strtolower($name) === 'statement')
512
-				$this->_FlushOnExecuteStatements[$id][] = (string)$value;
511
+			if (strtolower($name) === 'statement')
512
+				$this->_FlushOnExecuteStatements[$id][] = (string) $value;
513 513
 		}
514 514
 	}
515 515
 
@@ -518,10 +518,10 @@  discard block
 block discarded – undo
518 518
 	 */
519 519
 	protected function registerCacheTriggers()
520 520
 	{
521
-		foreach($this->_FlushOnExecuteStatements as $cacheID => $statementIDs)
521
+		foreach ($this->_FlushOnExecuteStatements as $cacheID => $statementIDs)
522 522
 		{
523 523
 			$cacheModel = $this->_manager->getCacheModel($cacheID);
524
-			foreach($statementIDs as $statementID)
524
+			foreach ($statementIDs as $statementID)
525 525
 			{
526 526
 				$statement = $this->_manager->getMappedStatement($statementID);
527 527
 				$cacheModel->registerTriggerStatement($statement);
Please login to merge, or discard this patch.
Braces   +98 added lines, -62 removed lines patch added patch discarded remove patch
@@ -77,40 +77,52 @@  discard block
 block discarded – undo
77 77
 		$this->_document = $document;
78 78
 
79 79
 		static $bCacheDependencies;
80
-		if($bCacheDependencies === null)
81
-			$bCacheDependencies = true; //Prado::getApplication()->getMode() !== TApplicationMode::Performance;
80
+		if($bCacheDependencies === null) {
81
+					$bCacheDependencies = true;
82
+		}
83
+		//Prado::getApplication()->getMode() !== TApplicationMode::Performance;
82 84
 
83
-		if($bCacheDependencies)
84
-			$this->_manager->getCacheDependencies()
85
+		if($bCacheDependencies) {
86
+					$this->_manager->getCacheDependencies()
85 87
 					->getDependencies()
86 88
 					->add(new TFileCacheDependency($filename));
89
+		}
87 90
 
88
-		foreach($document->xpath('//resultMap') as $node)
89
-			$this->loadResultMap($node);
91
+		foreach($document->xpath('//resultMap') as $node) {
92
+					$this->loadResultMap($node);
93
+		}
90 94
 
91
-		foreach($document->xpath('//parameterMap') as $node)
92
-			$this->loadParameterMap($node);
95
+		foreach($document->xpath('//parameterMap') as $node) {
96
+					$this->loadParameterMap($node);
97
+		}
93 98
 
94
-		foreach($document->xpath('//statement') as $node)
95
-			$this->loadStatementTag($node);
99
+		foreach($document->xpath('//statement') as $node) {
100
+					$this->loadStatementTag($node);
101
+		}
96 102
 
97
-		foreach($document->xpath('//select') as $node)
98
-			$this->loadSelectTag($node);
103
+		foreach($document->xpath('//select') as $node) {
104
+					$this->loadSelectTag($node);
105
+		}
99 106
 
100
-		foreach($document->xpath('//insert') as $node)
101
-			$this->loadInsertTag($node);
107
+		foreach($document->xpath('//insert') as $node) {
108
+					$this->loadInsertTag($node);
109
+		}
102 110
 
103
-		foreach($document->xpath('//update') as $node)
104
-			$this->loadUpdateTag($node);
111
+		foreach($document->xpath('//update') as $node) {
112
+					$this->loadUpdateTag($node);
113
+		}
105 114
 
106
-		foreach($document->xpath('//delete') as $node)
107
-			$this->loadDeleteTag($node);
115
+		foreach($document->xpath('//delete') as $node) {
116
+					$this->loadDeleteTag($node);
117
+		}
108 118
 
109
-		foreach($document->xpath('//procedure') as $node)
110
-			$this->loadProcedureTag($node);
119
+		foreach($document->xpath('//procedure') as $node) {
120
+					$this->loadProcedureTag($node);
121
+		}
111 122
 
112
-		foreach($document->xpath('//cacheModel') as $node)
113
-				$this->loadCacheModel($node);
123
+		foreach($document->xpath('//cacheModel') as $node) {
124
+						$this->loadCacheModel($node);
125
+		}
114 126
 
115 127
 		$this->registerCacheTriggers();
116 128
 	}
@@ -129,21 +141,24 @@  discard block
 block discarded – undo
129 141
 			if(!$this->_manager->getResultMaps()->contains($extendMap))
130 142
 			{
131 143
 				$extendNode = $this->getElementByIdValue($this->_document, 'resultMap', $extendMap);
132
-				if($extendNode !== null)
133
-					$this->loadResultMap($extendNode);
144
+				if($extendNode !== null) {
145
+									$this->loadResultMap($extendNode);
146
+				}
134 147
 			}
135 148
 
136
-			if(!$this->_manager->getResultMaps()->contains($extendMap))
137
-				throw new TSqlMapConfigurationException(
149
+			if(!$this->_manager->getResultMaps()->contains($extendMap)) {
150
+							throw new TSqlMapConfigurationException(
138 151
 					'sqlmap_unable_to_find_parent_result_map', $node, $this->_configFile, $extendMap);
152
+			}
139 153
 
140 154
 			$superMap = $this->_manager->getResultMap($extendMap);
141 155
 			$resultMap->getColumns()->mergeWith($superMap->getColumns());
142 156
 		}
143 157
 
144 158
 		//add the result map
145
-		if(!$this->_manager->getResultMaps()->contains($resultMap->getID()))
146
-			$this->_manager->addResultMap($resultMap);
159
+		if(!$this->_manager->getResultMaps()->contains($resultMap->getID())) {
160
+					$this->_manager->addResultMap($resultMap);
161
+		}
147 162
 	}
148 163
 
149 164
 	/**
@@ -176,16 +191,18 @@  discard block
 block discarded – undo
176 191
 
177 192
 		foreach($node->xpath('subMap') as $subMapNode)
178 193
 		{
179
-			if($discriminator === null)
180
-				throw new TSqlMapConfigurationException(
194
+			if($discriminator === null) {
195
+							throw new TSqlMapConfigurationException(
181 196
 					'sqlmap_undefined_discriminator', $node, $this->_configFile, $subMapNode);
197
+			}
182 198
 			$subMap = new TSubMap;
183 199
 			$this->setObjectPropFromNode($subMap, $subMapNode);
184 200
 			$discriminator->addSubMap($subMap);
185 201
 		}
186 202
 
187
-		if($discriminator !== null)
188
-			$resultMap->setDiscriminator($discriminator);
203
+		if($discriminator !== null) {
204
+					$resultMap->setDiscriminator($discriminator);
205
+		}
189 206
 
190 207
 		return $resultMap;
191 208
 	}
@@ -204,17 +221,20 @@  discard block
 block discarded – undo
204 221
 			if(!$this->_manager->getParameterMaps()->contains($extendMap))
205 222
 			{
206 223
 				$extendNode = $this->getElementByIdValue($this->_document, 'parameterMap', $extendMap);
207
-				if($extendNode !== null)
208
-					$this->loadParameterMap($extendNode);
224
+				if($extendNode !== null) {
225
+									$this->loadParameterMap($extendNode);
226
+				}
209 227
 			}
210 228
 
211
-			if(!$this->_manager->getParameterMaps()->contains($extendMap))
212
-				throw new TSqlMapConfigurationException(
229
+			if(!$this->_manager->getParameterMaps()->contains($extendMap)) {
230
+							throw new TSqlMapConfigurationException(
213 231
 					'sqlmap_unable_to_find_parent_parameter_map', $node, $this->_configFile, $extendMap);
232
+			}
214 233
 			$superMap = $this->_manager->getParameterMap($extendMap);
215 234
 			$index = 0;
216
-			foreach($superMap->getPropertyNames() as $propertyName)
217
-				$parameterMap->insertProperty($index++, $superMap->getProperty($propertyName));
235
+			foreach($superMap->getPropertyNames() as $propertyName) {
236
+							$parameterMap->insertProperty($index++, $superMap->getProperty($propertyName));
237
+			}
218 238
 		}
219 239
 		$this->_manager->addParameterMap($parameterMap);
220 240
 	}
@@ -262,11 +282,12 @@  discard block
 block discarded – undo
262 282
 		if(strlen($extend = $statement->getExtends()) > 0)
263 283
 		{
264 284
 			$superNode = $this->getElementByIdValue($this->_document, '*', $extend);
265
-			if($superNode !== null)
266
-				$commandText = (string)$superNode . $commandText;
267
-			else
268
-				throw new TSqlMapConfigurationException(
285
+			if($superNode !== null) {
286
+							$commandText = (string)$superNode . $commandText;
287
+			} else {
288
+							throw new TSqlMapConfigurationException(
269 289
 						'sqlmap_unable_to_find_parent_sql', $extend, $this->_configFile, $node);
290
+			}
270 291
 		}
271 292
 		//$commandText = $this->_xmlConfig->replaceProperties($commandText);
272 293
 		$statement->initialize($this->_manager);
@@ -296,8 +317,9 @@  discard block
 block discarded – undo
296 317
 				$map = new TParameterMap();
297 318
 				$map->setID($statement->getID() . '-InLineParameterMap');
298 319
 				$statement->setInlineParameterMap($map);
299
-				foreach($sqlText['parameters'] as $property)
300
-					$map->addProperty($property);
320
+				foreach($sqlText['parameters'] as $property) {
321
+									$map->addProperty($property);
322
+				}
301 323
 			}
302 324
 			$sqlStatement = $sqlText['sql'];
303 325
 		}
@@ -322,9 +344,9 @@  discard block
 block discarded – undo
322 344
 		{
323 345
 			$sql = new TSimpleDynamicSql($dynamics['parameters']);
324 346
 			$sqlStatement = $dynamics['sql'];
347
+		} else {
348
+					$sql = new TStaticSql();
325 349
 		}
326
-		else
327
-			$sql = new TStaticSql();
328 350
 		$sqlStatement = preg_replace('/' . self::SIMPLE_PLACEHOLDER . '/', self::SIMPLE_MARK, $sqlStatement);
329 351
 		$sql->buildPreparedStatement($statement, $sqlStatement);
330 352
 		$statement->setSqlText($sql);
@@ -340,8 +362,9 @@  discard block
 block discarded – undo
340 362
 		$this->setObjectPropFromNode($select, $node);
341 363
 		$this->processSqlStatement($select, $node);
342 364
 		$mappedStatement = new TMappedStatement($this->_manager, $select);
343
-		if(strlen($select->getCacheModel()) > 0)
344
-			$mappedStatement = new TCachingStatement($mappedStatement);
365
+		if(strlen($select->getCacheModel()) > 0) {
366
+					$mappedStatement = new TCachingStatement($mappedStatement);
367
+		}
345 368
 
346 369
 		$this->_manager->addMappedStatement($mappedStatement);
347 370
 	}
@@ -367,8 +390,9 @@  discard block
 block discarded – undo
367 390
 	{
368 391
 		$insert = new TSqlMapInsert;
369 392
 		$this->setObjectPropFromNode($insert, $node);
370
-		if(isset($node->selectKey))
371
-			$this->loadSelectKeyTag($insert, $node->selectKey);
393
+		if(isset($node->selectKey)) {
394
+					$this->loadSelectKeyTag($insert, $node->selectKey);
395
+		}
372 396
 		return $insert;
373 397
 	}
374 398
 
@@ -434,8 +458,9 @@  discard block
 block discarded – undo
434 458
 		$properties = ['id','implementation'];
435 459
 		foreach($node->attributes() as $name => $value)
436 460
 		{
437
-			if(in_array(strtolower($name), $properties))
438
-				$cacheModel->{'set' . $name}((string)$value);
461
+			if(in_array(strtolower($name), $properties)) {
462
+							$cacheModel->{'set' . $name}((string)$value);
463
+			}
439 464
 		}
440 465
 		$cache = Prado::createComponent($cacheModel->getImplementationClass(), $cacheModel);
441 466
 		$this->setObjectPropFromNode($cache, $node, $properties);
@@ -443,12 +468,18 @@  discard block
 block discarded – undo
443 468
 		foreach($node->xpath('property') as $propertyNode)
444 469
 		{
445 470
 			$name = $propertyNode->attributes()->name;
446
-			if($name === null || $name === '') continue;
471
+			if($name === null || $name === '') {
472
+				continue;
473
+			}
447 474
 
448 475
 			$value = $propertyNode->attributes()->value;
449
-			if($value === null || $value === '') continue;
476
+			if($value === null || $value === '') {
477
+				continue;
478
+			}
450 479
 
451
-			if(!TPropertyAccess::has($cache, $name)) continue;
480
+			if(!TPropertyAccess::has($cache, $name)) {
481
+				continue;
482
+			}
452 483
 
453 484
 			TPropertyAccess::set($cache, $name, $value);
454 485
 		}
@@ -457,8 +488,9 @@  discard block
 block discarded – undo
457 488
 
458 489
 		$cacheModel->initialize($cache);
459 490
 		$this->_manager->addCacheModel($cacheModel);
460
-		foreach($node->xpath('flushOnExecute') as $flush)
461
-			$this->loadFlushOnCache($cacheModel, $node, $flush);
491
+		foreach($node->xpath('flushOnExecute') as $flush) {
492
+					$this->loadFlushOnCache($cacheModel, $node, $flush);
493
+		}
462 494
 	}
463 495
 
464 496
 	/**
@@ -469,7 +501,9 @@  discard block
 block discarded – undo
469 501
 	protected function loadFlushInterval($cacheModel, $node)
470 502
 	{
471 503
 		$flushInterval = $node->xpath('flushInterval');
472
-		if($flushInterval === null || count($flushInterval) === 0) return;
504
+		if($flushInterval === null || count($flushInterval) === 0) {
505
+			return;
506
+		}
473 507
 		$duration = 0;
474 508
 		foreach($flushInterval[0]->attributes() as $name => $value)
475 509
 		{
@@ -504,12 +538,14 @@  discard block
 block discarded – undo
504 538
 	protected function loadFlushOnCache($cacheModel, $parent, $node)
505 539
 	{
506 540
 		$id = $cacheModel->getID();
507
-		if(!isset($this->_FlushOnExecuteStatements[$id]))
508
-			$this->_FlushOnExecuteStatements[$id] = [];
541
+		if(!isset($this->_FlushOnExecuteStatements[$id])) {
542
+					$this->_FlushOnExecuteStatements[$id] = [];
543
+		}
509 544
 		foreach($node->attributes() as $name => $value)
510 545
 		{
511
-			if(strtolower($name) === 'statement')
512
-				$this->_FlushOnExecuteStatements[$id][] = (string)$value;
546
+			if(strtolower($name) === 'statement') {
547
+							$this->_FlushOnExecuteStatements[$id][] = (string)$value;
548
+			}
513 549
 		}
514 550
 	}
515 551
 
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -64,20 +64,20 @@  discard block
 block discarded – undo
64 64
 		$this->_configFile = $filename;
65 65
 		$document = $this->loadXmlDocument($filename, $this);
66 66
 
67
-		foreach($document->xpath('//property') as $property)
67
+		foreach ($document->xpath('//property') as $property)
68 68
 			$this->loadGlobalProperty($property);
69 69
 
70
-		foreach($document->xpath('//typeHandler') as $handler)
70
+		foreach ($document->xpath('//typeHandler') as $handler)
71 71
 			$this->loadTypeHandler($handler);
72 72
 
73
-		foreach($document->xpath('//connection[last()]') as $conn)
73
+		foreach ($document->xpath('//connection[last()]') as $conn)
74 74
 			$this->loadDatabaseConnection($conn);
75 75
 
76 76
 		//try to load configuration in the current config file.
77 77
 		$mapping = new TSqlMapXmlMappingConfiguration($this);
78 78
 		$mapping->configure($filename);
79 79
 
80
-		foreach($document->xpath('//sqlMap') as $sqlmap)
80
+		foreach ($document->xpath('//sqlMap') as $sqlmap)
81 81
 			$this->loadSqlMappingFiles($sqlmap);
82 82
 
83 83
 		$this->resolveResultMapping();
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	protected function loadGlobalProperty($node)
92 92
 	{
93
-		$this->_properties[(string)$node['name']] = (string)$node['value'];
93
+		$this->_properties[(string) $node['name']] = (string) $node['value'];
94 94
 	}
95 95
 
96 96
 	/**
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	protected function loadSqlMappingFiles($node)
121 121
 	{
122
-		if(strlen($resource = (string)$node['resource']) > 0)
122
+		if (strlen($resource = (string) $node['resource']) > 0)
123 123
 		{
124
-			if(strpos($resource, '${') !== false)
124
+			if (strpos($resource, '${') !== false)
125 125
 				$resource = $this->replaceProperties($resource);
126 126
 
127 127
 			$mapping = new TSqlMapXmlMappingConfiguration($this);
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
 	protected function resolveResultMapping()
137 137
 	{
138 138
 		$maps = $this->_manager->getResultMaps();
139
-		foreach($maps as $entry)
139
+		foreach ($maps as $entry)
140 140
 		{
141
-			foreach($entry->getColumns() as $item)
141
+			foreach ($entry->getColumns() as $item)
142 142
 			{
143 143
 				$resultMap = $item->getResultMapping();
144
-				if(strlen($resultMap) > 0)
144
+				if (strlen($resultMap) > 0)
145 145
 				{
146
-					if($maps->contains($resultMap))
146
+					if ($maps->contains($resultMap))
147 147
 						$item->setNestedResultMap($maps[$resultMap]);
148 148
 					else
149 149
 						throw new TSqlMapConfigurationException(
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 								$resultMap, $this->_configFile, $entry->getID());
152 152
 				}
153 153
 			}
154
-			if($entry->getDiscriminator() !== null)
154
+			if ($entry->getDiscriminator() !== null)
155 155
 				$entry->getDiscriminator()->initialize($this->_manager);
156 156
 		}
157 157
 	}
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function attachCacheModels()
163 163
 	{
164
-		foreach($this->_manager->getMappedStatements() as $mappedStatement)
164
+		foreach ($this->_manager->getMappedStatements() as $mappedStatement)
165 165
 		{
166
-			if(strlen($model = $mappedStatement->getStatement()->getCacheModel()) > 0)
166
+			if (strlen($model = $mappedStatement->getStatement()->getCacheModel()) > 0)
167 167
 			{
168 168
 				$cache = $this->_manager->getCacheModel($model);
169 169
 				$mappedStatement->getStatement()->setCache($cache);
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function replaceProperties($string)
181 181
 	{
182
-		foreach($this->_properties as $find => $replace)
183
-			$string = str_replace('${' . $find . '}', $replace, $string);
182
+		foreach ($this->_properties as $find => $replace)
183
+			$string = str_replace('${'.$find.'}', $replace, $string);
184 184
 		return $string;
185 185
 	}
186 186
 }
187 187
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -64,21 +64,25 @@  discard block
 block discarded – undo
64 64
 		$this->_configFile = $filename;
65 65
 		$document = $this->loadXmlDocument($filename, $this);
66 66
 
67
-		foreach($document->xpath('//property') as $property)
68
-			$this->loadGlobalProperty($property);
67
+		foreach($document->xpath('//property') as $property) {
68
+					$this->loadGlobalProperty($property);
69
+		}
69 70
 
70
-		foreach($document->xpath('//typeHandler') as $handler)
71
-			$this->loadTypeHandler($handler);
71
+		foreach($document->xpath('//typeHandler') as $handler) {
72
+					$this->loadTypeHandler($handler);
73
+		}
72 74
 
73
-		foreach($document->xpath('//connection[last()]') as $conn)
74
-			$this->loadDatabaseConnection($conn);
75
+		foreach($document->xpath('//connection[last()]') as $conn) {
76
+					$this->loadDatabaseConnection($conn);
77
+		}
75 78
 
76 79
 		//try to load configuration in the current config file.
77 80
 		$mapping = new TSqlMapXmlMappingConfiguration($this);
78 81
 		$mapping->configure($filename);
79 82
 
80
-		foreach($document->xpath('//sqlMap') as $sqlmap)
81
-			$this->loadSqlMappingFiles($sqlmap);
83
+		foreach($document->xpath('//sqlMap') as $sqlmap) {
84
+					$this->loadSqlMappingFiles($sqlmap);
85
+		}
82 86
 
83 87
 		$this->resolveResultMapping();
84 88
 		$this->attachCacheModels();
@@ -121,8 +125,9 @@  discard block
 block discarded – undo
121 125
 	{
122 126
 		if(strlen($resource = (string)$node['resource']) > 0)
123 127
 		{
124
-			if(strpos($resource, '${') !== false)
125
-				$resource = $this->replaceProperties($resource);
128
+			if(strpos($resource, '${') !== false) {
129
+							$resource = $this->replaceProperties($resource);
130
+			}
126 131
 
127 132
 			$mapping = new TSqlMapXmlMappingConfiguration($this);
128 133
 			$filename = $this->getAbsoluteFilePath($this->_configFile, $resource);
@@ -143,16 +148,18 @@  discard block
 block discarded – undo
143 148
 				$resultMap = $item->getResultMapping();
144 149
 				if(strlen($resultMap) > 0)
145 150
 				{
146
-					if($maps->contains($resultMap))
147
-						$item->setNestedResultMap($maps[$resultMap]);
148
-					else
149
-						throw new TSqlMapConfigurationException(
151
+					if($maps->contains($resultMap)) {
152
+											$item->setNestedResultMap($maps[$resultMap]);
153
+					} else {
154
+											throw new TSqlMapConfigurationException(
150 155
 							'sqlmap_unable_to_find_result_mapping',
151 156
 								$resultMap, $this->_configFile, $entry->getID());
157
+					}
152 158
 				}
153 159
 			}
154
-			if($entry->getDiscriminator() !== null)
155
-				$entry->getDiscriminator()->initialize($this->_manager);
160
+			if($entry->getDiscriminator() !== null) {
161
+							$entry->getDiscriminator()->initialize($this->_manager);
162
+			}
156 163
 		}
157 164
 	}
158 165
 
@@ -179,8 +186,9 @@  discard block
 block discarded – undo
179 186
 	 */
180 187
 	public function replaceProperties($string)
181 188
 	{
182
-		foreach($this->_properties as $find => $replace)
183
-			$string = str_replace('${' . $find . '}', $replace, $string);
189
+		foreach($this->_properties as $find => $replace) {
190
+					$string = str_replace('${' . $find . '}', $replace, $string);
191
+		}
184 192
 		return $string;
185 193
 	}
186 194
 }
187 195
\ No newline at end of file
Please login to merge, or discard this patch.