Completed
Push — namespace2 ( 791eac...5c23fb )
by Fabio
08:41
created
framework/Web/Javascripts/JSMin.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -191,8 +191,7 @@  discard block
 block discarded – undo
191 191
             default:
192 192
               if ($this->isAlphaNum($this->b)) {
193 193
                 $this->action(1);
194
-              }
195
-              else {
194
+              } else {
196 195
                 $this->action(2);
197 196
               }
198 197
           }
@@ -224,8 +223,7 @@  discard block
 block discarded – undo
224 223
                 default:
225 224
                   if ($this->isAlphaNum($this->a)) {
226 225
                     $this->action(1);
227
-                  }
228
-                  else {
226
+                  } else {
229 227
                     $this->action(3);
230 228
                   }
231 229
               }
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -45,29 +45,29 @@  discard block
 block discarded – undo
45 45
  */
46 46
 
47 47
 class JSMin {
48
-  const ORD_LF    = 10;
49
-  const ORD_SPACE = 32;
48
+  const ORD_LF=10;
49
+  const ORD_SPACE=32;
50 50
 
51
-  protected $a           = '';
52
-  protected $b           = '';
53
-  protected $input       = '';
54
-  protected $inputIndex  = 0;
55
-  protected $inputLength = 0;
56
-  protected $lookAhead   = null;
57
-  protected $output      = '';
51
+  protected $a='';
52
+  protected $b='';
53
+  protected $input='';
54
+  protected $inputIndex=0;
55
+  protected $inputLength=0;
56
+  protected $lookAhead=null;
57
+  protected $output='';
58 58
 
59 59
   // -- Public Static Methods --------------------------------------------------
60 60
 
61 61
   public static function minify($js) {
62
-    $jsmin = new JSMin($js);
62
+    $jsmin=new JSMin($js);
63 63
     return $jsmin->min();
64 64
   }
65 65
 
66 66
   // -- Public Instance Methods ------------------------------------------------
67 67
 
68 68
   public function __construct($input) {
69
-    $this->input       = str_replace("\r\n", "\n", $input);
70
-    $this->inputLength = strlen($this->input);
69
+    $this->input=str_replace("\r\n", "\n", $input);
70
+    $this->inputLength=strlen($this->input);
71 71
   }
72 72
 
73 73
   // -- Protected Instance Methods ---------------------------------------------
@@ -75,80 +75,80 @@  discard block
 block discarded – undo
75 75
   protected function action($d) {
76 76
     switch($d) {
77 77
       case 1:
78
-        $this->output .= $this->a;
78
+        $this->output.=$this->a;
79 79
 
80 80
       case 2:
81
-        $this->a = $this->b;
81
+        $this->a=$this->b;
82 82
 
83
-        if ($this->a === "'" || $this->a === '"') {
84
-          for (;;) {
85
-            $this->output .= $this->a;
86
-            $this->a       = $this->get();
83
+        if($this->a==="'" || $this->a==='"') {
84
+          for(;;) {
85
+            $this->output.=$this->a;
86
+            $this->a=$this->get();
87 87
 
88
-            if ($this->a === $this->b) {
88
+            if($this->a===$this->b) {
89 89
               break;
90 90
             }
91 91
 
92
-            if (ord($this->a) <= self::ORD_LF) {
92
+            if(ord($this->a) <= self::ORD_LF) {
93 93
               throw new JSMinException('Unterminated string literal.');
94 94
             }
95 95
 
96
-            if ($this->a === '\\') {
97
-              $this->output .= $this->a;
98
-              $this->a       = $this->get();
96
+            if($this->a==='\\') {
97
+              $this->output.=$this->a;
98
+              $this->a=$this->get();
99 99
             }
100 100
           }
101 101
         }
102 102
 
103 103
       case 3:
104
-        $this->b = $this->next();
104
+        $this->b=$this->next();
105 105
 
106
-        if ($this->b === '/' && (
107
-            $this->a === '(' || $this->a === ',' || $this->a === '=' ||
108
-            $this->a === ':' || $this->a === '[' || $this->a === '!' ||
109
-            $this->a === '&' || $this->a === '|' || $this->a === '?')) {
106
+        if($this->b==='/' && (
107
+            $this->a==='(' || $this->a===',' || $this->a==='=' ||
108
+            $this->a===':' || $this->a==='[' || $this->a==='!' ||
109
+            $this->a==='&' || $this->a==='|' || $this->a==='?')) {
110 110
 
111
-          $this->output .= $this->a . $this->b;
111
+          $this->output.=$this->a.$this->b;
112 112
 
113
-          for (;;) {
114
-            $this->a = $this->get();
113
+          for(;;) {
114
+            $this->a=$this->get();
115 115
 
116
-            if ($this->a === '/') {
116
+            if($this->a==='/') {
117 117
               break;
118
-            } elseif ($this->a === '\\') {
119
-              $this->output .= $this->a;
120
-              $this->a       = $this->get();
121
-            } elseif (ord($this->a) <= self::ORD_LF) {
118
+            } elseif($this->a==='\\') {
119
+              $this->output.=$this->a;
120
+              $this->a=$this->get();
121
+            } elseif(ord($this->a) <= self::ORD_LF) {
122 122
               throw new JSMinException('Unterminated regular expression '.
123 123
                   'literal.');
124 124
             }
125 125
 
126
-            $this->output .= $this->a;
126
+            $this->output.=$this->a;
127 127
           }
128 128
 
129
-          $this->b = $this->next();
129
+          $this->b=$this->next();
130 130
         }
131 131
     }
132 132
   }
133 133
 
134 134
   protected function get() {
135
-    $c = $this->lookAhead;
136
-    $this->lookAhead = null;
135
+    $c=$this->lookAhead;
136
+    $this->lookAhead=null;
137 137
 
138
-    if ($c === null) {
139
-      if ($this->inputIndex < $this->inputLength) {
140
-        $c = $this->input[$this->inputIndex];
141
-        $this->inputIndex += 1;
138
+    if($c===null) {
139
+      if($this->inputIndex < $this->inputLength) {
140
+        $c=$this->input[$this->inputIndex];
141
+        $this->inputIndex+=1;
142 142
       } else {
143
-        $c = null;
143
+        $c=null;
144 144
       }
145 145
     }
146 146
 
147
-    if ($c === "\r") {
147
+    if($c==="\r") {
148 148
       return "\n";
149 149
     }
150 150
 
151
-    if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) {
151
+    if($c===null || $c==="\n" || ord($c) >= self::ORD_SPACE) {
152 152
       return $c;
153 153
     }
154 154
 
@@ -156,17 +156,17 @@  discard block
 block discarded – undo
156 156
   }
157 157
 
158 158
   protected function isAlphaNum($c) {
159
-    return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
159
+    return ord($c) > 126 || $c==='\\' || preg_match('/^[\w\$]$/', $c)===1;
160 160
   }
161 161
 
162 162
   protected function min() {
163
-    $this->a = "\n";
163
+    $this->a="\n";
164 164
     $this->action(3);
165 165
 
166
-    while ($this->a !== null) {
167
-      switch ($this->a) {
166
+    while($this->a!==null) {
167
+      switch($this->a) {
168 168
         case ' ':
169
-          if ($this->isAlphaNum($this->b)) {
169
+          if($this->isAlphaNum($this->b)) {
170 170
             $this->action(1);
171 171
           } else {
172 172
             $this->action(2);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
           break;
175 175
 
176 176
         case "\n":
177
-          switch ($this->b) {
177
+          switch($this->b) {
178 178
             case '{':
179 179
             case '[':
180 180
             case '(':
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
               break;
189 189
 
190 190
             default:
191
-              if ($this->isAlphaNum($this->b)) {
191
+              if($this->isAlphaNum($this->b)) {
192 192
                 $this->action(1);
193 193
               }
194 194
               else {
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
           break;
199 199
 
200 200
         default:
201
-          switch ($this->b) {
201
+          switch($this->b) {
202 202
             case ' ':
203
-              if ($this->isAlphaNum($this->a)) {
203
+              if($this->isAlphaNum($this->a)) {
204 204
                 $this->action(1);
205 205
                 break;
206 206
               }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
               break;
210 210
 
211 211
             case "\n":
212
-              switch ($this->a) {
212
+              switch($this->a) {
213 213
                 case '}':
214 214
                 case ']':
215 215
                 case ')':
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
                   break;
222 222
 
223 223
                 default:
224
-                  if ($this->isAlphaNum($this->a)) {
224
+                  if($this->isAlphaNum($this->a)) {
225 225
                     $this->action(1);
226 226
                   }
227 227
                   else {
@@ -241,15 +241,15 @@  discard block
 block discarded – undo
241 241
   }
242 242
 
243 243
   protected function next() {
244
-    $c = $this->get();
244
+    $c=$this->get();
245 245
 
246
-    if ($c === '/') {
246
+    if($c==='/') {
247 247
       switch($this->peek()) {
248 248
         case '/':
249
-          for (;;) {
250
-            $c = $this->get();
249
+          for(;;) {
250
+            $c=$this->get();
251 251
 
252
-            if (ord($c) <= self::ORD_LF) {
252
+            if(ord($c) <= self::ORD_LF) {
253 253
               return $c;
254 254
             }
255 255
           }
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
         case '*':
258 258
           $this->get();
259 259
 
260
-          for (;;) {
260
+          for(;;) {
261 261
             switch($this->get()) {
262 262
               case '*':
263
-                if ($this->peek() === '/') {
263
+                if($this->peek()==='/') {
264 264
                   $this->get();
265 265
                   return ' ';
266 266
                 }
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
   }
281 281
 
282 282
   protected function peek() {
283
-    $this->lookAhead = $this->get();
283
+    $this->lookAhead=$this->get();
284 284
     return $this->lookAhead;
285 285
   }
286 286
 }
287 287
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php 2 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -129,28 +129,24 @@
 block discarded – undo
129 129
 			{
130 130
 				$param->setData($data);
131 131
 				$this->_nextPageList = null;
132
-			}
133
-			else
132
+			} else
134 133
 			{
135 134
 				$param->setData(array_slice($data, 0, $pageSize));
136 135
 				$this->_nextPageList = array_slice($data, $pageSize-1,$total);
137 136
 			}
138
-		}
139
-		else
137
+		} else
140 138
 		{
141 139
 			if($total <= $pageSize)
142 140
 			{
143 141
 				$this->_prevPageList = array_slice($data, 0, $total);
144 142
 				$param->setData(array());
145 143
 				$this->_nextPageList = null;
146
-			}
147
-			else if($total <= $pageSize*2)
144
+			} else if($total <= $pageSize*2)
148 145
 			{
149 146
 				$this->_prevPageList = array_slice($data, 0, $pageSize);
150 147
 				$param->setData(array_slice($data, $pageSize, $total));
151 148
 				$this->_nextPageList = null;
152
-			}
153
-			else
149
+			} else
154 150
 			{
155 151
 				$this->_prevPageList = array_slice($data, 0, $pageSize);
156 152
 				$param->setData(array_slice($data, $pageSize, $pageSize));
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 	 * @param mixed delegate for each data row retrieved.
42 42
 	 * @param int number of page to fetch on initialization
43 43
 	 */
44
-	public function __construct(IMappedStatement $statement,$parameter, $pageSize, $delegate=null, $page=0)
44
+	public function __construct(IMappedStatement $statement, $parameter, $pageSize, $delegate=null, $page=0)
45 45
 	{
46 46
 		parent::__construct();
47 47
 		parent::setCustomPaging(true);
48
-		$this->initialize($statement,$parameter, $pageSize, $page);
48
+		$this->initialize($statement, $parameter, $pageSize, $page);
49 49
 		$this->_delegate=$delegate;
50 50
 	}
51 51
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	protected function initialize($statement, $parameter, $pageSize, $page)
60 60
 	{
61
-		$this->_statement = $statement;
62
-		$this->_parameter = $parameter;
61
+		$this->_statement=$statement;
62
+		$this->_parameter=$parameter;
63 63
 		$this->setPageSize($pageSize);
64 64
 		$this->attachEventHandler('OnFetchData', array($this, 'fetchDataFromStatement'));
65 65
 		$this->gotoPage($page);
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	protected function fetchDataFromStatement($sender, $param)
82 82
 	{
83
-		$limit = $this->getOffsetAndLimit($param);
84
-		$connection = $this->_statement->getManager()->getDbConnection();
85
-		$data = $this->_statement->executeQueryForList($connection,
83
+		$limit=$this->getOffsetAndLimit($param);
84
+		$connection=$this->_statement->getManager()->getDbConnection();
85
+		$data=$this->_statement->executeQueryForList($connection,
86 86
 						$this->_parameter, null, $limit[0], $limit[1], $this->_delegate);
87 87
 		$this->populateData($param, $data);
88 88
 	}
@@ -112,49 +112,49 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	protected function populateData($param, $data)
114 114
 	{
115
-		$total = $data instanceof TList ? $data->getCount() : count($data);
116
-		$pageSize = $this->getPageSize();
115
+		$total=$data instanceof TList ? $data->getCount() : count($data);
116
+		$pageSize=$this->getPageSize();
117 117
 		if($total < 1)
118 118
 		{
119 119
 			$param->setData($data);
120
-			$this->_prevPageList = null;
121
-			$this->_nextPageList = null;
120
+			$this->_prevPageList=null;
121
+			$this->_nextPageList=null;
122 122
 			return;
123 123
 		}
124 124
 
125 125
 		if($param->getNewPageIndex() < 1)
126 126
 		{
127
-			$this->_prevPageList = null;
127
+			$this->_prevPageList=null;
128 128
 			if($total <= $pageSize)
129 129
 			{
130 130
 				$param->setData($data);
131
-				$this->_nextPageList = null;
131
+				$this->_nextPageList=null;
132 132
 			}
133 133
 			else
134 134
 			{
135 135
 				$param->setData(array_slice($data, 0, $pageSize));
136
-				$this->_nextPageList = array_slice($data, $pageSize-1,$total);
136
+				$this->_nextPageList=array_slice($data, $pageSize - 1, $total);
137 137
 			}
138 138
 		}
139 139
 		else
140 140
 		{
141 141
 			if($total <= $pageSize)
142 142
 			{
143
-				$this->_prevPageList = array_slice($data, 0, $total);
143
+				$this->_prevPageList=array_slice($data, 0, $total);
144 144
 				$param->setData(array());
145
-				$this->_nextPageList = null;
145
+				$this->_nextPageList=null;
146 146
 			}
147
-			else if($total <= $pageSize*2)
147
+			else if($total <= $pageSize * 2)
148 148
 			{
149
-				$this->_prevPageList = array_slice($data, 0, $pageSize);
149
+				$this->_prevPageList=array_slice($data, 0, $pageSize);
150 150
 				$param->setData(array_slice($data, $pageSize, $total));
151
-				$this->_nextPageList = null;
151
+				$this->_nextPageList=null;
152 152
 			}
153 153
 			else
154 154
 			{
155
-				$this->_prevPageList = array_slice($data, 0, $pageSize);
155
+				$this->_prevPageList=array_slice($data, 0, $pageSize);
156 156
 				$param->setData(array_slice($data, $pageSize, $pageSize));
157
-				$this->_nextPageList = array_slice($data, $pageSize*2, $total-$pageSize*2);
157
+				$this->_nextPageList=array_slice($data, $pageSize * 2, $total - $pageSize * 2);
158 158
 			}
159 159
 		}
160 160
 	}
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	 */
167 167
 	protected function getOffsetAndLimit($param)
168 168
 	{
169
-		$index = $param->getNewPageIndex();
170
-		$pageSize = $this->getPageSize();
171
-		return $index < 1 ? array($index, $pageSize*2) : array(($index-1)*$pageSize, $pageSize*3);
169
+		$index=$param->getNewPageIndex();
170
+		$pageSize=$this->getPageSize();
171
+		return $index < 1 ? array($index, $pageSize * 2) : array(($index - 1) * $pageSize, $pageSize * 3);
172 172
 	}
173 173
 
174 174
 	/**
Please login to merge, or discard this patch.
framework/Data/DataGateway/TTableGateway.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -416,8 +416,7 @@
 block discarded – undo
416 416
 		{
417 417
 			$useArgs = !is_array($parameters) && is_array($args);
418 418
 			return new TSqlCriteria($criteria,$useArgs ? $args : $parameters);
419
-		}
420
-		else if($criteria instanceof TSqlCriteria)
419
+		} else if($criteria instanceof TSqlCriteria)
421 420
 			return $criteria;
422 421
 		else
423 422
 			throw new TDbException('dbtablegateway_invalid_criteria');
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param string|TDbTableInfo table or view name or table information.
88 88
 	 * @param TDbConnection database connection.
89 89
 	 */
90
-	public function __construct($table,$connection)
90
+	public function __construct($table, $connection)
91 91
 	{
92 92
 		$this->_connection=$connection;
93 93
 		if(is_string($table))
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function setTableInfo($tableInfo)
105 105
 	{
106
-		$builder = $tableInfo->createCommandBuilder($this->getDbConnection());
106
+		$builder=$tableInfo->createCommandBuilder($this->getDbConnection());
107 107
 		$this->initCommandBuilder($builder);
108 108
 	}
109 109
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	protected function setTableName($tableName)
115 115
 	{
116 116
 		Prado::using('System.Data.Common.TDbMetaData');
117
-		$meta = TDbMetaData::getInstance($this->getDbConnection());
117
+		$meta=TDbMetaData::getInstance($this->getDbConnection());
118 118
 		$this->initCommandBuilder($meta->createCommandBuilder($tableName));
119 119
 	}
120 120
 
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	protected function initCommandBuilder($builder)
135 135
 	{
136
-		$this->_command = new TDataGatewayCommand($builder);
137
-		$this->_command->OnCreateCommand[] = array($this, 'onCreateCommand');
138
-		$this->_command->OnExecuteCommand[] = array($this, 'onExecuteCommand');
136
+		$this->_command=new TDataGatewayCommand($builder);
137
+		$this->_command->OnCreateCommand[]=array($this, 'onCreateCommand');
138
+		$this->_command->OnExecuteCommand[]=array($this, 'onExecuteCommand');
139 139
 	}
140 140
 
141 141
 	/**
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 */
190 190
 	public function findBySql($sql, $parameters=array())
191 191
 	{
192
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
193
-		$criteria = $this->getCriteria($sql,$parameters, $args);
192
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
193
+		$criteria=$this->getCriteria($sql, $parameters, $args);
194 194
 		return $this->getCommand()->findBySql($criteria);
195 195
 	}
196 196
 
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function findAllBySql($sql, $parameters=array())
204 204
 	{
205
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
206
-		$criteria = $this->getCriteria($sql,$parameters, $args);
205
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
206
+		$criteria=$this->getCriteria($sql, $parameters, $args);
207 207
 		return $this->getCommand()->findAllBySql($criteria);
208 208
 	}
209 209
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function find($criteria, $parameters=array())
228 228
 	{
229
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
230
-		$criteria = $this->getCriteria($criteria,$parameters, $args);
229
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
230
+		$criteria=$this->getCriteria($criteria, $parameters, $args);
231 231
 		return $this->getCommand()->find($criteria);
232 232
 	}
233 233
 
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	public function findAll($criteria=null, $parameters=array())
241 241
 	{
242
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
242
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
243 243
 		if($criteria!==null)
244
-			$criteria = $this->getCriteria($criteria,$parameters, $args);
244
+			$criteria=$this->getCriteria($criteria, $parameters, $args);
245 245
 		return $this->getCommand()->findAll($criteria);
246 246
 	}
247 247
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	public function findByPk($keys)
261 261
 	{
262 262
 		if(func_num_args() > 1)
263
-			$keys = func_get_args();
263
+			$keys=func_get_args();
264 264
 		return $this->getCommand()->findByPk($keys);
265 265
 	}
266 266
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 	public function findAllByPks($keys)
285 285
 	{
286 286
 		if(func_num_args() > 1)
287
-			$keys = func_get_args();
287
+			$keys=func_get_args();
288 288
 		return $this->getCommand()->findAllByPk($keys);
289 289
 	}
290 290
 
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
 	 */
302 302
 	public function deleteAll($criteria, $parameters=array())
303 303
 	{
304
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
305
-		$criteria = $this->getCriteria($criteria,$parameters, $args);
304
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
305
+		$criteria=$this->getCriteria($criteria, $parameters, $args);
306 306
 		return $this->getCommand()->delete($criteria);
307 307
 	}
308 308
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	public function deleteByPk($keys)
333 333
 	{
334 334
 		if(func_num_args() > 1)
335
-			$keys = func_get_args();
335
+			$keys=func_get_args();
336 336
 		return $this->getCommand()->deleteByPk($keys);
337 337
 	}
338 338
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	public function deleteAllByPks($keys)
343 343
 	{
344 344
 		if(func_num_args() > 1)
345
-			$keys = func_get_args();
345
+			$keys=func_get_args();
346 346
 		return $this->deleteByPk($keys);
347 347
 	}
348 348
 
@@ -352,11 +352,11 @@  discard block
 block discarded – undo
352 352
 	 * @param mixed parameter values.
353 353
 	 * @return int number of records.
354 354
 	 */
355
-	public function count($criteria=null,$parameters=array())
355
+	public function count($criteria=null, $parameters=array())
356 356
 	{
357
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
357
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
358 358
 		if($criteria!==null)
359
-			$criteria = $this->getCriteria($criteria,$parameters, $args);
359
+			$criteria=$this->getCriteria($criteria, $parameters, $args);
360 360
 		return $this->getCommand()->count($criteria);
361 361
 	}
362 362
 
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	public function update($data, $criteria, $parameters=array())
378 378
 	{
379
-		$args = func_num_args() > 2 ? array_slice(func_get_args(),2) : null;
380
-		$criteria = $this->getCriteria($criteria,$parameters, $args);
379
+		$args=func_num_args() > 2 ? array_slice(func_get_args(), 2) : null;
380
+		$criteria=$this->getCriteria($criteria, $parameters, $args);
381 381
 		return $this->getCommand()->update($data, $criteria);
382 382
 	}
383 383
 
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 	{
415 415
 		if(is_string($criteria))
416 416
 		{
417
-			$useArgs = !is_array($parameters) && is_array($args);
418
-			return new TSqlCriteria($criteria,$useArgs ? $args : $parameters);
417
+			$useArgs=!is_array($parameters) && is_array($args);
418
+			return new TSqlCriteria($criteria, $useArgs ? $args : $parameters);
419 419
 		}
420 420
 		else if($criteria instanceof TSqlCriteria)
421 421
 			return $criteria;
@@ -452,21 +452,21 @@  discard block
 block discarded – undo
452 452
 	 * @return mixed single record if method name starts with "findBy", 0 or more records
453 453
 	 * if method name starts with "findAllBy"
454 454
 	 */
455
-	public function __call($method,$args)
455
+	public function __call($method, $args)
456 456
 	{
457
-		$delete =false;
458
-		if($findOne = substr(strtolower($method),0,6)==='findby')
459
-			$condition = $method[6]==='_' ? substr($method,7) : substr($method,6);
460
-		else if(substr(strtolower($method),0,9)==='findallby')
461
-			$condition = $method[9]==='_' ? substr($method,10) : substr($method,9);
462
-		else if($delete = substr(strtolower($method),0,8)==='deleteby')
463
-			$condition = $method[8]==='_' ? substr($method,9) : substr($method,8);
464
-		else if($delete = substr(strtolower($method),0,11)==='deleteallby')
465
-			$condition = $method[11]==='_' ? substr($method,12) : substr($method,11);
457
+		$delete=false;
458
+		if($findOne=substr(strtolower($method), 0, 6)==='findby')
459
+			$condition=$method[6]==='_' ? substr($method, 7) : substr($method, 6);
460
+		else if(substr(strtolower($method), 0, 9)==='findallby')
461
+			$condition=$method[9]==='_' ? substr($method, 10) : substr($method, 9);
462
+		else if($delete=substr(strtolower($method), 0, 8)==='deleteby')
463
+			$condition=$method[8]==='_' ? substr($method, 9) : substr($method, 8);
464
+		else if($delete=substr(strtolower($method), 0, 11)==='deleteallby')
465
+			$condition=$method[11]==='_' ? substr($method, 12) : substr($method, 11);
466 466
 		else
467 467
 			return null;
468 468
 
469
-		$criteria = $this->getCommand()->createCriteriaFromString($method, $condition, $args);
469
+		$criteria=$this->getCommand()->createCriteriaFromString($method, $condition, $args);
470 470
 		if($delete)
471 471
 			return $this->deleteAll($criteria);
472 472
 		else
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/InputBuilder/TSqliteScaffoldInput.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
 		if ($this->sourcepath === NULL)
59 59
 		{
60 60
 			$this->sourcepath = $sourcepath;
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->sourcepath->append($sourcepath);
65 64
 		}
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			case 'datetime': case 'timestamp':
38 38
 				return $this->createDateTimeControl($container, $column, $record);
39 39
 			default:
40
-				return $this->createDefaultControl($container,$column, $record);
40
+				return $this->createDefaultControl($container, $column, $record);
41 41
 		}
42 42
 	}
43 43
 
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
 			case 'time':
55 55
 				return $this->getTimeValue($container, $column, $record);
56 56
 			case 'datetime': case 'timestamp':
57
-				return $this->getDateTimeValue($container,$column, $record);
57
+				return $this->getDateTimeValue($container, $column, $record);
58 58
 			default:
59
-				return $this->getDefaultControlValue($container,$column, $record);
59
+				return $this->getDefaultControlValue($container, $column, $record);
60 60
 		}
61 61
 	}
62 62
 
63 63
 	protected function createDateControl($container, $column, $record)
64 64
 	{
65
-		$control = parent::createDateControl($container, $column, $record);
66
-		$value = $this->getRecordPropertyValue($column, $record);
65
+		$control=parent::createDateControl($container, $column, $record);
66
+		$value=$this->getRecordPropertyValue($column, $record);
67 67
 		if(!empty($value) && preg_match('/timestamp/i', $column->getDbType()))
68 68
 			$control->setTimestamp(intval($value));
69 69
 		return $control;
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 
72 72
 	protected function createDateTimeControl($container, $column, $record)
73 73
 	{
74
-		$value = $this->getRecordPropertyValue($column, $record);
75
-		$time = parent::createDateTimeControl($container, $column, $record);
74
+		$value=$this->getRecordPropertyValue($column, $record);
75
+		$time=parent::createDateTimeControl($container, $column, $record);
76 76
 		if(!empty($value) && preg_match('/timestamp/i', $column->getDbType()))
77 77
 		{
78
-			$s = new TDateTimeStamp;
79
-			$date = $s->getDate(intval($value));
78
+			$s=new TDateTimeStamp;
79
+			$date=$s->getDate(intval($value));
80 80
 			$time[1]->setSelectedValue($date['hours']);
81 81
 			$time[2]->setSelectedValue($date['minutes']);
82 82
 			$time[3]->setSelectedValue($date['seconds']);
@@ -88,13 +88,13 @@  discard block
 block discarded – undo
88 88
 	{
89 89
 		if(preg_match('/timestamp/i', $column->getDbType()))
90 90
 		{
91
-			$time = $container->findControl(self::DEFAULT_ID)->getTimestamp();
92
-			$s = new TDateTimeStamp;
93
-			$date = $s->getDate($time);
94
-			$hour = $container->findControl('scaffold_time_hour')->getSelectedValue();
95
-			$mins = $container->findControl('scaffold_time_min')->getSelectedValue();
96
-			$secs = $container->findControl('scaffold_time_sec')->getSelectedValue();
97
-			return $s->getTimeStamp($hour,$mins,$secs,$date['mon'],$date['mday'],$date['year']);
91
+			$time=$container->findControl(self::DEFAULT_ID)->getTimestamp();
92
+			$s=new TDateTimeStamp;
93
+			$date=$s->getDate($time);
94
+			$hour=$container->findControl('scaffold_time_hour')->getSelectedValue();
95
+			$mins=$container->findControl('scaffold_time_min')->getSelectedValue();
96
+			$secs=$container->findControl('scaffold_time_sec')->getSelectedValue();
97
+			return $s->getTimeStamp($hour, $mins, $secs, $date['mon'], $date['mday'], $date['year']);
98 98
 		}
99 99
 		else
100 100
 			return parent::getDateTimeValue($container, $column, $record);
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php 2 patches
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@  discard block
 block discarded – undo
115 115
 			$columns = $this->getTableInfo()->getColumns();
116 116
 			$this->getInputRepeater()->setDataSource($columns);
117 117
 			$this->getInputRepeater()->dataBind();
118
-		}
119
-		else
118
+		} else
120 119
 		{
121 120
 			if($this->_editRenderer===null)
122 121
 				$this->createEditRenderer($record, $classPath);
@@ -140,8 +139,7 @@  discard block
 block discarded – undo
140 139
 			$index = $this->getControls()->remove($this->getInputRepeater());
141 140
 			$this->getControls()->insertAt($index,$this->_editRenderer);
142 141
 			$this->_editRenderer->setData($record);
143
-		}
144
-		else
142
+		} else
145 143
 		{
146 144
 			throw new TConfigurationException(
147 145
 				'scaffold_invalid_edit_renderer', $this->getID(), get_class($record));
@@ -204,15 +202,13 @@  discard block
 block discarded – undo
204 202
 					$column = $table->getColumn($item->getCustomData());
205 203
 					$builder->loadScaffoldInput($this, $item, $column, $record);
206 204
 				}
207
-			}
208
-			else
205
+			} else
209 206
 			{
210 207
 				$this->_editRenderer->updateRecord($record);
211 208
 			}
212 209
 			$record->save();
213 210
 			return true;
214
-		}
215
-		else if($this->_editRenderer!==null)
211
+		} else if($this->_editRenderer!==null)
216 212
 		{
217 213
 			//preserve the form data.
218 214
 			$this->_editRenderer->updateRecord($this->getCurrentRecord());
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	public function setRecordPk($value)
84 84
 	{
85 85
 		$this->clearRecordObject();
86
-		$val = TPropertyValue::ensureArray($value);
86
+		$val=TPropertyValue::ensureArray($value);
87 87
 		$this->setViewState('PK', count($val) > 0 ? $val : null);
88 88
 	}
89 89
 
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function initializeEditForm()
110 110
 	{
111
-		$record = $this->getCurrentRecord();
112
-		$classPath = $this->getEditRenderer();
113
-		if($classPath === '')
111
+		$record=$this->getCurrentRecord();
112
+		$classPath=$this->getEditRenderer();
113
+		if($classPath==='')
114 114
 		{
115
-			$columns = $this->getTableInfo()->getColumns();
115
+			$columns=$this->getTableInfo()->getColumns();
116 116
 			$this->getInputRepeater()->setDataSource($columns);
117 117
 			$this->getInputRepeater()->dataBind();
118 118
 		}
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	protected function createEditRenderer($record, $classPath)
136 136
 	{
137
-		$this->_editRenderer = Prado::createComponent($classPath);
137
+		$this->_editRenderer=Prado::createComponent($classPath);
138 138
 		if($this->_editRenderer instanceof IScaffoldEditRenderer)
139 139
 		{
140
-			$index = $this->getControls()->remove($this->getInputRepeater());
141
-			$this->getControls()->insertAt($index,$this->_editRenderer);
140
+			$index=$this->getControls()->remove($this->getInputRepeater());
141
+			$this->getControls()->insertAt($index, $this->_editRenderer);
142 142
 			$this->_editRenderer->setData($record);
143 143
 		}
144 144
 		else
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
 	 */
154 154
 	protected function createRepeaterEditItem($sender, $param)
155 155
 	{
156
-		$type = $param->getItem()->getItemType();
156
+		$type=$param->getItem()->getItemType();
157 157
 		if($type==TListItemType::Item || $type==TListItemType::AlternatingItem)
158 158
 		{
159
-			$item = $param->getItem();
160
-			$column = $item->getDataItem();
159
+			$item=$param->getItem();
160
+			$column=$item->getDataItem();
161 161
 			if($column===null)
162 162
 				return;
163 163
 
164
-			$record = $this->getCurrentRecord();
165
-			$builder = $this->getScaffoldInputBuilder($record);
164
+			$record=$this->getCurrentRecord();
165
+			$builder=$this->getScaffoldInputBuilder($record);
166 166
 			$builder->createScaffoldInput($this, $item, $column, $record);
167 167
 		}
168 168
 	}
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 	{
195 195
 		if($this->getPage()->getIsValid())
196 196
 		{
197
-			$record = $this->getCurrentRecord();
197
+			$record=$this->getCurrentRecord();
198 198
 			if($this->_editRenderer===null)
199 199
 			{
200
-				$table = $this->getTableInfo();
201
-				$builder = $this->getScaffoldInputBuilder($record);
200
+				$table=$this->getTableInfo();
201
+				$builder=$this->getScaffoldInputBuilder($record);
202 202
 				foreach($this->getInputRepeater()->getItems() as $item)
203 203
 				{
204
-					$column = $table->getColumn($item->getCustomData());
204
+					$column=$table->getColumn($item->getCustomData());
205 205
 					$builder->loadScaffoldInput($this, $item, $column, $record);
206 206
 				}
207 207
 			}
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
 	protected function getScaffoldInputBuilder($record)
266 266
 	{
267 267
 		static $_builders=array();
268
-		$class = get_class($record);
268
+		$class=get_class($record);
269 269
 		if(!isset($_builders[$class]))
270 270
 		{
271 271
 			Prado::using('System.Data.ActiveRecord.Scaffold.InputBuilder.TScaffoldInputBase');
272
-			$_builders[$class] = TScaffoldInputBase::createInputBuilder($record);
272
+			$_builders[$class]=TScaffoldInputBase::createInputBuilder($record);
273 273
 		}
274 274
 		return $_builders[$class];
275 275
 	}
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecordGateway.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,16 +67,14 @@
 block discarded – undo
67 67
 				throw new TActiveRecordException('ar_invalid_tablename_property',
68 68
 					get_class($record),self::TABLE_CONST);
69 69
 			return $value;
70
-		}
71
-		elseif ($class->hasMethod(self::TABLE_METHOD))
70
+		} elseif ($class->hasMethod(self::TABLE_METHOD))
72 71
 		{
73 72
 			$value = $record->{self::TABLE_METHOD}();
74 73
 			if(empty($value))
75 74
 				throw new TActiveRecordException('ar_invalid_tablename_method',
76 75
 					get_class($record),self::TABLE_METHOD);
77 76
 			return $value;
78
-		}
79
-		else
77
+		} else
80 78
 			return strtolower(get_class($record));
81 79
 	}
82 80
 
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	protected function getRecordTableName(TActiveRecord $record)
72 72
 	{
73
-		$class = new ReflectionClass($record);
73
+		$class=new ReflectionClass($record);
74 74
 		if($class->hasConstant(self::TABLE_CONST))
75 75
 		{
76
-			$value = $class->getConstant(self::TABLE_CONST);
76
+			$value=$class->getConstant(self::TABLE_CONST);
77 77
 			if(empty($value))
78 78
 				throw new TActiveRecordException('ar_invalid_tablename_property',
79
-					get_class($record),self::TABLE_CONST);
79
+					get_class($record), self::TABLE_CONST);
80 80
 			return $value;
81 81
 		}
82
-		elseif ($class->hasMethod(self::TABLE_METHOD))
82
+		elseif($class->hasMethod(self::TABLE_METHOD))
83 83
 		{
84
-			$value = $record->{self::TABLE_METHOD}();
84
+			$value=$record->{self::TABLE_METHOD}();
85 85
 			if(empty($value))
86 86
 				throw new TActiveRecordException('ar_invalid_tablename_method',
87
-					get_class($record),self::TABLE_METHOD);
87
+					get_class($record), self::TABLE_METHOD);
88 88
 			return $value;
89 89
 		}
90 90
 		else
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function getRecordTableInfo(TActiveRecord $record)
100 100
 	{
101
-		$tableName = $this->getRecordTableName($record);
101
+		$tableName=$this->getRecordTableName($record);
102 102
 		return $this->getTableInfo($record->getDbConnection(), $tableName);
103 103
 	}
104 104
 
@@ -110,27 +110,27 @@  discard block
 block discarded – undo
110 110
 	 */
111 111
 	public function getTableInfo(TDbConnection $connection, $tableName)
112 112
 	{
113
-		$connStr = $connection->getConnectionString();
114
-		$key = $connStr.$tableName;
113
+		$connStr=$connection->getConnectionString();
114
+		$key=$connStr.$tableName;
115 115
 		if(!isset($this->_tables[$key]))
116 116
 		{
117 117
 			//call this first to ensure that unserializing the cache
118 118
 			//will find the correct driver dependent classes.
119 119
 			if(!isset($this->_meta[$connStr]))
120 120
 			{
121
-				$this->_meta[$connStr] = TDbMetaData::getInstance($connection);
121
+				$this->_meta[$connStr]=TDbMetaData::getInstance($connection);
122 122
 			}
123 123
 
124
-			$tableInfo = null;
124
+			$tableInfo=null;
125 125
 			if(($cache=$this->getManager()->getCache())!==null)
126
-				$tableInfo = $cache->get($key);
126
+				$tableInfo=$cache->get($key);
127 127
 			if(empty($tableInfo))
128 128
 			{
129
-				$tableInfo = $this->_meta[$connStr]->getTableInfo($tableName);
129
+				$tableInfo=$this->_meta[$connStr]->getTableInfo($tableName);
130 130
 				if($cache!==null)
131 131
 					$cache->set($key, $tableInfo);
132 132
 			}
133
-			$this->_tables[$key] = $tableInfo;
133
+			$this->_tables[$key]=$tableInfo;
134 134
 		}
135 135
 		return $this->_tables[$key];
136 136
 	}
@@ -141,16 +141,16 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	public function getCommand(TActiveRecord $record)
143 143
 	{
144
-		$conn = $record->getDbConnection();
145
-		$connStr = $conn->getConnectionString();
146
-		$tableInfo = $this->getRecordTableInfo($record);
144
+		$conn=$record->getDbConnection();
145
+		$connStr=$conn->getConnectionString();
146
+		$tableInfo=$this->getRecordTableInfo($record);
147 147
 		if(!isset($this->_commandBuilders[$connStr]))
148 148
 		{
149
-			$builder = $tableInfo->createCommandBuilder($record->getDbConnection());
150
-			$command = new TDataGatewayCommand($builder);
151
-			$command->OnCreateCommand[] = array($this, 'onCreateCommand');
152
-			$command->OnExecuteCommand[] = array($this, 'onExecuteCommand');
153
-			$this->_commandBuilders[$connStr] = $command;
149
+			$builder=$tableInfo->createCommandBuilder($record->getDbConnection());
150
+			$command=new TDataGatewayCommand($builder);
151
+			$command->OnCreateCommand[]=array($this, 'onCreateCommand');
152
+			$command->OnExecuteCommand[]=array($this, 'onExecuteCommand');
153
+			$this->_commandBuilders[$connStr]=$command;
154 154
 
155 155
 		}
156 156
 		$this->_commandBuilders[$connStr]->getBuilder()->setTableInfo($tableInfo);
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 * @param array primary name value pairs
201 201
 	 * @return array record data
202 202
 	 */
203
-	public function findRecordByPK(TActiveRecord $record,$keys)
203
+	public function findRecordByPK(TActiveRecord $record, $keys)
204 204
 	{
205
-		$command = $this->getCommand($record);
205
+		$command=$this->getCommand($record);
206 206
 		return $command->findByPk($keys);
207 207
 	}
208 208
 
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 */
229 229
 	public function findRecordsByCriteria(TActiveRecord $record, $criteria, $iterator=false)
230 230
 	{
231
-		$command = $this->getCommand($record);
231
+		$command=$this->getCommand($record);
232 232
 		return $iterator ? $command->findAll($criteria) : $command->find($criteria);
233 233
 	}
234 234
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 
257 257
 	public function findRecordsByIndex(TActiveRecord $record, $criteria, $fields, $values)
258 258
 	{
259
-		return $this->getCommand($record)->findAllByIndex($criteria,$fields,$values);
259
+		return $this->getCommand($record)->findAllByIndex($criteria, $fields, $values);
260 260
 	}
261 261
 
262 262
 	/**
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	public function insert(TActiveRecord $record)
279 279
 	{
280 280
 		//$this->updateAssociatedRecords($record,true);
281
-		$result = $this->getCommand($record)->insert($this->getInsertValues($record));
281
+		$result=$this->getCommand($record)->insert($this->getInsertValues($record));
282 282
 		if($result)
283 283
 			$this->updatePostInsert($record);
284 284
 		//$this->updateAssociatedRecords($record);
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
 	 */
292 292
 	protected function updatePostInsert($record)
293 293
 	{
294
-		$command = $this->getCommand($record);
295
-		$tableInfo = $command->getTableInfo();
294
+		$command=$this->getCommand($record);
295
+		$tableInfo=$command->getTableInfo();
296 296
 		foreach($tableInfo->getColumns() as $name => $column)
297 297
 		{
298 298
 			if($column->hasSequence())
299
-				$record->setColumnValue($name,$command->getLastInsertID($column->getSequenceName()));
299
+				$record->setColumnValue($name, $command->getLastInsertID($column->getSequenceName()));
300 300
 		}
301 301
 	}
302 302
 
@@ -307,20 +307,20 @@  discard block
 block discarded – undo
307 307
 	protected function getInsertValues(TActiveRecord $record)
308 308
 	{
309 309
 		$values=array();
310
-		$tableInfo = $this->getCommand($record)->getTableInfo();
310
+		$tableInfo=$this->getCommand($record)->getTableInfo();
311 311
 		foreach($tableInfo->getColumns() as $name=>$column)
312 312
 		{
313 313
 			if($column->getIsExcluded())
314 314
 				continue;
315
-			$value = $record->getColumnValue($name);
316
-			if(!$column->getAllowNull() && $value===null && !$column->hasSequence() && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE))
315
+			$value=$record->getColumnValue($name);
316
+			if(!$column->getAllowNull() && $value===null && !$column->hasSequence() && ($column->getDefaultValue()===TDbTableColumn::UNDEFINED_VALUE))
317 317
 			{
318 318
 				throw new TActiveRecordException(
319 319
 					'ar_value_must_not_be_null', get_class($record),
320 320
 					$tableInfo->getTableFullName(), $name);
321 321
 			}
322 322
 			if($value!==null)
323
-				$values[$name] = $value;
323
+				$values[$name]=$value;
324 324
 		}
325 325
 		return $values;
326 326
 	}
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
 	public function update(TActiveRecord $record)
334 334
 	{
335 335
 		//$this->updateAssociatedRecords($record,true);
336
-		list($data, $keys) = $this->getUpdateValues($record);
337
-		$result = $this->getCommand($record)->updateByPk($data, $keys);
336
+		list($data, $keys)=$this->getUpdateValues($record);
337
+		$result=$this->getCommand($record)->updateByPk($data, $keys);
338 338
 		//$this->updateAssociatedRecords($record);
339 339
 		return $result;
340 340
 	}
@@ -342,30 +342,30 @@  discard block
 block discarded – undo
342 342
 	protected function getUpdateValues(TActiveRecord $record)
343 343
 	{
344 344
 		$values=array();
345
-		$tableInfo = $this->getCommand($record)->getTableInfo();
345
+		$tableInfo=$this->getCommand($record)->getTableInfo();
346 346
 		$primary=array();
347 347
 		foreach($tableInfo->getColumns() as $name=>$column)
348 348
 		{
349 349
 			if($column->getIsExcluded())
350 350
 				continue;
351
-			$value = $record->getColumnValue($name);
352
-			if(!$column->getAllowNull() && $value===null && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE))
351
+			$value=$record->getColumnValue($name);
352
+			if(!$column->getAllowNull() && $value===null && ($column->getDefaultValue()===TDbTableColumn::UNDEFINED_VALUE))
353 353
 			{
354 354
 				throw new TActiveRecordException(
355 355
 					'ar_value_must_not_be_null', get_class($record),
356 356
 					$tableInfo->getTableFullName(), $name);
357 357
 			}
358 358
 			if($column->getIsPrimaryKey())
359
-				$primary[$name] = $value;
359
+				$primary[$name]=$value;
360 360
 			else
361
-				$values[$name] = $value;
361
+				$values[$name]=$value;
362 362
 		}
363
-		return array($values,$primary);
363
+		return array($values, $primary);
364 364
 	}
365 365
 
366
-	protected function updateAssociatedRecords(TActiveRecord $record,$updateBelongsTo=false)
366
+	protected function updateAssociatedRecords(TActiveRecord $record, $updateBelongsTo=false)
367 367
 	{
368
-		$context = new TActiveRecordRelationContext($record);
368
+		$context=new TActiveRecordRelationContext($record);
369 369
 		return $context->updateAssociatedRecords($updateBelongsTo);
370 370
 	}
371 371
 
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
 
382 382
 	protected function getPrimaryKeyValues(TActiveRecord $record)
383 383
 	{
384
-		$tableInfo = $this->getCommand($record)->getTableInfo();
384
+		$tableInfo=$this->getCommand($record)->getTableInfo();
385 385
 		$primary=array();
386 386
 		foreach($tableInfo->getColumns() as $name=>$column)
387 387
 		{
388 388
 			if($column->getIsPrimaryKey())
389
-				$primary[$name] = $record->getColumnValue($name);
389
+				$primary[$name]=$record->getColumnValue($name);
390 390
 		}
391 391
 		return $primary;
392 392
 	}
@@ -419,12 +419,12 @@  discard block
 block discarded – undo
419 419
 	 * @param TActiveRecord active record
420 420
 	 * @param TActiveRecordCriteria data for the command.
421 421
 	 */
422
-	protected function raiseCommandEvent($event,$command,$record,$criteria)
422
+	protected function raiseCommandEvent($event, $command, $record, $criteria)
423 423
 	{
424 424
 		if(!($criteria instanceof TSqlCriteria))
425
-			$criteria = new TActiveRecordCriteria(null,$criteria);
426
-		$param = new TActiveRecordEventParameter($command,$record,$criteria);
427
-		$manager = $record->getRecordManager();
425
+			$criteria=new TActiveRecordCriteria(null, $criteria);
426
+		$param=new TActiveRecordEventParameter($command, $record, $criteria);
427
+		$manager=$record->getRecordManager();
428 428
 		$manager->{$event}($param);
429 429
 		$record->{$event}($param);
430 430
 	}
Please login to merge, or discard this patch.
framework/Data/TDbConnection.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -189,8 +189,7 @@  discard block
 block discarded – undo
189 189
 				$this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
190 190
 				$this->_active=true;
191 191
 				$this->setConnectionCharset();
192
-			}
193
-			catch(PDOException $e)
192
+			} catch(PDOException $e)
194 193
 			{
195 194
 				throw new TDbException('dbconnection_open_failed',$e->getMessage());
196 195
 			}
@@ -343,8 +342,7 @@  discard block
 block discarded – undo
343 342
 		{
344 343
 			$this->_pdo->beginTransaction();
345 344
 			return $this->_transaction=Prado::createComponent($this->getTransactionClass(), $this);
346
-		}
347
-		else
345
+		} else
348 346
 			throw new TDbException('dbconnection_connection_inactive');
349 347
 	}
350 348
 
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 *
93 93
 	 * @since 3.1.7
94 94
 	 */
95
-	const DEFAULT_TRANSACTION_CLASS = 'System.Data.TDbTransaction';
95
+	const DEFAULT_TRANSACTION_CLASS='System.Data.TDbTransaction';
96 96
 
97 97
 	private $_dsn='';
98 98
 	private $_username='';
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	/**
107 107
 	 * @var TDbMetaData
108 108
 	 */
109
-	private $_dbMeta = null;
109
+	private $_dbMeta=null;
110 110
 
111 111
 	/**
112 112
 	 * @var string
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @param string Charset used for DB Connection (MySql & pgsql only). If not set, will use the default charset of your database server
128 128
 	 * @see http://www.php.net/manual/en/function.PDO-construct.php
129 129
 	 */
130
-	public function __construct($dsn='',$username='',$password='', $charset='')
130
+	public function __construct($dsn='', $username='', $password='', $charset='')
131 131
 	{
132 132
 		$this->_dsn=$dsn;
133 133
 		$this->_username=$username;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	public function __sleep()
142 142
 	{
143 143
 //		$this->close(); - DO NOT CLOSE the current connection as serializing doesn't neccessarily mean we don't this connection anymore in the current session
144
-		return array_diff(parent::__sleep(),array("\0TDbConnection\0_pdo","\0TDbConnection\0_active"));
144
+		return array_diff(parent::__sleep(), array("\0TDbConnection\0_pdo", "\0TDbConnection\0_active"));
145 145
 	}
146 146
 
147 147
 	/**
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 		{
189 189
 			try
190 190
 			{
191
-				$this->_pdo=new PDO($this->getConnectionString(),$this->getUsername(),
192
-									$this->getPassword(),$this->_attributes);
191
+				$this->_pdo=new PDO($this->getConnectionString(), $this->getUsername(),
192
+									$this->getPassword(), $this->_attributes);
193 193
 				// This attribute is only useful for PDO::MySql driver.
194 194
 				// Ignore the warning if a driver doesn't understand this.
195 195
 				@$this->_pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 			}
200 200
 			catch(PDOException $e)
201 201
 			{
202
-				throw new TDbException('dbconnection_open_failed',$e->getMessage());
202
+				throw new TDbException('dbconnection_open_failed', $e->getMessage());
203 203
 			}
204 204
 		}
205 205
 	}
@@ -221,16 +221,16 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	protected function setConnectionCharset()
223 223
 	{
224
-		if ($this->_charset === '' || $this->_active === false)
224
+		if($this->_charset==='' || $this->_active===false)
225 225
 			return;
226
-		switch ($this->_pdo->getAttribute(PDO::ATTR_DRIVER_NAME))
226
+		switch($this->_pdo->getAttribute(PDO::ATTR_DRIVER_NAME))
227 227
 		{
228 228
 			case 'mysql':
229 229
 			case 'sqlite':
230
-				$stmt = $this->_pdo->prepare('SET NAMES ?');
230
+				$stmt=$this->_pdo->prepare('SET NAMES ?');
231 231
 			break;
232 232
 			case 'pgsql':
233
-				$stmt = $this->_pdo->prepare('SET client_encoding TO ?');
233
+				$stmt=$this->_pdo->prepare('SET client_encoding TO ?');
234 234
 			break;
235 235
 			default:
236 236
 				throw new TDbException('dbconnection_unsupported_driver_charset', $driver);
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 	/**
291 291
 	 * @return string the charset used for database connection. Defaults to emtpy string.
292 292
 	 */
293
-	public function getCharset ()
293
+	public function getCharset()
294 294
 	{
295 295
 		return $this->_charset;
296 296
 	}
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	/**
299 299
 	 * @param string the charset used for database connection
300 300
 	 */
301
-	public function setCharset ($value)
301
+	public function setCharset($value)
302 302
 	{
303 303
 		$this->_charset=$value;
304 304
 		$this->setConnectionCharset();
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 	public function createCommand($sql)
322 322
 	{
323 323
 		if($this->getActive())
324
-			return new TDbCommand($this,$sql);
324
+			return new TDbCommand($this, $sql);
325 325
 		else
326 326
 			throw new TDbException('dbconnection_connection_inactive');
327 327
 	}
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	 */
372 372
 	public function setTransactionClass($value)
373 373
 	{
374
-		$this->_transactionClass = (string)$value;
374
+		$this->_transactionClass=(string) $value;
375 375
 	}
376 376
 
377 377
 	/**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	{
440 440
 		if($this->_dbMeta===null)
441 441
 		{
442
-			$this->_dbMeta = TDbMetaData::getInstance($this);
442
+			$this->_dbMeta=TDbMetaData::getInstance($this);
443 443
 		}
444 444
 		return $this->_dbMeta;
445 445
 	}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	 */
466 466
 	public function setColumnCase($value)
467 467
 	{
468
-		switch(TPropertyValue::ensureEnum($value,'Prado\\Data\\TDbColumnCaseMode'))
468
+		switch(TPropertyValue::ensureEnum($value, 'Prado\\Data\\TDbColumnCaseMode'))
469 469
 		{
470 470
 			case TDbColumnCaseMode::Preserved:
471 471
 				$value=PDO::CASE_NATURAL;
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 				$value=PDO::CASE_UPPER;
478 478
 				break;
479 479
 		}
480
-		$this->setAttribute(PDO::ATTR_CASE,$value);
480
+		$this->setAttribute(PDO::ATTR_CASE, $value);
481 481
 	}
482 482
 
483 483
 	/**
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 	 */
502 502
 	public function setNullConversion($value)
503 503
 	{
504
-		switch(TPropertyValue::ensureEnum($value,'Prado\\Data\\TDbNullConversionMode'))
504
+		switch(TPropertyValue::ensureEnum($value, 'Prado\\Data\\TDbNullConversionMode'))
505 505
 		{
506 506
 			case TDbNullConversionMode::Preserved:
507 507
 				$value=PDO::NULL_NATURAL;
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 				$value=PDO::NULL_TO_STRING;
514 514
 				break;
515 515
 		}
516
-		$this->setAttribute(PDO::ATTR_ORACLE_NULLS,$value);
516
+		$this->setAttribute(PDO::ATTR_ORACLE_NULLS, $value);
517 517
 	}
518 518
 
519 519
 	/**
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 	 */
532 532
 	public function setAutoCommit($value)
533 533
 	{
534
-		$this->setAttribute(PDO::ATTR_AUTOCOMMIT,TPropertyValue::ensureBoolean($value));
534
+		$this->setAttribute(PDO::ATTR_AUTOCOMMIT, TPropertyValue::ensureBoolean($value));
535 535
 	}
536 536
 
537 537
 	/**
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 	 */
550 550
 	public function setPersistent($value)
551 551
 	{
552
-		return $this->setAttribute(PDO::ATTR_PERSISTENT,TPropertyValue::ensureBoolean($value));
552
+		return $this->setAttribute(PDO::ATTR_PERSISTENT, TPropertyValue::ensureBoolean($value));
553 553
 	}
554 554
 
555 555
 	/**
@@ -629,10 +629,10 @@  discard block
 block discarded – undo
629 629
 	 * @param mixed the attribute value
630 630
 	 * @see http://www.php.net/manual/en/function.PDO-setAttribute.php
631 631
 	 */
632
-	public function setAttribute($name,$value)
632
+	public function setAttribute($name, $value)
633 633
 	{
634 634
 		if($this->_pdo instanceof PDO)
635
-			$this->_pdo->setAttribute($name,$value);
635
+			$this->_pdo->setAttribute($name, $value);
636 636
 		else
637 637
 			$this->_attributes[$name]=$value;
638 638
 	}
Please login to merge, or discard this patch.
framework/Data/TDbDataReader.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
 		if ($this->sourcepath === NULL)
59 59
 		{
60 60
 			$this->sourcepath = $sourcepath;
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->sourcepath->append($sourcepath);
65 64
 		}
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 	public function bindColumn($column, &$value, $dataType=null)
64 64
 	{
65 65
 		if($dataType===null)
66
-			$this->_statement->bindColumn($column,$value);
66
+			$this->_statement->bindColumn($column, $value);
67 67
 		else
68
-			$this->_statement->bindColumn($column,$value,$dataType);
68
+			$this->_statement->bindColumn($column, $value, $dataType);
69 69
 	}
70 70
 
71 71
 	/**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	public function setFetchMode($mode)
75 75
 	{
76 76
 		$params=func_get_args();
77
-		call_user_func_array(array($this->_statement,'setFetchMode'),$params);
77
+		call_user_func_array(array($this->_statement, 'setFetchMode'), $params);
78 78
 	}
79 79
 
80 80
 	/**
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	 * @param array list of column names whose values are to be passed as parameters in the constructor of the class being created
103 103
 	 * @return mixed|false the populated object, false if no more row of data available
104 104
 	 */
105
-	public function readObject($className,$fields)
105
+	public function readObject($className, $fields)
106 106
 	{
107
-		return $this->_statement->fetchObject($className,$fields);
107
+		return $this->_statement->fetchObject($className, $fields);
108 108
 	}
109 109
 
110 110
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	public function rewind()
173 173
 	{
174
-		if($this->_index<0)
174
+		if($this->_index < 0)
175 175
 		{
176 176
 			$this->_row=$this->_statement->fetch();
177 177
 			$this->_index=0;
Please login to merge, or discard this patch.
framework/Data/SqlMap/DataMapper/TPropertyAccess.php 2 patches
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@  discard block
 block discarded – undo
61 61
 					$object = $object[$prop];
62 62
 				else
63 63
 					throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
64
-			}
65
-			else if(is_object($object))
64
+			} else if(is_object($object))
66 65
 			{
67 66
 				$getter = 'get'.$prop;
68 67
 				if(method_exists($object, $getter) && is_callable(array($object, $getter)))
@@ -73,8 +72,7 @@  discard block
 block discarded – undo
73 72
 					$object = $object->{$prop};
74 73
 				else
75 74
 					throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
76
-			}
77
-			else
75
+			} else
78 76
 				throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
79 77
 		}
80 78
 		return $object;
@@ -98,8 +96,7 @@  discard block
 block discarded – undo
98 96
 					$object = $object[$prop];
99 97
 				else
100 98
 					return false;
101
-			}
102
-			else if(is_object($object))
99
+			} else if(is_object($object))
103 100
 			{
104 101
 				$getter = 'get'.$prop;
105 102
 				if(method_exists($object, $getter) && is_callable(array($object, $getter)))
@@ -110,8 +107,7 @@  discard block
 block discarded – undo
110 107
 					$object = $object->{$prop};
111 108
 				else
112 109
 					return false;
113
-			}
114
-			else
110
+			} else
115 111
 				return false;
116 112
 		}
117 113
 		return true;
@@ -136,16 +132,14 @@  discard block
 block discarded – undo
136 132
 		if(is_array($object) || $object instanceof ArrayAccess)
137 133
 		{
138 134
 			$object[$prop] = $value;
139
-		}
140
-		else if(is_object($object))
135
+		} else if(is_object($object))
141 136
 		{
142 137
 			$setter = 'set'.$prop;
143 138
 			if (method_exists($object, $setter) && is_callable(array($object, $setter)))
144 139
 				$object->{$setter}($value);
145 140
 			else
146 141
 				$object->{$prop} = $value;
147
-		}
148
-		else
142
+		} else
149 143
 			throw new TInvalidPropertyException('sqlmap_invalid_property_type',$path);
150 144
 	}
151 145
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -48,34 +48,34 @@  discard block
 block discarded – undo
48 48
 	 * @return mixed property value.
49 49
 	 * @throws TInvalidDataValueException if property path is invalid.
50 50
 	 */
51
-	public static function get($object,$path)
51
+	public static function get($object, $path)
52 52
 	{
53 53
 		if(!is_array($object) && !is_object($object))
54 54
 			return $object;
55
-		$properties = explode('.', $path);
55
+		$properties=explode('.', $path);
56 56
 		foreach($properties as $prop)
57 57
 		{
58 58
 			if(is_array($object) || $object instanceof ArrayAccess)
59 59
 			{
60 60
 				if(array_key_exists($prop, $object))
61
-					$object = $object[$prop];
61
+					$object=$object[$prop];
62 62
 				else
63
-					throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
63
+					throw new TInvalidPropertyException('sqlmap_invalid_property', $path);
64 64
 			}
65 65
 			else if(is_object($object))
66 66
 			{
67
-				$getter = 'get'.$prop;
67
+				$getter='get'.$prop;
68 68
 				if(method_exists($object, $getter) && is_callable(array($object, $getter)))
69
-					$object = $object->{$getter}();
69
+					$object=$object->{$getter}();
70 70
 				else if(in_array($prop, array_keys(get_object_vars($object))))
71
-					$object = $object->{$prop};
71
+					$object=$object->{$prop};
72 72
 				elseif(method_exists($object, '__get') && is_callable(array($object, '__get')))
73
-					$object = $object->{$prop};
73
+					$object=$object->{$prop};
74 74
 				else
75
-					throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
75
+					throw new TInvalidPropertyException('sqlmap_invalid_property', $path);
76 76
 			}
77 77
 			else
78
-				throw new TInvalidPropertyException('sqlmap_invalid_property',$path);
78
+				throw new TInvalidPropertyException('sqlmap_invalid_property', $path);
79 79
 		}
80 80
 		return $object;
81 81
 	}
@@ -89,25 +89,25 @@  discard block
 block discarded – undo
89 89
 	{
90 90
 		if(!is_array($object) && !is_object($object))
91 91
 			return false;
92
-		$properties = explode('.', $path);
92
+		$properties=explode('.', $path);
93 93
 		foreach($properties as $prop)
94 94
 		{
95 95
 			if(is_array($object) || $object instanceof ArrayAccess)
96 96
 			{
97 97
 				if(array_key_exists($prop, $object))
98
-					$object = $object[$prop];
98
+					$object=$object[$prop];
99 99
 				else
100 100
 					return false;
101 101
 			}
102 102
 			else if(is_object($object))
103 103
 			{
104
-				$getter = 'get'.$prop;
104
+				$getter='get'.$prop;
105 105
 				if(method_exists($object, $getter) && is_callable(array($object, $getter)))
106
-					$object = $object->{$getter}();
106
+					$object=$object->{$getter}();
107 107
 				else if(in_array($prop, array_keys(get_object_vars($object))))
108
-					$object = $object->{$prop};
108
+					$object=$object->{$prop};
109 109
 				elseif(method_exists($object, '__get') && is_callable(array($object, '__get')))
110
-					$object = $object->{$prop};
110
+					$object=$object->{$prop};
111 111
 				else
112 112
 					return false;
113 113
 			}
@@ -126,27 +126,27 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public static function set(&$originalObject, $path, $value)
128 128
 	{
129
-		$properties = explode('.', $path);
130
-		$prop = array_pop($properties);
129
+		$properties=explode('.', $path);
130
+		$prop=array_pop($properties);
131 131
 		if(count($properties) > 0)
132
-			$object = self::get($originalObject, implode('.',$properties));
132
+			$object=self::get($originalObject, implode('.', $properties));
133 133
 		else
134
-			$object = &$originalObject;
134
+			$object=&$originalObject;
135 135
 
136 136
 		if(is_array($object) || $object instanceof ArrayAccess)
137 137
 		{
138
-			$object[$prop] = $value;
138
+			$object[$prop]=$value;
139 139
 		}
140 140
 		else if(is_object($object))
141 141
 		{
142
-			$setter = 'set'.$prop;
143
-			if (method_exists($object, $setter) && is_callable(array($object, $setter)))
142
+			$setter='set'.$prop;
143
+			if(method_exists($object, $setter) && is_callable(array($object, $setter)))
144 144
 				$object->{$setter}($value);
145 145
 			else
146
-				$object->{$prop} = $value;
146
+				$object->{$prop}=$value;
147 147
 		}
148 148
 		else
149
-			throw new TInvalidPropertyException('sqlmap_invalid_property_type',$path);
149
+			throw new TInvalidPropertyException('sqlmap_invalid_property_type', $path);
150 150
 	}
151 151
 
152 152
 }
Please login to merge, or discard this patch.