@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public function getCoordinates() |
40 | 40 | { |
41 | - return $this->getX() . ',' . $this->getY() . ',' . $this->getRadius(); |
|
41 | + return $this->getX().','.$this->getY().','.$this->getRadius(); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -607,15 +607,15 @@ |
||
607 | 607 | public function _hash($data, $controlType) |
608 | 608 | { |
609 | 609 | switch ($controlType) { |
610 | - case 'md5': |
|
611 | - return md5($data); |
|
612 | - case 'crc32': |
|
613 | - return sprintf('% 32d', crc32($data)); |
|
614 | - case 'strlen': |
|
615 | - return sprintf('% 32d', strlen($data)); |
|
616 | - default: |
|
617 | - $this->raiseError('Unknown controlType ! ' . |
|
618 | - '(available values are only \'md5\', \'crc32\', \'strlen\')', -5); |
|
610 | + case 'md5': |
|
611 | + return md5($data); |
|
612 | + case 'crc32': |
|
613 | + return sprintf('% 32d', crc32($data)); |
|
614 | + case 'strlen': |
|
615 | + return sprintf('% 32d', strlen($data)); |
|
616 | + default: |
|
617 | + $this->raiseError('Unknown controlType ! ' . |
|
618 | + '(available values are only \'md5\', \'crc32\', \'strlen\')', -5); |
|
619 | 619 | } |
620 | 620 | } |
621 | 621 |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public function __construct($options = [null]) |
235 | 235 | { |
236 | - $availableOptions = [ 'automaticSerialization', |
|
236 | + $availableOptions = ['automaticSerialization', |
|
237 | 237 | 'fileNameProtection', |
238 | 238 | 'memoryCaching', |
239 | 239 | 'onlyMemoryCaching', |
@@ -245,9 +245,9 @@ discard block |
||
245 | 245 | 'writeControl', |
246 | 246 | 'readControl', |
247 | 247 | 'readControlType']; |
248 | - foreach($options as $key => $value) { |
|
249 | - if(in_array($key, $availableOptions)) { |
|
250 | - $property = '_' . $key; |
|
248 | + foreach ($options as $key => $value) { |
|
249 | + if (in_array($key, $availableOptions)) { |
|
250 | + $property = '_'.$key; |
|
251 | 251 | $this->$property = $value; |
252 | 252 | } |
253 | 253 | } |
@@ -375,9 +375,9 @@ discard block |
||
375 | 375 | public function clean($group = false) |
376 | 376 | { |
377 | 377 | if ($this->_fileNameProtection) { |
378 | - $motif = ($group) ? 'cache_' . md5($group) . '_' : 'cache_'; |
|
378 | + $motif = ($group) ? 'cache_'.md5($group).'_' : 'cache_'; |
|
379 | 379 | } else { |
380 | - $motif = ($group) ? 'cache_' . $group . '_' : 'cache_'; |
|
380 | + $motif = ($group) ? 'cache_'.$group.'_' : 'cache_'; |
|
381 | 381 | } |
382 | 382 | if ($this->_memoryCaching) { |
383 | 383 | while (list($key, $value) = each($this->_memoryCaching)) { |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | } |
398 | 398 | while ($file = readdir($dh)) { |
399 | 399 | if (($file != '.') && ($file != '..')) { |
400 | - $file = $this->_cacheDir . $file; |
|
400 | + $file = $this->_cacheDir.$file; |
|
401 | 401 | if (is_file($file)) { |
402 | 402 | if (strpos($file, $motif, 0)) { |
403 | 403 | if (!@unlink($file)) { |
@@ -510,10 +510,10 @@ discard block |
||
510 | 510 | public function _setFileName($id, $group) |
511 | 511 | { |
512 | 512 | if ($this->_fileNameProtection) { |
513 | - $this->_file = ($this->_cacheDir . 'cache_' . md5($group) . '_' |
|
513 | + $this->_file = ($this->_cacheDir.'cache_'.md5($group).'_' |
|
514 | 514 | . md5($id)); |
515 | 515 | } else { |
516 | - $this->_file = $this->_cacheDir . 'cache_' . $group . '_' . $id; |
|
516 | + $this->_file = $this->_cacheDir.'cache_'.$group.'_'.$id; |
|
517 | 517 | } |
518 | 518 | } |
519 | 519 | |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | case 'strlen': |
615 | 615 | return sprintf('% 32d', strlen($data)); |
616 | 616 | default: |
617 | - $this->raiseError('Unknown controlType ! ' . |
|
617 | + $this->raiseError('Unknown controlType ! '. |
|
618 | 618 | '(available values are only \'md5\', \'crc32\', \'strlen\')', -5); |
619 | 619 | } |
620 | 620 | } |
@@ -531,7 +531,9 @@ discard block |
||
531 | 531 | public function _read() |
532 | 532 | { |
533 | 533 | $fp = @fopen($this->_file, "rb"); |
534 | - if ($this->_fileLocking) @flock($fp, LOCK_SH); |
|
534 | + if ($this->_fileLocking) { |
|
535 | + @flock($fp, LOCK_SH); |
|
536 | + } |
|
535 | 537 | if ($fp) { |
536 | 538 | // because the filesize can be cached by PHP itself... |
537 | 539 | clearstatcache(); |
@@ -541,7 +543,9 @@ discard block |
||
541 | 543 | $length = $length - 32; |
542 | 544 | } |
543 | 545 | $data = @fread($fp, $length); |
544 | - if ($this->_fileLocking) @flock($fp, LOCK_UN); |
|
546 | + if ($this->_fileLocking) { |
|
547 | + @flock($fp, LOCK_UN); |
|
548 | + } |
|
545 | 549 | @fclose($fp); |
546 | 550 | if ($this->_readControl) { |
547 | 551 | $hashData = $this->_hash($data, $this->_readControlType); |
@@ -567,13 +571,17 @@ discard block |
||
567 | 571 | { |
568 | 572 | $fp = @fopen($this->_file, "wb"); |
569 | 573 | if ($fp) { |
570 | - if ($this->_fileLocking) @flock($fp, LOCK_EX); |
|
574 | + if ($this->_fileLocking) { |
|
575 | + @flock($fp, LOCK_EX); |
|
576 | + } |
|
571 | 577 | if ($this->_readControl) { |
572 | 578 | @fwrite($fp, $this->_hash($data, $this->_readControlType), 32); |
573 | 579 | } |
574 | 580 | $len = strlen($data); |
575 | 581 | @fwrite($fp, $data, $len); |
576 | - if ($this->_fileLocking) @flock($fp, LOCK_UN); |
|
582 | + if ($this->_fileLocking) { |
|
583 | + @flock($fp, LOCK_UN); |
|
584 | + } |
|
577 | 585 | @fclose($fp); |
578 | 586 | return true; |
579 | 587 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | public function getTableFullName() |
43 | 43 | { |
44 | - return "'" . $this->getTableName() . "'"; |
|
44 | + return "'".$this->getTableName()."'"; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | public function getTableFullName() |
50 | 50 | { |
51 | 51 | //MSSQL alway returns the catalog, schem and table names. |
52 | - return '[' . $this->getCatalogName() . '].[' . $this->getSchemaName() . '].[' . $this->getTableName() . ']'; |
|
52 | + return '['.$this->getCatalogName().'].['.$this->getSchemaName().'].['.$this->getTableName().']'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -30,8 +30,7 @@ |
||
30 | 30 | if($this->_old === null) |
31 | 31 | { |
32 | 32 | return ($this->_new !== null) ? $this->_new->toArray() : $this->_null; |
33 | - } |
|
34 | - else |
|
33 | + } else |
|
35 | 34 | { |
36 | 35 | $new = $this->_new->toArray(); |
37 | 36 | $old = $this->_old->toArray(); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | public function getDifference() |
29 | 29 | { |
30 | - if($this->_old === null) |
|
30 | + if ($this->_old === null) |
|
31 | 31 | { |
32 | 32 | return ($this->_new !== null) ? $this->_new->toArray() : $this->_null; |
33 | 33 | } |
@@ -104,8 +104,7 @@ |
||
104 | 104 | $this->_query = isset($ret['query'])?$ret['query']:''; |
105 | 105 | $this->_fragment = isset($ret['fragment'])?$ret['fragment']:''; |
106 | 106 | $this->_uri = $uri; |
107 | - } |
|
108 | - else |
|
107 | + } else |
|
109 | 108 | { |
110 | 109 | throw new TInvalidDataValueException('uri_format_invalid', $uri); |
111 | 110 | } |
@@ -92,17 +92,17 @@ |
||
92 | 92 | */ |
93 | 93 | public function __construct($uri) |
94 | 94 | { |
95 | - if(($ret = @parse_url($uri)) !== false) |
|
95 | + if (($ret = @parse_url($uri)) !== false) |
|
96 | 96 | { |
97 | 97 | // decoding??? |
98 | - $this->_scheme = isset($ret['scheme'])?$ret['scheme']:''; |
|
99 | - $this->_host = isset($ret['host'])?$ret['host']:''; |
|
100 | - $this->_port = isset($ret['port'])?$ret['port']:''; |
|
101 | - $this->_user = isset($ret['user'])?$ret['user']:''; |
|
102 | - $this->_pass = isset($ret['pass'])?$ret['pass']:''; |
|
103 | - $this->_path = isset($ret['path'])?$ret['path']:''; |
|
104 | - $this->_query = isset($ret['query'])?$ret['query']:''; |
|
105 | - $this->_fragment = isset($ret['fragment'])?$ret['fragment']:''; |
|
98 | + $this->_scheme = isset($ret['scheme']) ? $ret['scheme'] : ''; |
|
99 | + $this->_host = isset($ret['host']) ? $ret['host'] : ''; |
|
100 | + $this->_port = isset($ret['port']) ? $ret['port'] : ''; |
|
101 | + $this->_user = isset($ret['user']) ? $ret['user'] : ''; |
|
102 | + $this->_pass = isset($ret['pass']) ? $ret['pass'] : ''; |
|
103 | + $this->_path = isset($ret['path']) ? $ret['path'] : ''; |
|
104 | + $this->_query = isset($ret['query']) ? $ret['query'] : ''; |
|
105 | + $this->_fragment = isset($ret['fragment']) ? $ret['fragment'] : ''; |
|
106 | 106 | $this->_uri = $uri; |
107 | 107 | } |
108 | 108 | else |
@@ -135,28 +135,24 @@ |
||
135 | 135 | { |
136 | 136 | $param->setData($data); |
137 | 137 | $this->_nextPageList = null; |
138 | - } |
|
139 | - else |
|
138 | + } else |
|
140 | 139 | { |
141 | 140 | $param->setData(array_slice($data, 0, $pageSize)); |
142 | 141 | $this->_nextPageList = array_slice($data, $pageSize - 1, $total); |
143 | 142 | } |
144 | - } |
|
145 | - else |
|
143 | + } else |
|
146 | 144 | { |
147 | 145 | if($total <= $pageSize) |
148 | 146 | { |
149 | 147 | $this->_prevPageList = array_slice($data, 0, $total); |
150 | 148 | $param->setData([]); |
151 | 149 | $this->_nextPageList = null; |
152 | - } |
|
153 | - elseif($total <= $pageSize * 2) |
|
150 | + } elseif($total <= $pageSize * 2) |
|
154 | 151 | { |
155 | 152 | $this->_prevPageList = array_slice($data, 0, $pageSize); |
156 | 153 | $param->setData(array_slice($data, $pageSize, $total)); |
157 | 154 | $this->_nextPageList = null; |
158 | - } |
|
159 | - else |
|
155 | + } else |
|
160 | 156 | { |
161 | 157 | $this->_prevPageList = array_slice($data, 0, $pageSize); |
162 | 158 | $param->setData(array_slice($data, $pageSize, $pageSize)); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | $total = $data instanceof TList ? $data->getCount() : count($data); |
122 | 122 | $pageSize = $this->getPageSize(); |
123 | - if($total < 1) |
|
123 | + if ($total < 1) |
|
124 | 124 | { |
125 | 125 | $param->setData($data); |
126 | 126 | $this->_prevPageList = null; |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
131 | - if($param->getNewPageIndex() < 1) |
|
131 | + if ($param->getNewPageIndex() < 1) |
|
132 | 132 | { |
133 | 133 | $this->_prevPageList = null; |
134 | - if($total <= $pageSize) |
|
134 | + if ($total <= $pageSize) |
|
135 | 135 | { |
136 | 136 | $param->setData($data); |
137 | 137 | $this->_nextPageList = null; |
@@ -144,13 +144,13 @@ discard block |
||
144 | 144 | } |
145 | 145 | else |
146 | 146 | { |
147 | - if($total <= $pageSize) |
|
147 | + if ($total <= $pageSize) |
|
148 | 148 | { |
149 | 149 | $this->_prevPageList = array_slice($data, 0, $total); |
150 | 150 | $param->setData([]); |
151 | 151 | $this->_nextPageList = null; |
152 | 152 | } |
153 | - elseif($total <= $pageSize * 2) |
|
153 | + elseif ($total <= $pageSize * 2) |
|
154 | 154 | { |
155 | 155 | $this->_prevPageList = array_slice($data, 0, $pageSize); |
156 | 156 | $param->setData(array_slice($data, $pageSize, $total)); |
@@ -46,8 +46,9 @@ |
||
46 | 46 | array_shift($args); |
47 | 47 | $n = count($args); |
48 | 48 | $tokens = []; |
49 | - for($i = 0;$i < $n;++$i) |
|
50 | - $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
|
49 | + for($i = 0;$i < $n;++$i) { |
|
50 | + $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
|
51 | + } |
|
51 | 52 | parent::__construct(strtr($errorMessage, $tokens)); |
52 | 53 | } |
53 | 54 |
@@ -46,8 +46,8 @@ |
||
46 | 46 | array_shift($args); |
47 | 47 | $n = count($args); |
48 | 48 | $tokens = []; |
49 | - for($i = 0;$i < $n;++$i) |
|
50 | - $tokens['{' . $i . '}'] = TPropertyValue::ensureString($args[$i]); |
|
49 | + for ($i = 0; $i < $n; ++$i) |
|
50 | + $tokens['{'.$i.'}'] = TPropertyValue::ensureString($args[$i]); |
|
51 | 51 | parent::__construct(strtr($errorMessage, $tokens)); |
52 | 52 | } |
53 | 53 |
@@ -46,7 +46,7 @@ |
||
46 | 46 | E_USER_NOTICE => "User Notice", |
47 | 47 | E_STRICT => "Runtime Notice" |
48 | 48 | ]; |
49 | - $errorType = isset($errorTypes[$errno])?$errorTypes[$errno]:'Unknown Error'; |
|
49 | + $errorType = isset($errorTypes[$errno]) ? $errorTypes[$errno] : 'Unknown Error'; |
|
50 | 50 | parent::__construct("[$errorType] $errstr (@line $errline in file $errfile)."); |
51 | 51 | } |
52 | 52 |