@@ -129,6 +129,9 @@ discard block |
||
| 129 | 129 | $this->mailCrmId = $id; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | + /** |
|
| 133 | + * @param string $name |
|
| 134 | + */ |
|
| 132 | 135 | public function getEmail($name) |
| 133 | 136 | { |
| 134 | 137 | $header = $this->get('header'); |
@@ -145,6 +148,9 @@ discard block |
||
| 145 | 148 | return $return; |
| 146 | 149 | } |
| 147 | 150 | |
| 151 | + /** |
|
| 152 | + * @param string $field |
|
| 153 | + */ |
|
| 148 | 154 | public function findEmailAdress($field, $searchModule = false, $returnArray = true) |
| 149 | 155 | { |
| 150 | 156 | $db = PearDatabase::getInstance(); |
@@ -137,9 +137,9 @@ |
||
| 137 | 137 | if (is_array($text)) { |
| 138 | 138 | foreach ($text as $row) { |
| 139 | 139 | if ($return != '') { |
| 140 | - $return.= ','; |
|
| 140 | + $return .= ','; |
|
| 141 | 141 | } |
| 142 | - $return.= $row->mailbox . '@' . $row->host; |
|
| 142 | + $return .= $row->mailbox . '@' . $row->host; |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | return $return; |
@@ -186,6 +186,10 @@ |
||
| 186 | 186 | return $url; |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | + /** |
|
| 190 | + * @param boolean $record |
|
| 191 | + * @param string $type |
|
| 192 | + */ |
|
| 189 | 193 | public function getExternalUrlForWidget($record, $type, $srecord = false, $smoduleName = false) |
| 190 | 194 | { |
| 191 | 195 | if (is_object($record)) { |
@@ -1,2 +1,2 @@ |
||
| 1 | 1 | <?php |
| 2 | -$map=[]; |
|
| 3 | 2 | \ No newline at end of file |
| 3 | +$map = []; |
|
| 4 | 4 | \ No newline at end of file |
@@ -120,8 +120,9 @@ discard block |
||
| 120 | 120 | $exp = $this->comparision(); |
| 121 | 121 | |
| 122 | 122 | $this->state->_fsp--; |
| 123 | - if ($this->state->failed) |
|
| 124 | - return $result; |
|
| 123 | + if ($this->state->failed) { |
|
| 124 | + return $result; |
|
| 125 | + } |
|
| 125 | 126 | } |
| 126 | 127 | break; |
| 127 | 128 | case 2 : { |
@@ -129,8 +130,9 @@ discard block |
||
| 129 | 130 | $exp = $this->inclause(); |
| 130 | 131 | |
| 131 | 132 | $this->state->_fsp--; |
| 132 | - if ($this->state->failed) |
|
| 133 | - return $result; |
|
| 133 | + if ($this->state->failed) { |
|
| 134 | + return $result; |
|
| 135 | + } |
|
| 134 | 136 | } |
| 135 | 137 | break; |
| 136 | 138 | } |
@@ -161,17 +163,20 @@ discard block |
||
| 161 | 163 | |
| 162 | 164 | try { { |
| 163 | 165 | $lhs = $this->match($this->input, $this->getToken('SYMBOL'), self::$FOLLOW_SYMBOL_in_comparision78); |
| 164 | - if ($this->state->failed) |
|
| 165 | - return $result; |
|
| 166 | + if ($this->state->failed) { |
|
| 167 | + return $result; |
|
| 168 | + } |
|
| 166 | 169 | $this->match($this->input, $this->getToken('13'), self::$FOLLOW_13_in_comparision80); |
| 167 | - if ($this->state->failed) |
|
| 168 | - return $result; |
|
| 170 | + if ($this->state->failed) { |
|
| 171 | + return $result; |
|
| 172 | + } |
|
| 169 | 173 | $this->pushFollow(self::$FOLLOW_value_in_comparision84); |
| 170 | 174 | $rhs = $this->value(); |
| 171 | 175 | |
| 172 | 176 | $this->state->_fsp--; |
| 173 | - if ($this->state->failed) |
|
| 174 | - return $result; |
|
| 177 | + if ($this->state->failed) { |
|
| 178 | + return $result; |
|
| 179 | + } |
|
| 175 | 180 | if ($this->state->backtracking == 0) { |
| 176 | 181 | $result = array('==', new VTEventConditionSymbol(($lhs != null ? $lhs->getText() : null)), $rhs); |
| 177 | 182 | echo $value; |
@@ -199,17 +204,20 @@ discard block |
||
| 199 | 204 | |
| 200 | 205 | try { { |
| 201 | 206 | $lhs = $this->match($this->input, $this->getToken('SYMBOL'), self::$FOLLOW_SYMBOL_in_inclause101); |
| 202 | - if ($this->state->failed) |
|
| 203 | - return $result; |
|
| 207 | + if ($this->state->failed) { |
|
| 208 | + return $result; |
|
| 209 | + } |
|
| 204 | 210 | $this->match($this->input, $this->getToken('IN'), self::$FOLLOW_IN_in_inclause103); |
| 205 | - if ($this->state->failed) |
|
| 206 | - return $result; |
|
| 211 | + if ($this->state->failed) { |
|
| 212 | + return $result; |
|
| 213 | + } |
|
| 207 | 214 | $this->pushFollow(self::$FOLLOW_listelement_in_inclause107); |
| 208 | 215 | $rhs = $this->listelement(); |
| 209 | 216 | |
| 210 | 217 | $this->state->_fsp--; |
| 211 | - if ($this->state->failed) |
|
| 212 | - return $result; |
|
| 218 | + if ($this->state->failed) { |
|
| 219 | + return $result; |
|
| 220 | + } |
|
| 213 | 221 | if ($this->state->backtracking == 0) { |
| 214 | 222 | $result = array('in', new VTEventConditionSymbol(($lhs != null ? $lhs->getText() : null)), $rhs); |
| 215 | 223 | } |
@@ -235,14 +243,16 @@ discard block |
||
| 235 | 243 | |
| 236 | 244 | try { { |
| 237 | 245 | $this->match($this->input, $this->getToken('14'), self::$FOLLOW_14_in_listelement122); |
| 238 | - if ($this->state->failed) |
|
| 239 | - return $result; |
|
| 246 | + if ($this->state->failed) { |
|
| 247 | + return $result; |
|
| 248 | + } |
|
| 240 | 249 | $this->pushFollow(self::$FOLLOW_value_in_listelement126); |
| 241 | 250 | $val = $this->value(); |
| 242 | 251 | |
| 243 | 252 | $this->state->_fsp--; |
| 244 | - if ($this->state->failed) |
|
| 245 | - return $result; |
|
| 253 | + if ($this->state->failed) { |
|
| 254 | + return $result; |
|
| 255 | + } |
|
| 246 | 256 | if ($this->state->backtracking == 0) { |
| 247 | 257 | $result = array('list', $val); |
| 248 | 258 | } |
@@ -259,14 +269,16 @@ discard block |
||
| 259 | 269 | switch ($alt2) { |
| 260 | 270 | case 1 : { |
| 261 | 271 | $this->match($this->input, $this->getToken('15'), self::$FOLLOW_15_in_listelement137); |
| 262 | - if ($this->state->failed) |
|
| 263 | - return $result; |
|
| 272 | + if ($this->state->failed) { |
|
| 273 | + return $result; |
|
| 274 | + } |
|
| 264 | 275 | $this->pushFollow(self::$FOLLOW_value_in_listelement141); |
| 265 | 276 | $val = $this->value(); |
| 266 | 277 | |
| 267 | 278 | $this->state->_fsp--; |
| 268 | - if ($this->state->failed) |
|
| 269 | - return $result; |
|
| 279 | + if ($this->state->failed) { |
|
| 280 | + return $result; |
|
| 281 | + } |
|
| 270 | 282 | if ($this->state->backtracking == 0) { |
| 271 | 283 | $result[] = $val; |
| 272 | 284 | } |
@@ -279,8 +291,9 @@ discard block |
||
| 279 | 291 | } while (true); |
| 280 | 292 | |
| 281 | 293 | $this->match($this->input, $this->getToken('16'), self::$FOLLOW_16_in_listelement147); |
| 282 | - if ($this->state->failed) |
|
| 283 | - return $result; |
|
| 294 | + if ($this->state->failed) { |
|
| 295 | + return $result; |
|
| 296 | + } |
|
| 284 | 297 | } |
| 285 | 298 | } catch (RecognitionException $e) { |
| 286 | 299 | throw $e; |
@@ -302,8 +315,9 @@ discard block |
||
| 302 | 315 | |
| 303 | 316 | try { { |
| 304 | 317 | $val = $this->match($this->input, $this->getToken('STRING'), self::$FOLLOW_STRING_in_value162); |
| 305 | - if ($this->state->failed) |
|
| 306 | - return $result; |
|
| 318 | + if ($this->state->failed) { |
|
| 319 | + return $result; |
|
| 320 | + } |
|
| 307 | 321 | if ($this->state->backtracking == 0) { |
| 308 | 322 | $result = stripcslashes(substr(($val != null ? $val->getText() : null), 1, strlen(($val != null ? $val->getText() : null)) - 2)); |
| 309 | 323 | } |
@@ -48,6 +48,9 @@ |
||
| 48 | 48 | static $FOLLOW_16_in_listelement147; |
| 49 | 49 | static $FOLLOW_STRING_in_value162; |
| 50 | 50 | |
| 51 | + /** |
|
| 52 | + * @param CommonTokenStream $input |
|
| 53 | + */ |
|
| 51 | 54 | public function __construct($input, $state = null) |
| 52 | 55 | { |
| 53 | 56 | if ($state === null) { |
@@ -398,8 +398,9 @@ discard block |
||
| 398 | 398 | $fallBackFilePath = Vtiger_Loader::resolveNameToPath($preLayoutPath . $layoutPath . '/' . $jsFile, $fileExtension); |
| 399 | 399 | if (is_file($fallBackFilePath)) { |
| 400 | 400 | $filePath = $jsFile; |
| 401 | - if (empty($preLayoutPath)) |
|
| 402 | - $filePath = str_replace('.', '/', $filePath) . '.js'; |
|
| 401 | + if (empty($preLayoutPath)) { |
|
| 402 | + $filePath = str_replace('.', '/', $filePath) . '.js'; |
|
| 403 | + } |
|
| 403 | 404 | $minFilePath = str_replace('.js', '.min.js', $filePath); |
| 404 | 405 | if (vtlib\Functions::getMinimizationOptions($fileExtension) && is_file(Vtiger_Loader::resolveNameToPath('~' . $layoutPath . '/' . $minFilePath, $fileExtension))) { |
| 405 | 406 | $filePath = $minFilePath; |
@@ -413,8 +414,9 @@ discard block |
||
| 413 | 414 | $fallBackFilePath = Vtiger_Loader::resolveNameToPath($preLayoutPath . $layoutPath . '/' . $jsFile, $fileExtension); |
| 414 | 415 | if (is_file($fallBackFilePath)) { |
| 415 | 416 | $filePath = $jsFile; |
| 416 | - if (empty($preLayoutPath)) |
|
| 417 | - $filePath = str_replace('.', '/', $jsFile) . '.js'; |
|
| 417 | + if (empty($preLayoutPath)) { |
|
| 418 | + $filePath = str_replace('.', '/', $jsFile) . '.js'; |
|
| 419 | + } |
|
| 418 | 420 | $minFilePath = str_replace('.js', '.min.js', $filePath); |
| 419 | 421 | if (vtlib\Functions::getMinimizationOptions($fileExtension) && is_file(Vtiger_Loader::resolveNameToPath('~' . $layoutPath . '/' . $minFilePath, $fileExtension))) { |
| 420 | 422 | $filePath = $minFilePath; |
@@ -471,8 +473,9 @@ discard block |
||
| 471 | 473 | $layoutPath = 'layouts' . '/' . Yeti_Layout::getActiveLayout(); |
| 472 | 474 | $fallBackFilePath = Vtiger_Loader::resolveNameToPath($preLayoutPath . $layoutPath . '/' . $cssFile, $fileExtension); |
| 473 | 475 | if (is_file($fallBackFilePath)) { |
| 474 | - if (empty($preLayoutPath)) |
|
| 475 | - $filePath = str_replace('.', '/', $cssFile) . '.css'; |
|
| 476 | + if (empty($preLayoutPath)) { |
|
| 477 | + $filePath = str_replace('.', '/', $cssFile) . '.css'; |
|
| 478 | + } |
|
| 476 | 479 | $minFilePath = str_replace('.css', '.min.css', $filePath); |
| 477 | 480 | if (vtlib\Functions::getMinimizationOptions($fileExtension) && is_file(Vtiger_Loader::resolveNameToPath('~' . $layoutPath . '/' . $minFilePath, $fileExtension))) { |
| 478 | 481 | $filePath = $minFilePath; |
@@ -485,8 +488,9 @@ discard block |
||
| 485 | 488 | $layoutPath = 'layouts' . '/' . Vtiger_Viewer::getDefaultLayoutName(); |
| 486 | 489 | $fallBackFilePath = Vtiger_Loader::resolveNameToPath($preLayoutPath . $layoutPath . '/' . $cssFile, $fileExtension); |
| 487 | 490 | if (is_file($fallBackFilePath)) { |
| 488 | - if (empty($preLayoutPath)) |
|
| 489 | - $filePath = str_replace('.', '/', $cssFile) . '.css'; |
|
| 491 | + if (empty($preLayoutPath)) { |
|
| 492 | + $filePath = str_replace('.', '/', $cssFile) . '.css'; |
|
| 493 | + } |
|
| 490 | 494 | $minFilePath = str_replace('.css', '.min.css', $filePath); |
| 491 | 495 | if (vtlib\Functions::getMinimizationOptions($fileExtension) && is_file(Vtiger_Loader::resolveNameToPath('~' . $layoutPath . '/' . $minFilePath, $fileExtension))) { |
| 492 | 496 | $filePath = $minFilePath; |
@@ -77,8 +77,6 @@ |
||
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Function invokes exposed methods for this class |
| 80 | - * @param string $name - method name |
|
| 81 | - * @param Vtiger_Request $request |
|
| 82 | 80 | * @throws Exception |
| 83 | 81 | */ |
| 84 | 82 | public function invokeExposedMethod() |
@@ -306,8 +306,9 @@ |
||
| 306 | 306 | public function validateWriteAccess($skipRequestTypeCheck = false) |
| 307 | 307 | { |
| 308 | 308 | if (!$skipRequestTypeCheck) { |
| 309 | - if ($_SERVER['REQUEST_METHOD'] != 'POST') |
|
| 310 | - throw new \Exception\Csrf('Invalid request - validate Write Access'); |
|
| 309 | + if ($_SERVER['REQUEST_METHOD'] != 'POST') { |
|
| 310 | + throw new \Exception\Csrf('Invalid request - validate Write Access'); |
|
| 311 | + } |
|
| 311 | 312 | } |
| 312 | 313 | $this->validateReadAccess(); |
| 313 | 314 | $this->validateCSRF(); |
@@ -79,6 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Get value for key as boolean |
| 82 | + * @param string $key |
|
| 82 | 83 | */ |
| 83 | 84 | public function getBoolean($key, $defvalue = '') |
| 84 | 85 | { |
@@ -88,8 +89,8 @@ discard block |
||
| 88 | 89 | /** |
| 89 | 90 | * Function to get the value if its safe to use for SQL Query (column). |
| 90 | 91 | * @param string $key |
| 91 | - * @param boolean $skipEmpty - Skip the check if string is empty |
|
| 92 | - * @return Value for the given key |
|
| 92 | + * @param boolean $skipEmtpy - Skip the check if string is empty |
|
| 93 | + * @return string|false for the given key |
|
| 93 | 94 | */ |
| 94 | 95 | public function getForSql($key, $skipEmtpy = true) |
| 95 | 96 | { |
@@ -157,6 +158,7 @@ discard block |
||
| 157 | 158 | |
| 158 | 159 | /** |
| 159 | 160 | * Is the value (linked to key) empty? |
| 161 | + * @param string $key |
|
| 160 | 162 | */ |
| 161 | 163 | public function isEmpty($key) |
| 162 | 164 | { |
@@ -187,6 +189,7 @@ discard block |
||
| 187 | 189 | |
| 188 | 190 | /** |
| 189 | 191 | * Set the value for key |
| 192 | + * @param string $key |
|
| 190 | 193 | */ |
| 191 | 194 | public function delete($key) |
| 192 | 195 | { |
@@ -256,6 +259,9 @@ discard block |
||
| 256 | 259 | return $headers; |
| 257 | 260 | } |
| 258 | 261 | |
| 262 | + /** |
|
| 263 | + * @param string $key |
|
| 264 | + */ |
|
| 259 | 265 | public function getHeader($key) |
| 260 | 266 | { |
| 261 | 267 | if (empty($this->headers)) { |
@@ -264,6 +270,9 @@ discard block |
||
| 264 | 270 | return isset($this->headers[$key]) ? $this->headers[$key] : null; |
| 265 | 271 | } |
| 266 | 272 | |
| 273 | + /** |
|
| 274 | + * @return string |
|
| 275 | + */ |
|
| 267 | 276 | public function getRequestMethod() |
| 268 | 277 | { |
| 269 | 278 | $method = $_SERVER['REQUEST_METHOD']; |
@@ -362,6 +371,9 @@ discard block |
||
| 362 | 371 | return static::$request->get($key, $defvalue); |
| 363 | 372 | } |
| 364 | 373 | |
| 374 | + /** |
|
| 375 | + * @param string $key |
|
| 376 | + */ |
|
| 365 | 377 | public static function has($key) |
| 366 | 378 | { |
| 367 | 379 | if (!static::$request) { |
@@ -370,6 +382,11 @@ discard block |
||
| 370 | 382 | return static::$request->has($key); |
| 371 | 383 | } |
| 372 | 384 | |
| 385 | + /** |
|
| 386 | + * @param string $key |
|
| 387 | + * |
|
| 388 | + * @return string |
|
| 389 | + */ |
|
| 373 | 390 | public static function getForSql($key, $skipEmtpy = true) |
| 374 | 391 | { |
| 375 | 392 | if (!static::$request) { |
@@ -378,6 +395,9 @@ discard block |
||
| 378 | 395 | return static::$request->getForSql($key, $skipEmtpy); |
| 379 | 396 | } |
| 380 | 397 | |
| 398 | + /** |
|
| 399 | + * @param string $key |
|
| 400 | + */ |
|
| 381 | 401 | public static function set($key, $value) |
| 382 | 402 | { |
| 383 | 403 | if (!static::$request) { |
@@ -386,6 +406,9 @@ discard block |
||
| 386 | 406 | return static::$request->set($key, $value); |
| 387 | 407 | } |
| 388 | 408 | |
| 409 | + /** |
|
| 410 | + * @param string $key |
|
| 411 | + */ |
|
| 389 | 412 | public static function isEmpty($key) |
| 390 | 413 | { |
| 391 | 414 | if (!static::$request) { |
@@ -44,11 +44,11 @@ |
||
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | public function __toString() { |
| 47 | - if ( $this->input instanceof CharStream ) { |
|
| 48 | - return "NoViableAltException('".$this->getUnexpectedType()."'@[".$this->grammarDecisionDescription."])"; |
|
| 47 | + if ($this->input instanceof CharStream) { |
|
| 48 | + return "NoViableAltException('" . $this->getUnexpectedType() . "'@[" . $this->grammarDecisionDescription . "])"; |
|
| 49 | 49 | } |
| 50 | 50 | else { |
| 51 | - return "NoViableAltException(".$this->getUnexpectedType()."@[".$this->grammarDecisionDescription."])"; |
|
| 51 | + return "NoViableAltException(" . $this->getUnexpectedType() . "@[" . $this->grammarDecisionDescription . "])"; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -46,8 +46,7 @@ |
||
| 46 | 46 | public function __toString() { |
| 47 | 47 | if ( $this->input instanceof CharStream ) { |
| 48 | 48 | return "NoViableAltException('".$this->getUnexpectedType()."'@[".$this->grammarDecisionDescription."])"; |
| 49 | - } |
|
| 50 | - else { |
|
| 49 | + } else { |
|
| 51 | 50 | return "NoViableAltException(".$this->getUnexpectedType()."@[".$this->grammarDecisionDescription."])"; |
| 52 | 51 | } |
| 53 | 52 | } |
@@ -42,10 +42,10 @@ |
||
| 42 | 42 | protected $eot; |
| 43 | 43 | protected $eof; |
| 44 | 44 | protected $min; |
| 45 | - protected $max; |
|
| 46 | - protected $accept; |
|
| 47 | - protected $special; |
|
| 48 | - protected $transition; |
|
| 45 | + protected $max; |
|
| 46 | + protected $accept; |
|
| 47 | + protected $special; |
|
| 48 | + protected $transition; |
|
| 49 | 49 | |
| 50 | 50 | protected $decisionNumber; |
| 51 | 51 | |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | * an exception upon error. |
| 61 | 61 | */ |
| 62 | 62 | |
| 63 | - public function predict($input){ |
|
| 64 | - if ( $this->debug ) { |
|
| 65 | - echo ("Enter DFA.predict for decision ".$this->decisionNumber); |
|
| 63 | + public function predict($input) { |
|
| 64 | + if ($this->debug) { |
|
| 65 | + echo ("Enter DFA.predict for decision " . $this->decisionNumber); |
|
| 66 | 66 | } |
| 67 | 67 | $mark = $input->mark(); // remember where decision started in input |
| 68 | 68 | try { |
| 69 | 69 | $ret = $this->_predict($input); |
| 70 | 70 | |
| 71 | 71 | } |
| 72 | - catch(Exception $e) { |
|
| 72 | + catch (Exception $e) { |
|
| 73 | 73 | $input->rewind($mark); |
| 74 | 74 | throw $e; |
| 75 | 75 | } |
@@ -79,20 +79,20 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public function _predict($input) { |
| 81 | 81 | $s = 0; // we always start at s0 |
| 82 | - while ( true ) { |
|
| 83 | - if ( $this->debug ) echo ("DFA ".$this->decisionNumber." state ".$s." LA(1)=".$input->LA(1)."(".$input->LA(1)."), index=".$input->index()); |
|
| 82 | + while (true) { |
|
| 83 | + if ($this->debug) echo ("DFA " . $this->decisionNumber . " state " . $s . " LA(1)=" . $input->LA(1) . "(" . $input->LA(1) . "), index=" . $input->index()); |
|
| 84 | 84 | $specialState = $this->special[$s]; |
| 85 | - if ( $specialState>=0 ) { |
|
| 86 | - if ( $this->debug ) { |
|
| 87 | - echo ("DFA ".$this->decisionNumber. |
|
| 88 | - " state ".$s." is special state ".$specialState); |
|
| 85 | + if ($specialState >= 0) { |
|
| 86 | + if ($this->debug) { |
|
| 87 | + echo ("DFA " . $this->decisionNumber . |
|
| 88 | + " state " . $s . " is special state " . $specialState); |
|
| 89 | 89 | } |
| 90 | 90 | $s = $this->specialStateTransition($specialState, $input); |
| 91 | - if ( $this->debug ) { |
|
| 92 | - echo ("DFA ".$this->decisionNumber. |
|
| 93 | - " returns from special state ".$specialState." to ".s); |
|
| 91 | + if ($this->debug) { |
|
| 92 | + echo ("DFA " . $this->decisionNumber . |
|
| 93 | + " returns from special state " . $specialState . " to " . s); |
|
| 94 | 94 | } |
| 95 | - if ( $s==-1 ) { |
|
| 95 | + if ($s == -1) { |
|
| 96 | 96 | $this->noViableAlt($s, $input); |
| 97 | 97 | return 0; |
| 98 | 98 | } |
@@ -100,50 +100,50 @@ discard block |
||
| 100 | 100 | continue; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if ( $this->accept[$s] >= 1 ) { |
|
| 104 | - if ( $this->debug ) echo ("accept; predict "+$this->accept[$s]+" from state "+$this->s); |
|
| 103 | + if ($this->accept[$s] >= 1) { |
|
| 104 | + if ($this->debug) echo ("accept; predict "+$this->accept[$s] + " from state "+$this->s); |
|
| 105 | 105 | return $this->accept[$s]; |
| 106 | 106 | } |
| 107 | 107 | // look for a normal char transition |
| 108 | 108 | $c = $input->LA(1); // -1 == \uFFFF, all tokens fit in 65000 space |
| 109 | - if ($c>=$this->min[$s] && $c<=$this->max[$s]) { |
|
| 110 | - $snext = $this->transition[$s][$c-$this->min[$s]]; // move to next state |
|
| 111 | - if ( $snext < 0 ) { |
|
| 109 | + if ($c >= $this->min[$s] && $c <= $this->max[$s]) { |
|
| 110 | + $snext = $this->transition[$s][$c - $this->min[$s]]; // move to next state |
|
| 111 | + if ($snext < 0) { |
|
| 112 | 112 | // was in range but not a normal transition |
| 113 | 113 | // must check EOT, which is like the else clause. |
| 114 | 114 | // eot[s]>=0 indicates that an EOT edge goes to another |
| 115 | 115 | // state. |
| 116 | - if ( $this->eot[$s]>=0 ) { // EOT Transition to accept state? |
|
| 117 | - if ( $this->debug ) echo("EOT transition"); |
|
| 116 | + if ($this->eot[$s] >= 0) { // EOT Transition to accept state? |
|
| 117 | + if ($this->debug) echo("EOT transition"); |
|
| 118 | 118 | $s = $this->eot[$s]; |
| 119 | 119 | $input->consume(); |
| 120 | 120 | continue; |
| 121 | 121 | } |
| 122 | - $this->noViableAlt($s,$input); |
|
| 122 | + $this->noViableAlt($s, $input); |
|
| 123 | 123 | return 0; |
| 124 | 124 | } |
| 125 | 125 | $s = $snext; |
| 126 | 126 | $input->consume(); |
| 127 | 127 | continue; |
| 128 | 128 | } |
| 129 | - if ( $eot[$s]>=0 ) { // EOT Transition? |
|
| 130 | - if ( $this->debug ) println("EOT transition"); |
|
| 129 | + if ($eot[$s] >= 0) { // EOT Transition? |
|
| 130 | + if ($this->debug) println("EOT transition"); |
|
| 131 | 131 | $s = $this->eot[$s]; |
| 132 | 132 | $input->consume(); |
| 133 | 133 | continue; |
| 134 | 134 | } |
| 135 | - if ( $c==Token::$EOF && $eof[$s]>=0 ) { // EOF Transition to accept state? |
|
| 136 | - if ( $this->debug ) echo ("accept via EOF; predict "+$this->accept[$eof[$s]]+" from "+$eof[$s]); |
|
| 135 | + if ($c == Token::$EOF && $eof[$s] >= 0) { // EOF Transition to accept state? |
|
| 136 | + if ($this->debug) echo ("accept via EOF; predict "+$this->accept[$eof[$s]] + " from "+$eof[$s]); |
|
| 137 | 137 | return $this->accept[$eof[$s]]; |
| 138 | 138 | } |
| 139 | 139 | // not in range and not EOF/EOT, must be invalid symbol |
| 140 | - if ( $this->debug ) { |
|
| 141 | - echo("min[".$s."]=".$this->min[$s]); |
|
| 142 | - echo("max[".$s."]=".$this->max[$s]); |
|
| 143 | - echo("eot[".$s."]=".$this->eot[$s]); |
|
| 144 | - echo("eof[".$s."]=".$this->eof[$s]); |
|
| 145 | - for ($p=0; $p<$this->transition[$s]->length; $p++) { |
|
| 146 | - echo $this->transition[$s][$p]+" "; |
|
| 140 | + if ($this->debug) { |
|
| 141 | + echo("min[" . $s . "]=" . $this->min[$s]); |
|
| 142 | + echo("max[" . $s . "]=" . $this->max[$s]); |
|
| 143 | + echo("eot[" . $s . "]=" . $this->eot[$s]); |
|
| 144 | + echo("eof[" . $s . "]=" . $this->eof[$s]); |
|
| 145 | + for ($p = 0; $p < $this->transition[$s]->length; $p++) { |
|
| 146 | + echo $this->transition[$s][$p] + " "; |
|
| 147 | 147 | } |
| 148 | 148 | echo "\n"; |
| 149 | 149 | } |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - public function noViableAlt($s, $input){ |
|
| 157 | - if ($this->recognizer->state->backtracking>0) { |
|
| 158 | - $this->recognizer->state->failed=true; |
|
| 156 | + public function noViableAlt($s, $input) { |
|
| 157 | + if ($this->recognizer->state->backtracking > 0) { |
|
| 158 | + $this->recognizer->state->failed = true; |
|
| 159 | 159 | return; |
| 160 | 160 | } |
| 161 | 161 | $nvae = |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** A hook for debugging interface */ |
| 171 | - protected function error($nvae) { ; } |
|
| 171 | + protected function error($nvae) {; } |
|
| 172 | 172 | |
| 173 | 173 | public function specialStateTransition($s, $input) |
| 174 | 174 | { |
@@ -187,19 +187,19 @@ discard block |
||
| 187 | 187 | public static function unpackEncodedString($encodedString) { |
| 188 | 188 | $data = array(); |
| 189 | 189 | $di = 0; |
| 190 | - for ($i=0,$len=strlen($encodedString); $i<$len; $i+=2) { |
|
| 190 | + for ($i = 0, $len = strlen($encodedString); $i < $len; $i += 2) { |
|
| 191 | 191 | $n = charAt($encodedString, $i); |
| 192 | - $v = charAt($encodedString, $i+1); |
|
| 192 | + $v = charAt($encodedString, $i + 1); |
|
| 193 | 193 | // add v n times to data |
| 194 | - for ($j=1; $j<=$n; $j++) { |
|
| 195 | - if($v==0xff) $v=-1; |
|
| 194 | + for ($j = 1; $j <= $n; $j++) { |
|
| 195 | + if ($v == 0xff) $v = -1; |
|
| 196 | 196 | $data[$di++] = $v; |
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | return $data; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - public function __call($fn, $params){ |
|
| 202 | + public function __call($fn, $params) { |
|
| 203 | 203 | return call_user_func_array(array($this->recognizer, $fn), $params); |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -68,8 +68,7 @@ discard block |
||
| 68 | 68 | try { |
| 69 | 69 | $ret = $this->_predict($input); |
| 70 | 70 | |
| 71 | - } |
|
| 72 | - catch(Exception $e) { |
|
| 71 | + } catch(Exception $e) { |
|
| 73 | 72 | $input->rewind($mark); |
| 74 | 73 | throw $e; |
| 75 | 74 | } |
@@ -80,7 +79,9 @@ discard block |
||
| 80 | 79 | public function _predict($input) { |
| 81 | 80 | $s = 0; // we always start at s0 |
| 82 | 81 | while ( true ) { |
| 83 | - if ( $this->debug ) echo ("DFA ".$this->decisionNumber." state ".$s." LA(1)=".$input->LA(1)."(".$input->LA(1)."), index=".$input->index()); |
|
| 82 | + if ( $this->debug ) { |
|
| 83 | + echo ("DFA ".$this->decisionNumber." state ".$s." LA(1)=".$input->LA(1)."(".$input->LA(1)."), index=".$input->index()); |
|
| 84 | + } |
|
| 84 | 85 | $specialState = $this->special[$s]; |
| 85 | 86 | if ( $specialState>=0 ) { |
| 86 | 87 | if ( $this->debug ) { |
@@ -101,7 +102,9 @@ discard block |
||
| 101 | 102 | } |
| 102 | 103 | |
| 103 | 104 | if ( $this->accept[$s] >= 1 ) { |
| 104 | - if ( $this->debug ) echo ("accept; predict "+$this->accept[$s]+" from state "+$this->s); |
|
| 105 | + if ( $this->debug ) { |
|
| 106 | + echo ("accept; predict "+$this->accept[$s]+" from state "+$this->s); |
|
| 107 | + } |
|
| 105 | 108 | return $this->accept[$s]; |
| 106 | 109 | } |
| 107 | 110 | // look for a normal char transition |
@@ -114,7 +117,9 @@ discard block |
||
| 114 | 117 | // eot[s]>=0 indicates that an EOT edge goes to another |
| 115 | 118 | // state. |
| 116 | 119 | if ( $this->eot[$s]>=0 ) { // EOT Transition to accept state? |
| 117 | - if ( $this->debug ) echo("EOT transition"); |
|
| 120 | + if ( $this->debug ) { |
|
| 121 | + echo("EOT transition"); |
|
| 122 | + } |
|
| 118 | 123 | $s = $this->eot[$s]; |
| 119 | 124 | $input->consume(); |
| 120 | 125 | continue; |
@@ -127,13 +132,17 @@ discard block |
||
| 127 | 132 | continue; |
| 128 | 133 | } |
| 129 | 134 | if ( $eot[$s]>=0 ) { // EOT Transition? |
| 130 | - if ( $this->debug ) println("EOT transition"); |
|
| 135 | + if ( $this->debug ) { |
|
| 136 | + println("EOT transition"); |
|
| 137 | + } |
|
| 131 | 138 | $s = $this->eot[$s]; |
| 132 | 139 | $input->consume(); |
| 133 | 140 | continue; |
| 134 | 141 | } |
| 135 | 142 | if ( $c==Token::$EOF && $eof[$s]>=0 ) { // EOF Transition to accept state? |
| 136 | - if ( $this->debug ) echo ("accept via EOF; predict "+$this->accept[$eof[$s]]+" from "+$eof[$s]); |
|
| 143 | + if ( $this->debug ) { |
|
| 144 | + echo ("accept via EOF; predict "+$this->accept[$eof[$s]]+" from "+$eof[$s]); |
|
| 145 | + } |
|
| 137 | 146 | return $this->accept[$eof[$s]]; |
| 138 | 147 | } |
| 139 | 148 | // not in range and not EOF/EOT, must be invalid symbol |
@@ -192,7 +201,9 @@ discard block |
||
| 192 | 201 | $v = charAt($encodedString, $i+1); |
| 193 | 202 | // add v n times to data |
| 194 | 203 | for ($j=1; $j<=$n; $j++) { |
| 195 | - if($v==0xff) $v=-1; |
|
| 204 | + if($v==0xff) { |
|
| 205 | + $v=-1; |
|
| 206 | + } |
|
| 196 | 207 | $data[$di++] = $v; |
| 197 | 208 | } |
| 198 | 209 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function __toString() { |
| 41 | - return "MismatchedNotSetException(".$this->getUnexpectedType()." not in [".a.",".b."])"; |
|
| 41 | + return "MismatchedNotSetException(" . $this->getUnexpectedType() . " not in [" . a . "," . b . "])"; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |