@@ -64,7 +64,7 @@ |
||
| 64 | 64 | */ |
| 65 | 65 | public function translate($message, $textdomain = 'default', $locale = null) |
| 66 | 66 | { |
| 67 | - return ( $this->getTranslator()->translate($message, $textdomain, $locale) ); |
|
| 67 | + return ($this->getTranslator()->translate($message, $textdomain, $locale)); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | } |
@@ -46,9 +46,9 @@ discard block |
||
| 46 | 46 | * basic constructor injecting global service manager/locator |
| 47 | 47 | * @return self |
| 48 | 48 | */ |
| 49 | - public function __construct( ServiceLocatorInterface $serviceLocator ) |
|
| 49 | + public function __construct(ServiceLocatorInterface $serviceLocator) |
|
| 50 | 50 | { |
| 51 | - if ( $serviceLocator ) { |
|
| 51 | + if ($serviceLocator) { |
|
| 52 | 52 | $this->setServiceLocator($serviceLocator); |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | |
| 136 | 136 | $oAuth = $this->getServiceLocator()->get('zfcuser_auth_service'); |
| 137 | - if ($oAuth->hasIdentity() ) { |
|
| 137 | + if ($oAuth->hasIdentity()) { |
|
| 138 | 138 | return $oAuth->getIdentity(); |
| 139 | 139 | } |
| 140 | 140 | return null; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | ($request instanceof \Zend\Http\PhpEnvironment\Request) || |
| 156 | 156 | ($request instanceof \Zend\Http\Request) |
| 157 | 157 | ) { |
| 158 | - return ( $request->isXmlHttpRequest() ); |
|
| 158 | + return ($request->isXmlHttpRequest()); |
|
| 159 | 159 | } |
| 160 | 160 | return (false); |
| 161 | 161 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @param array $vars [optional] additional variables |
| 180 | 180 | * @return array |
| 181 | 181 | */ |
| 182 | - public function getTemplateVars( $vars = array() ) |
|
| 182 | + public function getTemplateVars($vars = array()) |
|
| 183 | 183 | { |
| 184 | 184 | $result = (array_merge( |
| 185 | 185 | $this->params()->fromRoute(), |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | class DbStructUpdater |
| 57 | 57 | { |
| 58 | - var $sourceStruct = '';//structure dump of the reference database |
|
| 59 | - var $destStruct = '';//structure dump of database to update |
|
| 60 | - var $config = array();//updater configuration |
|
| 58 | + var $sourceStruct = ''; //structure dump of the reference database |
|
| 59 | + var $destStruct = ''; //structure dump of database to update |
|
| 60 | + var $config = array(); //updater configuration |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Constructor |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @param assoc_array $config new configuration values |
| 102 | 102 | */ |
| 103 | - public function setConfig($config=array()) |
|
| 103 | + public function setConfig($config = array()) |
|
| 104 | 104 | { |
| 105 | 105 | if (is_array($config)) { |
| 106 | 106 | $this->config = array_merge($this->config, $config); |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | * @param bool $asString if true - result will be a string, otherwise - array |
| 117 | 117 | * @return array|string update sql statements - in array or string (separated with ';') |
| 118 | 118 | */ |
| 119 | - public function getUpdates($source, $dest, $asString=false) |
|
| 119 | + public function getUpdates($source, $dest, $asString = false) |
|
| 120 | 120 | { |
| 121 | - $result = $asString?'':array(); |
|
| 121 | + $result = $asString ? '' : array(); |
|
| 122 | 122 | $compRes = $this->compare($source, $dest); |
| 123 | 123 | if (empty($compRes)) { |
| 124 | 124 | return $result; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | $allowedActions = array('create', 'drop', 'add', 'remove', 'modify'); |
| 151 | 151 | $updateActions = array_intersect($updateActions, $allowedActions); |
| 152 | - foreach($compRes as $table=>$info) |
|
| 152 | + foreach ($compRes as $table=>$info) |
|
| 153 | 153 | { |
| 154 | 154 | if ($info['sourceOrphan']) { |
| 155 | 155 | if (in_array('create', $updateActions)) { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $result[$table] = $info; |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | - elseif($info['differs']) { |
|
| 164 | + elseif ($info['differs']) { |
|
| 165 | 165 | $resultInfo = $info; |
| 166 | 166 | unset($resultInfo['differs']); |
| 167 | 167 | foreach ($info['differs'] as $diff) |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | elseif (empty($diff['source']) && in_array('remove', $updateActions)) { |
| 173 | 173 | $resultInfo['differs'][] = $diff; |
| 174 | 174 | } |
| 175 | - elseif(in_array('modify', $updateActions)) { |
|
| 175 | + elseif (in_array('modify', $updateActions)) { |
|
| 176 | 176 | $resultInfo['differs'][] = $diff; |
| 177 | 177 | } |
| 178 | 178 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | return false; |
| 195 | 195 | } |
| 196 | 196 | $result = array('sourceOrphans'=>array(), 'destOrphans'=>array(), 'different'=>array()); |
| 197 | - foreach($compRes as $table=>$info) |
|
| 197 | + foreach ($compRes as $table=>$info) |
|
| 198 | 198 | { |
| 199 | 199 | if ($info['sourceOrphan']) { |
| 200 | 200 | $result['sourceOrphans'][] = $table; |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | foreach ($all as $tab) |
| 243 | 243 | { |
| 244 | 244 | $info = array('destOrphan'=>false, 'sourceOrphan'=>false, 'differs'=>false); |
| 245 | - if(in_array($tab, $destOrphans)) { |
|
| 245 | + if (in_array($tab, $destOrphans)) { |
|
| 246 | 246 | $info['destOrphan'] = true; |
| 247 | 247 | } |
| 248 | 248 | elseif (in_array($tab, $sourceOrphans)) { |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $destSql = $this->getTabSql($this->destStruct, $tab, true); |
| 254 | 254 | $sourceSql = $this->getTabSql($this->sourceStruct, $tab, true); |
| 255 | 255 | $diffs = $this->compareSql($sourceSql, $destSql); |
| 256 | - if ($diffs===false) { |
|
| 256 | + if ($diffs === false) { |
|
| 257 | 257 | trigger_error('[WARNING] error parsing definition of table "'.$tab.'" - skipped'); |
| 258 | 258 | continue; |
| 259 | 259 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | { |
| 262 | 262 | $info['differs'] = $diffs; |
| 263 | 263 | } |
| 264 | - else { continue;//empty array |
|
| 264 | + else { continue; //empty array |
|
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | $result[$tab] = $info; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | { |
| 280 | 280 | $result = array(); |
| 281 | 281 | if (preg_match_all('/CREATE(?:\s*TEMPORARY)?\s*TABLE\s*(?:IF NOT EXISTS\s*)?(?:`?(\w+)`?\.)?`?(\w+)`?/i', $struct, $m)) { |
| 282 | - foreach($m[2] as $match)//m[1] is a database name if any |
|
| 282 | + foreach ($m[2] as $match)//m[1] is a database name if any |
|
| 283 | 283 | { |
| 284 | 284 | $result[] = $match; |
| 285 | 285 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * @param bool $removeDatabase - either to remove database name in "CREATE TABLE database.tab"-like declarations |
| 297 | 297 | * @return string table structure definition |
| 298 | 298 | */ |
| 299 | - private function getTabSql($struct, $tab, $removeDatabase=true) |
|
| 299 | + private function getTabSql($struct, $tab, $removeDatabase = true) |
|
| 300 | 300 | { |
| 301 | 301 | $result = ''; |
| 302 | 302 | /* create table should be single line in this case*/ |
@@ -305,14 +305,14 @@ discard block |
||
| 305 | 305 | $tableDef = $m[0][0]; |
| 306 | 306 | $start = $m[0][1]; |
| 307 | 307 | $database = $m[2][0]; |
| 308 | - $offset = $start+strlen($m[0][0]); |
|
| 308 | + $offset = $start + strlen($m[0][0]); |
|
| 309 | 309 | $end = $this->getDelimPos($struct, $offset); |
| 310 | 310 | if ($end === false) { |
| 311 | 311 | $result = substr($struct, $start); |
| 312 | 312 | } |
| 313 | 313 | else |
| 314 | 314 | { |
| 315 | - $result = substr($struct, $start, $end-$start);//already without ';' |
|
| 315 | + $result = substr($struct, $start, $end - $start); //already without ';' |
|
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | $result = trim($result); |
@@ -330,25 +330,25 @@ discard block |
||
| 330 | 330 | $result = array(); |
| 331 | 331 | //find opening bracket, get the prefix along with it |
| 332 | 332 | $openBracketPos = $this->getDelimPos($sql, 0, '('); |
| 333 | - if ($openBracketPos===false) { |
|
| 333 | + if ($openBracketPos === false) { |
|
| 334 | 334 | trigger_error('[WARNING] can not find opening bracket in table definition'); |
| 335 | 335 | return false; |
| 336 | 336 | } |
| 337 | - $prefix = substr($sql, 0, $openBracketPos+1);//prefix can not be empty, so do not check it, just trim |
|
| 337 | + $prefix = substr($sql, 0, $openBracketPos + 1); //prefix can not be empty, so do not check it, just trim |
|
| 338 | 338 | $result[] = trim($prefix); |
| 339 | - $body = substr($sql, strlen($prefix));//fields, indexes and part after closing bracket |
|
| 339 | + $body = substr($sql, strlen($prefix)); //fields, indexes and part after closing bracket |
|
| 340 | 340 | //split by commas, get part by part |
| 341 | - while(($commaPos = $this->getDelimPos($body, 0, ',', true))!==false) |
|
| 341 | + while (($commaPos = $this->getDelimPos($body, 0, ',', true)) !== false) |
|
| 342 | 342 | { |
| 343 | - $part = trim(substr($body, 0, $commaPos+1));//read another part and shorten $body |
|
| 343 | + $part = trim(substr($body, 0, $commaPos + 1)); //read another part and shorten $body |
|
| 344 | 344 | if ($part) { |
| 345 | 345 | $result[] = $part; |
| 346 | 346 | } |
| 347 | - $body = substr($body, $commaPos+1); |
|
| 347 | + $body = substr($body, $commaPos + 1); |
|
| 348 | 348 | } |
| 349 | 349 | //here we have last field (or index) definition + part after closing bracket (ENGINE, ect) |
| 350 | 350 | $closeBracketPos = $this->getDelimRpos($body, 0, ')'); |
| 351 | - if ($closeBracketPos===false) { |
|
| 351 | + if ($closeBracketPos === false) { |
|
| 352 | 352 | trigger_error('[WARNING] can not find closing bracket in table definition'); |
| 353 | 353 | return false; |
| 354 | 354 | } |
@@ -381,27 +381,27 @@ discard block |
||
| 381 | 381 | { |
| 382 | 382 | $result = array(); |
| 383 | 383 | //split with comma delimiter, not line breaks |
| 384 | - $sourceParts = $this->splitTabSql($sourceSql); |
|
| 385 | - if ($sourceParts===false)//error parsing sql |
|
| 384 | + $sourceParts = $this->splitTabSql($sourceSql); |
|
| 385 | + if ($sourceParts === false)//error parsing sql |
|
| 386 | 386 | { |
| 387 | 387 | trigger_error('[WARNING] error parsing source sql'); |
| 388 | 388 | return false; |
| 389 | 389 | } |
| 390 | 390 | $destParts = $this->splitTabSql($destSql); |
| 391 | - if ($destParts===false) { |
|
| 391 | + if ($destParts === false) { |
|
| 392 | 392 | trigger_error('[WARNING] error parsing destination sql'); |
| 393 | 393 | return false; |
| 394 | 394 | } |
| 395 | 395 | $sourcePartsIndexed = array(); |
| 396 | 396 | $destPartsIndexed = array(); |
| 397 | - foreach($sourceParts as $line) |
|
| 397 | + foreach ($sourceParts as $line) |
|
| 398 | 398 | {
|
| 399 | 399 | $lineInfo = $this->processLine($line); |
| 400 | 400 | if (!$lineInfo) { continue; |
| 401 | 401 | } |
| 402 | 402 | $sourcePartsIndexed[$lineInfo['key']] = $lineInfo['line']; |
| 403 | 403 | } |
| 404 | - foreach($destParts as $line) |
|
| 404 | + foreach ($destParts as $line) |
|
| 405 | 405 | {
|
| 406 | 406 | $lineInfo = $this->processLine($line); |
| 407 | 407 | if (!$lineInfo) { continue; |
@@ -411,16 +411,16 @@ discard block |
||
| 411 | 411 | $sourceKeys = array_keys($sourcePartsIndexed); |
| 412 | 412 | $destKeys = array_keys($destPartsIndexed); |
| 413 | 413 | $all = array_unique(array_merge($sourceKeys, $destKeys)); |
| 414 | - sort($all);//fields first, then indexes - because fields are prefixed with '!' |
|
| 414 | + sort($all); //fields first, then indexes - because fields are prefixed with '!' |
|
| 415 | 415 | |
| 416 | 416 | foreach ($all as $key) |
| 417 | 417 | { |
| 418 | 418 | $info = array('source'=>'', 'dest'=>''); |
| 419 | - $inSource= in_array($key, $sourceKeys); |
|
| 420 | - $inDest= in_array($key, $destKeys); |
|
| 419 | + $inSource = in_array($key, $sourceKeys); |
|
| 420 | + $inDest = in_array($key, $destKeys); |
|
| 421 | 421 | $sourceOrphan = $inSource && !$inDest; |
| 422 | 422 | $destOrphan = $inDest && !$inSource; |
| 423 | - $different = $inSource && $inDest && $destPartsIndexed[$key]!=$sourcePartsIndexed[$key]; |
|
| 423 | + $different = $inSource && $inDest && $destPartsIndexed[$key] != $sourcePartsIndexed[$key]; |
|
| 424 | 424 | if ($sourceOrphan) { |
| 425 | 425 | $info['source'] = $sourcePartsIndexed[$key]; |
| 426 | 426 | } |
@@ -462,11 +462,11 @@ discard block |
||
| 462 | 462 | } |
| 463 | 463 | elseif (preg_match('/^`?\w+`?/i', $line, $m))//field definition |
| 464 | 464 | { |
| 465 | - $key = '!'.$m[0];//to make sure fields will be synchronised before the keys |
|
| 465 | + $key = '!'.$m[0]; //to make sure fields will be synchronised before the keys |
|
| 466 | 466 | } |
| 467 | 467 | else |
| 468 | 468 | { |
| 469 | - return false;//line has no valuable info (empty or comment) |
|
| 469 | + return false; //line has no valuable info (empty or comment) |
|
| 470 | 470 | } |
| 471 | 471 | //$key = str_replace('`', '', $key); |
| 472 | 472 | if (!empty($options['varcharDefaultIgnore'])) { |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | $line = preg_replace("/ AUTO_INCREMENT=[0-9]+/i", '', $line); |
| 480 | 480 | } |
| 481 | 481 | $result['key'] = $key; |
| 482 | - $result['line']= $line; |
|
| 482 | + $result['line'] = $line; |
|
| 483 | 483 | return $result; |
| 484 | 484 | } |
| 485 | 485 | |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | if (!is_array($diff) || empty($diff)) { |
| 500 | 500 | return $sqls; |
| 501 | 501 | } |
| 502 | - foreach($diff as $tab=>$info) |
|
| 502 | + foreach ($diff as $tab=>$info) |
|
| 503 | 503 | { |
| 504 | 504 | if ($info['sourceOrphan'])//delete it |
| 505 | 505 | { |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | } |
| 523 | 523 | else |
| 524 | 524 | { |
| 525 | - foreach($info['differs'] as $finfo) |
|
| 525 | + foreach ($info['differs'] as $finfo) |
|
| 526 | 526 | { |
| 527 | 527 | $inDest = !empty($finfo['dest']); |
| 528 | 528 | $inSource = !empty($finfo['source']); |
@@ -560,45 +560,45 @@ discard block |
||
| 560 | 560 | { |
| 561 | 561 | $result = 'ALTER TABLE `'.$tab.'` '; |
| 562 | 562 | $action = strtolower($action); |
| 563 | - $keyField = '`?\w`?(?:\(\d+\))?';//matches `name`(10) |
|
| 564 | - $keyFieldList = '(?:'.$keyField.'(?:,\s?)?)+';//matches `name`(10),`desc`(255) |
|
| 563 | + $keyField = '`?\w`?(?:\(\d+\))?'; //matches `name`(10) |
|
| 564 | + $keyFieldList = '(?:'.$keyField.'(?:,\s?)?)+'; //matches `name`(10),`desc`(255) |
|
| 565 | 565 | if (preg_match('/((?:PRIMARY )|(?:UNIQUE )|(?:FULLTEXT ))?KEY `?(\w+)?`?\s(\('.$keyFieldList.'\))/i', $sql, $m)) { //key and index operations |
| 566 | 566 | $type = strtolower(trim($m[1])); |
| 567 | 567 | $name = trim($m[2]); |
| 568 | 568 | $fields = trim($m[3]); |
| 569 | - switch($action) |
|
| 569 | + switch ($action) |
|
| 570 | 570 | { |
| 571 | 571 | case 'drop': |
| 572 | - if ($type=='primary') { |
|
| 573 | - $result.= 'DROP PRIMARY KEY'; |
|
| 572 | + if ($type == 'primary') { |
|
| 573 | + $result .= 'DROP PRIMARY KEY'; |
|
| 574 | 574 | } |
| 575 | 575 | else |
| 576 | 576 | { |
| 577 | - $result.= 'DROP INDEX `'.$name.'`'; |
|
| 577 | + $result .= 'DROP INDEX `'.$name.'`'; |
|
| 578 | 578 | } |
| 579 | 579 | break; |
| 580 | 580 | case 'add': |
| 581 | - if ($type=='primary') { |
|
| 582 | - $result.= 'ADD PRIMARY KEY '.$fields; |
|
| 581 | + if ($type == 'primary') { |
|
| 582 | + $result .= 'ADD PRIMARY KEY '.$fields; |
|
| 583 | 583 | } |
| 584 | - elseif ($type=='') { |
|
| 585 | - $result.= 'ADD INDEX `'.$name.'` '.$fields; |
|
| 584 | + elseif ($type == '') { |
|
| 585 | + $result .= 'ADD INDEX `'.$name.'` '.$fields; |
|
| 586 | 586 | } |
| 587 | 587 | else |
| 588 | 588 | { |
| 589 | - $result .='ADD '.strtoupper($type).' `'.$name.'` '.$fields;//fulltext or unique |
|
| 589 | + $result .= 'ADD '.strtoupper($type).' `'.$name.'` '.$fields; //fulltext or unique |
|
| 590 | 590 | } |
| 591 | 591 | break; |
| 592 | 592 | case 'modify': |
| 593 | - if ($type=='primary') { |
|
| 594 | - $result.='DROP PRIMARY KEY, ADD PRIMARY KEY '.$fields; |
|
| 593 | + if ($type == 'primary') { |
|
| 594 | + $result .= 'DROP PRIMARY KEY, ADD PRIMARY KEY '.$fields; |
|
| 595 | 595 | } |
| 596 | - elseif ($type=='') { |
|
| 597 | - $result.='DROP INDEX `'.$name.'`, ADD INDEX `'.$name.'` '.$fields; |
|
| 596 | + elseif ($type == '') { |
|
| 597 | + $result .= 'DROP INDEX `'.$name.'`, ADD INDEX `'.$name.'` '.$fields; |
|
| 598 | 598 | } |
| 599 | 599 | else |
| 600 | 600 | { |
| 601 | - $result.='DROP INDEX `'.$name.'`, ADD '.strtoupper($type).' `'.$name.'` '.$fields;//fulltext or unique |
|
| 601 | + $result .= 'DROP INDEX `'.$name.'`, ADD '.strtoupper($type).' `'.$name.'` '.$fields; //fulltext or unique |
|
| 602 | 602 | } |
| 603 | 603 | break; |
| 604 | 604 | |
@@ -607,14 +607,14 @@ discard block |
||
| 607 | 607 | else //fields operations |
| 608 | 608 | { |
| 609 | 609 | $sql = rtrim(trim($sql), ','); |
| 610 | - $result.= strtoupper($action); |
|
| 611 | - if ($action=='drop') { |
|
| 610 | + $result .= strtoupper($action); |
|
| 611 | + if ($action == 'drop') { |
|
| 612 | 612 | $spacePos = strpos($sql, ' '); |
| 613 | - $result.= ' '.substr($sql, 0, $spacePos); |
|
| 613 | + $result .= ' '.substr($sql, 0, $spacePos); |
|
| 614 | 614 | } |
| 615 | 615 | else |
| 616 | 616 | { |
| 617 | - $result.= ' '.$sql; |
|
| 617 | + $result .= ' '.$sql; |
|
| 618 | 618 | } |
| 619 | 619 | } |
| 620 | 620 | return $result; |
@@ -629,34 +629,34 @@ discard block |
||
| 629 | 629 | * |
| 630 | 630 | * $skipInBrackets - if true, delimiter will be skipped if located inside (brackets) which are not string literals or comment parts |
| 631 | 631 | */ |
| 632 | - public function getDelimPos($string, $offset=0, $delim=';', $skipInBrackets=false) |
|
| 632 | + public function getDelimPos($string, $offset = 0, $delim = ';', $skipInBrackets = false) |
|
| 633 | 633 | { |
| 634 | 634 | $stack = array(); |
| 635 | - $rbs = '\\\\'; //reg - escaped backslash |
|
| 635 | + $rbs = '\\\\'; //reg - escaped backslash |
|
| 636 | 636 | $regPrefix = "(?<!$rbs)(?:$rbs{2})*"; |
| 637 | 637 | $reg = $regPrefix.'("|\')|(/\\*)|(\\*/)|(-- )|(\r\n|\r|\n)|'; |
| 638 | 638 | if ($skipInBrackets) { |
| 639 | - $reg.='(\(|\))|'; |
|
| 639 | + $reg .= '(\(|\))|'; |
|
| 640 | 640 | } |
| 641 | 641 | else |
| 642 | 642 | { |
| 643 | - $reg.='()'; |
|
| 643 | + $reg .= '()'; |
|
| 644 | 644 | } |
| 645 | 645 | $reg .= '('.preg_quote($delim).')'; |
| 646 | 646 | while (preg_match('%'.$reg.'%', $string, $m, PREG_OFFSET_CAPTURE, $offset)) |
| 647 | 647 | { |
| 648 | - $offset = $m[0][1]+strlen($m[0][0]); |
|
| 649 | - if (end($stack)=='/*') { |
|
| 648 | + $offset = $m[0][1] + strlen($m[0][0]); |
|
| 649 | + if (end($stack) == '/*') { |
|
| 650 | 650 | if (!empty($m[3][0])) { |
| 651 | 651 | array_pop($stack); |
| 652 | 652 | } |
| 653 | - continue;//here we could also simplify regexp |
|
| 653 | + continue; //here we could also simplify regexp |
|
| 654 | 654 | } |
| 655 | - if (end($stack)=='-- ') { |
|
| 655 | + if (end($stack) == '-- ') { |
|
| 656 | 656 | if (!empty($m[5][0])) { |
| 657 | 657 | array_pop($stack); |
| 658 | 658 | } |
| 659 | - continue;//here we could also simplify regexp |
|
| 659 | + continue; //here we could also simplify regexp |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | if (!empty($m[7][0]))// ';' found |
@@ -671,16 +671,16 @@ discard block |
||
| 671 | 671 | } |
| 672 | 672 | if (!empty($m[6][0]))// '(' or ')' found |
| 673 | 673 | { |
| 674 | - if (empty($stack) && $m[6][0]=='(') { |
|
| 674 | + if (empty($stack) && $m[6][0] == '(') { |
|
| 675 | 675 | array_push($stack, $m[6][0]); |
| 676 | 676 | } |
| 677 | - elseif($m[6][0]==')' && end($stack)=='(') { |
|
| 677 | + elseif ($m[6][0] == ')' && end($stack) == '(') { |
|
| 678 | 678 | array_pop($stack); |
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | elseif (!empty($m[1][0]))// ' or " found |
| 682 | 682 | { |
| 683 | - if (end($stack)==$m[1][0]) { |
|
| 683 | + if (end($stack) == $m[1][0]) { |
|
| 684 | 684 | array_pop($stack); |
| 685 | 685 | } |
| 686 | 686 | else |
@@ -704,20 +704,20 @@ discard block |
||
| 704 | 704 | * works the same as getDelimPos except returns position of the first occurence of the delimiter starting from |
| 705 | 705 | * the end of the string |
| 706 | 706 | */ |
| 707 | - public function getDelimRpos($string, $offset=0, $delim=';', $skipInBrackets=false) |
|
| 707 | + public function getDelimRpos($string, $offset = 0, $delim = ';', $skipInBrackets = false) |
|
| 708 | 708 | { |
| 709 | 709 | $pos = $this->getDelimPos($string, $offset, $delim, $skipInBrackets); |
| 710 | - if ($pos===false) { |
|
| 710 | + if ($pos === false) { |
|
| 711 | 711 | return false; |
| 712 | 712 | } |
| 713 | 713 | do |
| 714 | 714 | { |
| 715 | - $newPos=$this->getDelimPos($string, $pos+1, $delim, $skipInBrackets); |
|
| 715 | + $newPos = $this->getDelimPos($string, $pos + 1, $delim, $skipInBrackets); |
|
| 716 | 716 | if ($newPos !== false) { |
| 717 | 717 | $pos = $newPos; |
| 718 | 718 | } |
| 719 | 719 | } |
| 720 | - while($newPos!==false); |
|
| 720 | + while ($newPos !== false); |
|
| 721 | 721 | return $pos; |
| 722 | 722 | } |
| 723 | 723 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function render($container = null) |
| 44 | 44 | { |
| 45 | - $config = new \Zend\Config\Config( $this->getServiceLocator()->getServiceLocator()->get('Config') ); |
|
| 45 | + $config = new \Zend\Config\Config($this->getServiceLocator()->getServiceLocator()->get('Config')); |
|
| 46 | 46 | return $config; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function render($container = null) |
| 44 | 44 | { |
| 45 | - $config = new \Zend\Config\Config( $this->getServiceLocator()->getServiceLocator()->get('Config') ); |
|
| 45 | + $config = new \Zend\Config\Config($this->getServiceLocator()->getServiceLocator()->get('Config')); |
|
| 46 | 46 | return $config; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function render($container = null) |
| 44 | 44 | { |
| 45 | - $config = new \Zend\Config\Config( $this->getServiceLocator()->getServiceLocator()->get('Config') ); |
|
| 45 | + $config = new \Zend\Config\Config($this->getServiceLocator()->getServiceLocator()->get('Config')); |
|
| 46 | 46 | return $config; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -54,30 +54,30 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | public function exchangeArray($data = array(), $forceEncryptPassword = false) |
| 56 | 56 | { |
| 57 | - if (isset($data['id']) && !empty($data["id"]) ) { |
|
| 57 | + if (isset($data['id']) && !empty($data["id"])) { |
|
| 58 | 58 | $this->id = ($data['id']); |
| 59 | 59 | $this->user_id = ($data['id']); |
| 60 | - } elseif (isset($data['user_id']) && !empty($data["user_id"]) ) { |
|
| 60 | + } elseif (isset($data['user_id']) && !empty($data["user_id"])) { |
|
| 61 | 61 | $this->id = ($data['user_id']); |
| 62 | 62 | $this->user_id = ($data['user_id']); |
| 63 | 63 | } |
| 64 | - $this->username = (isset($data['username'])) ? $data['username'] : $this->username; |
|
| 65 | - $this->email = (isset($data['email'])) ? $data['email'] : $this->email; |
|
| 66 | - if (isset($data['displayName']) ) { |
|
| 64 | + $this->username = (isset($data['username'])) ? $data['username'] : $this->username; |
|
| 65 | + $this->email = (isset($data['email'])) ? $data['email'] : $this->email; |
|
| 66 | + if (isset($data['displayName'])) { |
|
| 67 | 67 | $this->display_name = $data['displayName']; |
| 68 | 68 | $this->displayName = $data['displayName']; |
| 69 | - } elseif (isset($data['display_name']) ) { |
|
| 69 | + } elseif (isset($data['display_name'])) { |
|
| 70 | 70 | $this->display_name = $data['display_name']; |
| 71 | 71 | $this->displayName = $data['display_name']; |
| 72 | 72 | } |
| 73 | - if (isset($data["password"]) && $forceEncryptPassword ) { |
|
| 73 | + if (isset($data["password"]) && $forceEncryptPassword) { |
|
| 74 | 74 | $bcrypt = new Bcrypt; |
| 75 | 75 | $bcrypt->setCost(null); // @TODO $this->getUserService()->getOptions()->getPasswordCost()); |
| 76 | 76 | $data["password"] = $bcrypt->create($data['password']); |
| 77 | 77 | } |
| 78 | - $this->password = (isset($data['password'])) ? $data['password'] : $this->password; |
|
| 78 | + $this->password = (isset($data['password'])) ? $data['password'] : $this->password; |
|
| 79 | 79 | $this->state = (isset($data['state'])) ? $data['state'] : $this->state; |
| 80 | - $this->aclrole = (isset($data['aclrole'])) ? $data['aclrole'] : $this->aclrole; |
|
| 80 | + $this->aclrole = (isset($data['aclrole'])) ? $data['aclrole'] : $this->aclrole; |
|
| 81 | 81 | $this->token = (isset($data['token'])) ? $data['token'] : $this->token; |
| 82 | 82 | |
| 83 | 83 | return $this; |