@@ -4,17 +4,22 @@ |
||
| 4 | 4 | |
| 5 | 5 | function dir_copy (string $from, string $to): bool |
| 6 | 6 | { |
| 7 | - if (!is_dir ($from)) |
|
| 8 | - return false; |
|
| 7 | + if (!is_dir ($from)) { |
|
| 8 | + return false; |
|
| 9 | + } |
|
| 9 | 10 | |
| 10 | - if (!is_dir ($to)) |
|
| 11 | - dir_create ($to); |
|
| 11 | + if (!is_dir ($to)) { |
|
| 12 | + dir_create ($to); |
|
| 13 | + } |
|
| 12 | 14 | |
| 13 | - foreach (array_slice (scandir ($from), 2) as $file) |
|
| 14 | - if (is_dir ($f = $from .'/'. $file)) |
|
| 15 | + foreach (array_slice (scandir ($from), 2) as $file) { |
|
| 16 | + if (is_dir ($f = $from .'/'. $file)) |
|
| 15 | 17 | dir_copy ($f, $to .'/'. $file); |
| 18 | + } |
|
| 16 | 19 | |
| 17 | - else copy ($f, $to .'/'. $file); |
|
| 20 | + else { |
|
| 21 | + copy ($f, $to .'/'. $file); |
|
| 22 | + } |
|
| 18 | 23 | |
| 19 | 24 | return true; |
| 20 | 25 | } |
@@ -16,10 +16,11 @@ discard block |
||
| 16 | 16 | $objects = VLFInterpreter::run (new VLFParser ($vlf, $settings)); |
| 17 | 17 | $designers = []; |
| 18 | 18 | |
| 19 | - foreach ($objects as $name => $object) |
|
| 20 | - if ($object instanceof Form) |
|
| 19 | + foreach ($objects as $name => $object) { |
|
| 20 | + if ($object instanceof Form) |
|
| 21 | 21 | { |
| 22 | 22 | $page = new TabPage ($name); |
| 23 | + } |
|
| 23 | 24 | $designers[$object->selector] = new VoidDesigner ($page, $name, $propertyGrid, $eventsList, $currentSelectedItem, $formsList, $object); |
| 24 | 25 | |
| 25 | 26 | $designers[$object->selector]->form->text = $object->text; |
@@ -28,20 +29,19 @@ discard block |
||
| 28 | 29 | |
| 29 | 30 | $formsList->items->add ($page); |
| 30 | 31 | $formsList->selectedTab = $page->selector; |
| 31 | - } |
|
| 32 | - |
|
| 33 | - elseif ($object instanceof Control) |
|
| 34 | - try |
|
| 32 | + } elseif ($object instanceof Control) { |
|
| 33 | + try |
|
| 35 | 34 | { |
| 36 | 35 | $parent = $object->parent; |
| 37 | - while (!isset ($designers[$parent->selector]) && $parent->parent) |
|
| 38 | - $parent = $parent->parent; |
|
| 39 | - |
|
| 40 | - if (isset ($designers[$parent->selector])) |
|
| 41 | - $designers[$parent->selector]->addComponent ($object->selector, $name); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - catch (\Throwable $e) {} |
|
| 36 | + } |
|
| 37 | + while (!isset ($designers[$parent->selector]) && $parent->parent) { |
|
| 38 | + $parent = $parent->parent; |
|
| 39 | + } |
|
| 40 | + |
|
| 41 | + if (isset ($designers[$parent->selector])) { |
|
| 42 | + $designers[$parent->selector]->addComponent ($object->selector, $name); |
|
| 43 | + } |
|
| 44 | + } catch (\Throwable $e) {} |
|
| 45 | 45 | |
| 46 | 46 | return $designers; |
| 47 | 47 | } |
@@ -78,15 +78,14 @@ |
||
| 78 | 78 | |
| 79 | 79 | public function __call ($method, $args) |
| 80 | 80 | { |
| 81 | - if (method_exists ($this, $method)) |
|
| 82 | - return $this->$method (...$args); |
|
| 83 | - |
|
| 84 | - else try |
|
| 81 | + if (method_exists ($this, $method)) { |
|
| 82 | + return $this->$method (...$args); |
|
| 83 | + } else { |
|
| 84 | + try |
|
| 85 | 85 | { |
| 86 | 86 | return $this->WinAPI->$method (...$args); |
| 87 | 87 | } |
| 88 | - |
|
| 89 | - catch (\Throwable $e) |
|
| 88 | + } catch (\Throwable $e) |
|
| 90 | 89 | { |
| 91 | 90 | throw new \Exception ('Method "'. $method .'" not found or return an exception. Exception info: '. "\n\n". (string) $e); |
| 92 | 91 | } |
@@ -338,8 +338,9 @@ |
||
| 338 | 338 | 'clLight' => $converter->fromHtml ('#EEEEEE') |
| 339 | 339 | ]; |
| 340 | 340 | |
| 341 | -foreach ($constants as $name => $value) |
|
| 341 | +foreach ($constants as $name => $value) { |
|
| 342 | 342 | define ($name, $value); |
| 343 | +} |
|
| 343 | 344 | |
| 344 | 345 | $argv = START_PARAMS; |
| 345 | 346 | $argc = sizeof ($argv); |
@@ -105,7 +105,8 @@ |
||
| 105 | 105 | require 'components/FastColoredTextBox.php'; |
| 106 | 106 | require 'components/Scintilla.php'; |
| 107 | 107 | |
| 108 | -if (is_dir ('extensions')) |
|
| 108 | +if (is_dir ('extensions')) { |
|
| 109 | 109 | foreach (scandir ('extensions') as $ext) |
| 110 | 110 | if (is_dir ('extensions/'. $ext) && file_exists ($ext = 'extensions/'. $ext .'/main.php')) |
| 111 | 111 | require $ext; |
| 112 | +} |
|
@@ -10,14 +10,13 @@ |
||
| 10 | 10 | { |
| 11 | 11 | try |
| 12 | 12 | { |
| 13 | - foreach ($args as $id => $arg) |
|
| 14 | - $args[$id] = EngineAdditions::coupleSelector ($arg); |
|
| 13 | + foreach ($args as $id => $arg) { |
|
| 14 | + $args[$id] = EngineAdditions::coupleSelector ($arg); |
|
| 15 | + } |
|
| 15 | 16 | |
| 16 | 17 | return $function (($e = _c($sender)) !== false ? |
| 17 | 18 | $e : new WFObject ($sender), ...$args); |
| 18 | - } |
|
| 19 | - |
|
| 20 | - catch (\Throwable $e) |
|
| 19 | + } catch (\Throwable $e) |
|
| 21 | 20 | { |
| 22 | 21 | message ([ |
| 23 | 22 | 'type' => get_class ($e), |
@@ -7,21 +7,23 @@ |
||
| 7 | 7 | const CORE_DIR = __DIR__; |
| 8 | 8 | chdir (CORE_DIR); |
| 9 | 9 | |
| 10 | -foreach (glob ('ext/php_*.dll') as $ext) |
|
| 10 | +foreach (glob ('ext/php_*.dll') as $ext) { |
|
| 11 | 11 | if (!extension_loaded (substr (basename ($ext), 4, -4))) |
| 12 | 12 | load_extension ($ext); |
| 13 | +} |
|
| 13 | 14 | |
| 14 | -if (file_exists ('../engine/VoidEngine.php')) |
|
| 15 | +if (file_exists ('../engine/VoidEngine.php')) { |
|
| 15 | 16 | require '../engine/VoidEngine.php'; |
| 16 | - |
|
| 17 | -elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php')) |
|
| 17 | +} elseif (file_exists (FRAMEWORK_DIR .'/engine/VoidEngine.php')) { |
|
| 18 | 18 | require FRAMEWORK_DIR .'/engine/VoidEngine.php'; |
| 19 | - |
|
| 20 | -else message ('VoidEngine not founded'); |
|
| 19 | +} else { |
|
| 20 | + message ('VoidEngine not founded'); |
|
| 21 | +} |
|
| 21 | 22 | |
| 22 | 23 | $app = '../../app/start.php'; |
| 23 | 24 | |
| 24 | -if (file_exists ($app)) |
|
| 25 | +if (file_exists ($app)) { |
|
| 25 | 26 | require $app; |
| 26 | - |
|
| 27 | -else \VoidCore::callMethod (\VoidCore::createObject ('WinForms_PHP.DebugForm', null), 'ShowDialog'); |
|
| 27 | +} else { |
|
| 28 | + \VoidCore::callMethod (\VoidCore::createObject ('WinForms_PHP.DebugForm', null), 'ShowDialog'); |
|
| 29 | +} |
|
@@ -25,18 +25,20 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function __construct (string $content, array $settings = []) |
| 27 | 27 | { |
| 28 | - if (file_exists ($content)) |
|
| 29 | - $content = file_get_contents ($content); |
|
| 28 | + if (file_exists ($content)) { |
|
| 29 | + $content = file_get_contents ($content); |
|
| 30 | + } |
|
| 30 | 31 | |
| 31 | 32 | // Зачем? Так надо! |
| 32 | 33 | $content = "# VLF begin\n\n$content\n\n# VLF end"; |
| 33 | 34 | |
| 34 | 35 | foreach ($settings as $name => $setting) |
| 35 | 36 | { |
| 36 | - if (isset ($this->$name)) |
|
| 37 | - $this->$name = $setting; |
|
| 38 | - |
|
| 39 | - else throw new \Exception ('Trying to setting up undefined property "'. $name .'"'); |
|
| 37 | + if (isset ($this->$name)) { |
|
| 38 | + $this->$name = $setting; |
|
| 39 | + } else { |
|
| 40 | + throw new \Exception ('Trying to setting up undefined property "'. $name .'"'); |
|
| 41 | + } |
|
| 40 | 42 | } |
| 41 | 43 | |
| 42 | 44 | if ($this->use_caching && file_exists ($file = VLF_EXT_DIR .'/cache/'. sha1 ($content) .'.cache')) |
@@ -49,9 +51,9 @@ discard block |
||
| 49 | 51 | $this->links = $info[1][1]; |
| 50 | 52 | |
| 51 | 53 | return; |
| 54 | + } else { |
|
| 55 | + unlink ($file); |
|
| 52 | 56 | } |
| 53 | - |
|
| 54 | - else unlink ($file); |
|
| 55 | 57 | } |
| 56 | 58 | |
| 57 | 59 | $info = $this->generateSyntaxTree ($content); |
@@ -61,8 +63,9 @@ discard block |
||
| 61 | 63 | |
| 62 | 64 | if ($this->use_caching) |
| 63 | 65 | { |
| 64 | - if (!is_dir (dirname (__DIR__) .'/cache')) |
|
| 65 | - mkdir (dirname (__DIR__) .'/cache'); |
|
| 66 | + if (!is_dir (dirname (__DIR__) .'/cache')) { |
|
| 67 | + mkdir (dirname (__DIR__) .'/cache'); |
|
| 68 | + } |
|
| 66 | 69 | |
| 67 | 70 | file_put_contents (VLF_EXT_DIR .'/cache/'. sha1 ($content) .'.cache', gzdeflate (serialize ([sha1 (file_get_contents (__FILE__)), $info]))); |
| 68 | 71 | } |
@@ -85,19 +88,22 @@ discard block |
||
| 85 | 88 | $tree = []; |
| 86 | 89 | $links = []; |
| 87 | 90 | |
| 88 | - if ($this->debug_mode) |
|
| 89 | - pre ($lines); |
|
| 91 | + if ($this->debug_mode) { |
|
| 92 | + pre ($lines); |
|
| 93 | + } |
|
| 90 | 94 | |
| 91 | 95 | foreach ($lines as $id => $line) |
| 92 | 96 | { |
| 93 | - if ($skip_at > $id) |
|
| 94 | - continue; |
|
| 97 | + if ($skip_at > $id) { |
|
| 98 | + continue; |
|
| 99 | + } |
|
| 95 | 100 | |
| 96 | 101 | $height = $this->getLineHeight ($line); |
| 97 | 102 | $words = $this->linesFilter (explode (' ', $line)); |
| 98 | 103 | |
| 99 | - if ($this->debug_mode) |
|
| 100 | - pre ($words); |
|
| 104 | + if ($this->debug_mode) { |
|
| 105 | + pre ($words); |
|
| 106 | + } |
|
| 101 | 107 | |
| 102 | 108 | /** |
| 103 | 109 | * Высокоинтеллектуальный фикс |
@@ -118,16 +124,18 @@ discard block |
||
| 118 | 124 | { |
| 119 | 125 | $updated = false; |
| 120 | 126 | |
| 121 | - if ($this->debug_mode) |
|
| 122 | - pre ($current_object); |
|
| 127 | + if ($this->debug_mode) { |
|
| 128 | + pre ($current_object); |
|
| 129 | + } |
|
| 123 | 130 | |
| 124 | 131 | while (isset ($tree[$current_object]['info']['subparent_link']) && $tree[$link = $tree[$current_object]['info']['subparent_link']->link]['hard'] < $tree[$current_object]['hard']) |
| 125 | 132 | { |
| 126 | 133 | $current_object = $link; |
| 127 | 134 | $updated = true; |
| 128 | 135 | |
| 129 | - if ($this->debug_mode) |
|
| 130 | - pre ($current_object); |
|
| 136 | + if ($this->debug_mode) { |
|
| 137 | + pre ($current_object); |
|
| 138 | + } |
|
| 131 | 139 | } |
| 132 | 140 | |
| 133 | 141 | if ( |
@@ -136,13 +144,15 @@ discard block |
||
| 136 | 144 | isset ($tree[$current_object]['info']['arguments'][0]) && |
| 137 | 145 | $tree[$current_object]['info']['arguments'][0] instanceof VLFLink && |
| 138 | 146 | $tree[$tree[$current_object]['info']['arguments'][0]->link]['hard'] < $tree[$current_object]['hard'] |
| 139 | - ) $current_object = $tree[$current_object]['info']['arguments'][0]->link; |
|
| 140 | - |
|
| 141 | - elseif (!$updated) |
|
| 142 | - break; |
|
| 147 | + ) { |
|
| 148 | + $current_object = $tree[$current_object]['info']['arguments'][0]->link; |
|
| 149 | + } elseif (!$updated) { |
|
| 150 | + break; |
|
| 151 | + } |
|
| 143 | 152 | |
| 144 | - if ($this->debug_mode) |
|
| 145 | - pre ($current_object); |
|
| 153 | + if ($this->debug_mode) { |
|
| 154 | + pre ($current_object); |
|
| 155 | + } |
|
| 146 | 156 | } |
| 147 | 157 | |
| 148 | 158 | /** |
@@ -150,8 +160,9 @@ discard block |
||
| 150 | 160 | */ |
| 151 | 161 | if (class_exists ($words[0]) || class_exists ('\VoidEngine\\'. $words[0])) |
| 152 | 162 | { |
| 153 | - if (!isset ($words[1])) |
|
| 154 | - throw new \Exception ('Object name mustn\'t be empty at line "'. $line .'"'); |
|
| 163 | + if (!isset ($words[1])) { |
|
| 164 | + throw new \Exception ('Object name mustn\'t be empty at line "'. $line .'"'); |
|
| 165 | + } |
|
| 155 | 166 | |
| 156 | 167 | /** |
| 157 | 168 | * Button NewButton |
@@ -179,9 +190,7 @@ discard block |
||
| 179 | 190 | $current_object = $id; |
| 180 | 191 | |
| 181 | 192 | continue; |
| 182 | - } |
|
| 183 | - |
|
| 184 | - else |
|
| 193 | + } else |
|
| 185 | 194 | { |
| 186 | 195 | $tree[$id] = [ |
| 187 | 196 | 'type' => VLF_OBJECT_DEFINITION, |
@@ -203,10 +212,9 @@ discard block |
||
| 203 | 212 | |
| 204 | 213 | $end = strrpos ($line, ')'); |
| 205 | 214 | |
| 206 | - if ($end === false) |
|
| 207 | - throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending'); |
|
| 208 | - |
|
| 209 | - elseif ($begin < $end) |
|
| 215 | + if ($end === false) { |
|
| 216 | + throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending'); |
|
| 217 | + } elseif ($begin < $end) |
|
| 210 | 218 | { |
| 211 | 219 | $arguments = []; |
| 212 | 220 | // $parsed = explode (',', substr ($line, $begin, $end - $begin)); |
@@ -216,18 +224,20 @@ discard block |
||
| 216 | 224 | { |
| 217 | 225 | $argument = trim ($argument); |
| 218 | 226 | |
| 219 | - if (strlen ($argument) > 0) |
|
| 220 | - $arguments[] = isset ($links[$argument]) ? |
|
| 227 | + if (strlen ($argument) > 0) { |
|
| 228 | + $arguments[] = isset ($links[$argument]) ? |
|
| 221 | 229 | new VLFLink ($argument, $links[$argument]) : |
| 222 | 230 | $argument; |
| 223 | - |
|
| 224 | - else throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"'); |
|
| 231 | + } else { |
|
| 232 | + throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"'); |
|
| 233 | + } |
|
| 225 | 234 | } |
| 226 | 235 | |
| 227 | 236 | $tree[$id]['info']['arguments'] = $arguments; |
| 228 | 237 | |
| 229 | - if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0) |
|
| 230 | - throw new \Exception ('You mustn\'t write any chars after arguments definition'); |
|
| 238 | + if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0) { |
|
| 239 | + throw new \Exception ('You mustn\'t write any chars after arguments definition'); |
|
| 240 | + } |
|
| 231 | 241 | } |
| 232 | 242 | |
| 233 | 243 | $tree[$id]['info']['subparent_link'] = new VLFLink ($tree[$current_object]['info']['object_name'], $current_object); |
@@ -291,13 +301,14 @@ discard block |
||
| 291 | 301 | |
| 292 | 302 | $comment .= $parsed[0]; |
| 293 | 303 | $skip_at = $parsed[1]; |
| 304 | + } else { |
|
| 305 | + throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"'); |
|
| 294 | 306 | } |
| 295 | - |
|
| 296 | - else throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"'); |
|
| 297 | 307 | } |
| 298 | 308 | |
| 299 | - if ($this->debug_mode) |
|
| 300 | - pre ("Comment:\n\n$comment"); |
|
| 309 | + if ($this->debug_mode) { |
|
| 310 | + pre ("Comment:\n\n$comment"); |
|
| 311 | + } |
|
| 301 | 312 | } |
| 302 | 313 | |
| 303 | 314 | /** |
@@ -319,9 +330,9 @@ discard block |
||
| 319 | 330 | |
| 320 | 331 | $code .= $parsed[0]; |
| 321 | 332 | $skip_at = $parsed[1]; |
| 333 | + } else { |
|
| 334 | + throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"'); |
|
| 322 | 335 | } |
| 323 | - |
|
| 324 | - else throw new \Exception ('Unknown char founded after syntax-control symbol at line "'. $line .'"'); |
|
| 325 | 336 | } |
| 326 | 337 | |
| 327 | 338 | $tree[$id] = [ |
@@ -376,8 +387,9 @@ discard block |
||
| 376 | 387 | |
| 377 | 388 | if ($postChar == ':' || $postChar == '^') |
| 378 | 389 | { |
| 379 | - if (!isset ($words[1])) |
|
| 380 | - throw new \Exception ('Property value mustn\'t be empty at line "'. $line .'"'); |
|
| 390 | + if (!isset ($words[1])) { |
|
| 391 | + throw new \Exception ('Property value mustn\'t be empty at line "'. $line .'"'); |
|
| 392 | + } |
|
| 381 | 393 | |
| 382 | 394 | $propertyName = substr ($words[0], 0, -1); |
| 383 | 395 | $propertyValue = implode (' ', array_slice ($words, 1)); |
@@ -412,8 +424,9 @@ discard block |
||
| 412 | 424 | 'syntax_nodes' => [] |
| 413 | 425 | ]; |
| 414 | 426 | |
| 415 | - if (isset ($links[$info['info']['property_value']])) |
|
| 416 | - $info['info']['property_value'] = new VLFLink ($info['info']['property_value'], $links[$info['info']['property_value']]); |
|
| 427 | + if (isset ($links[$info['info']['property_value']])) { |
|
| 428 | + $info['info']['property_value'] = new VLFLink ($info['info']['property_value'], $links[$info['info']['property_value']]); |
|
| 429 | + } |
|
| 417 | 430 | |
| 418 | 431 | $tree[$current_object]['syntax_nodes'][] = $info; |
| 419 | 432 | } |
@@ -431,10 +444,9 @@ discard block |
||
| 431 | 444 | |
| 432 | 445 | $end = strrpos ($line, ')'); |
| 433 | 446 | |
| 434 | - if ($end === false) |
|
| 435 | - throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending'); |
|
| 436 | - |
|
| 437 | - elseif ($begin < $end) |
|
| 447 | + if ($end === false) { |
|
| 448 | + throw new \Exception ('Line "'. $line .'" have arguments list initialization, but not have list ending'); |
|
| 449 | + } elseif ($begin < $end) |
|
| 438 | 450 | { |
| 439 | 451 | // $parsed = explode (',', substr ($line, $begin, $end - $begin)); |
| 440 | 452 | $parsed = $this->parseArguments (substr ($line, $begin, $end - $begin)); |
@@ -443,24 +455,27 @@ discard block |
||
| 443 | 455 | { |
| 444 | 456 | $argument = trim ($argument); |
| 445 | 457 | |
| 446 | - if (strlen ($argument) > 0) |
|
| 447 | - $arguments[] = isset ($links[$argument]) ? |
|
| 458 | + if (strlen ($argument) > 0) { |
|
| 459 | + $arguments[] = isset ($links[$argument]) ? |
|
| 448 | 460 | new VLFLink ($argument, $links[$argument]) : |
| 449 | 461 | $argument; |
| 450 | - |
|
| 451 | - else throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"'); |
|
| 462 | + } else { |
|
| 463 | + throw new \Exception ('Argument '. ($argument_id + 1) .' mustn\'t have zero length at line "'. $line .'"'); |
|
| 464 | + } |
|
| 452 | 465 | } |
| 453 | 466 | |
| 454 | - if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0) |
|
| 455 | - throw new \Exception ('You mustn\'t write any chars after arguments definition'); |
|
| 467 | + if (!$this->ignore_postobject_info && trim (substr ($line, $end)) > 0) { |
|
| 468 | + throw new \Exception ('You mustn\'t write any chars after arguments definition'); |
|
| 469 | + } |
|
| 456 | 470 | } |
| 457 | 471 | } |
| 458 | 472 | |
| 459 | 473 | /** |
| 460 | 474 | * ->show |
| 461 | 475 | */ |
| 462 | - elseif (!$this->ignore_unexpected_method_args) |
|
| 463 | - throw new \Exception ('Unexpected method arguments list at line "'. $line .'"'); |
|
| 476 | + elseif (!$this->ignore_unexpected_method_args) { |
|
| 477 | + throw new \Exception ('Unexpected method arguments list at line "'. $line .'"'); |
|
| 478 | + } |
|
| 464 | 479 | |
| 465 | 480 | $tree[$current_object]['syntax_nodes'][] = [ |
| 466 | 481 | 'type' => VLF_METHOD_CALL, |
@@ -513,7 +528,9 @@ discard block |
||
| 513 | 528 | /** |
| 514 | 529 | * Что-то загадочное, таинственное, неизвестное человечеству |
| 515 | 530 | */ |
| 516 | - else throw new \Exception ('Unknown structures founded at line "'. $line .'"'); |
|
| 531 | + else { |
|
| 532 | + throw new \Exception ('Unknown structures founded at line "'. $line .'"'); |
|
| 533 | + } |
|
| 517 | 534 | } |
| 518 | 535 | |
| 519 | 536 | return [$tree, $links]; |
@@ -535,8 +552,9 @@ discard block |
||
| 535 | 552 | |
| 536 | 553 | foreach ($lines as $line_id => $line) |
| 537 | 554 | { |
| 538 | - if ($line_id <= $begin_id) |
|
| 539 | - continue; |
|
| 555 | + if ($line_id <= $begin_id) { |
|
| 556 | + continue; |
|
| 557 | + } |
|
| 540 | 558 | |
| 541 | 559 | if (!(bool)(trim ($line))) |
| 542 | 560 | { |
@@ -547,13 +565,15 @@ discard block |
||
| 547 | 565 | |
| 548 | 566 | $height = $this->getLineHeight ($line); |
| 549 | 567 | |
| 550 | - if ($this->debug_mode) |
|
| 551 | - pre ("$height, $down_height, $line"); |
|
| 552 | - |
|
| 553 | - if ($height > $down_height) |
|
| 554 | - $parsed .= "$line\n"; |
|
| 568 | + if ($this->debug_mode) { |
|
| 569 | + pre ("$height, $down_height, $line"); |
|
| 570 | + } |
|
| 555 | 571 | |
| 556 | - else break; |
|
| 572 | + if ($height > $down_height) { |
|
| 573 | + $parsed .= "$line\n"; |
|
| 574 | + } else { |
|
| 575 | + break; |
|
| 576 | + } |
|
| 557 | 577 | } |
| 558 | 578 | |
| 559 | 579 | return [$parsed, $line_id]; |
@@ -577,8 +597,9 @@ discard block |
||
| 577 | 597 | { |
| 578 | 598 | $i = 0; |
| 579 | 599 | |
| 580 | - while (isset ($line[$i]) && $line[$i] == "\t") |
|
| 581 | - ++$i; |
|
| 600 | + while (isset ($line[$i]) && $line[$i] == "\t") { |
|
| 601 | + ++$i; |
|
| 602 | + } |
|
| 582 | 603 | |
| 583 | 604 | return strlen ($line = str_repeat (' ', $i) . substr ($line, $i)) - strlen ($line = trim ($line)); |
| 584 | 605 | } |
@@ -595,8 +616,9 @@ discard block |
||
| 595 | 616 | { |
| 596 | 617 | return array_filter ($segments, function ($text) |
| 597 | 618 | { |
| 598 | - if ($this->strong_line_parser && preg_match ('/[^a-z0-9]/i', $text)) |
|
| 599 | - throw new \Exception ('Line "'. $text .'" mustn\'t have any not-alphabet or not-numeric characters'); |
|
| 619 | + if ($this->strong_line_parser && preg_match ('/[^a-z0-9]/i', $text)) { |
|
| 620 | + throw new \Exception ('Line "'. $text .'" mustn\'t have any not-alphabet or not-numeric characters'); |
|
| 621 | + } |
|
| 600 | 622 | |
| 601 | 623 | return strlen (trim ($text)) > 0; |
| 602 | 624 | }); |
@@ -617,18 +639,15 @@ discard block |
||
| 617 | 639 | { |
| 618 | 640 | $t .= $arguments[$i]; |
| 619 | 641 | |
| 620 | - if ($arguments[$i] == '\\') |
|
| 621 | - $canSplit = $i + 1; |
|
| 622 | - |
|
| 623 | - elseif ($canSplit < $i) |
|
| 642 | + if ($arguments[$i] == '\\') { |
|
| 643 | + $canSplit = $i + 1; |
|
| 644 | + } elseif ($canSplit < $i) |
|
| 624 | 645 | { |
| 625 | - if ($arguments[$i] == '\'' && !$split2) |
|
| 626 | - $split1 = !$split1; |
|
| 627 | - |
|
| 628 | - elseif ($arguments[$i] == '"' && !$split1) |
|
| 629 | - $split2 = !$split2; |
|
| 630 | - |
|
| 631 | - elseif (!$split1 && !$split2 && $arguments[$i] == ',') |
|
| 646 | + if ($arguments[$i] == '\'' && !$split2) { |
|
| 647 | + $split1 = !$split1; |
|
| 648 | + } elseif ($arguments[$i] == '"' && !$split1) { |
|
| 649 | + $split2 = !$split2; |
|
| 650 | + } elseif (!$split1 && !$split2 && $arguments[$i] == ',') |
|
| 632 | 651 | { |
| 633 | 652 | $args[] = substr ($t, 0, -1); |
| 634 | 653 | $t = ''; |
@@ -8,9 +8,10 @@ |
||
| 8 | 8 | define ('VoidEngine\CORE_DIR', dirname (__DIR__) .'/qero-packages/winforms-php/VoidFramework/core'); |
| 9 | 9 | |
| 10 | 10 | # Подгружаем PHP расширения |
| 11 | -foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext) |
|
| 11 | +foreach (glob (CORE_DIR .'/ext/php_*.dll') as $ext) { |
|
| 12 | 12 | if (!extension_loaded (substr (basename ($ext), 4, -4))) |
| 13 | 13 | load_extension ($ext); |
| 14 | +} |
|
| 14 | 15 | |
| 15 | 16 | # Подгружаем Qero-пакеты |
| 16 | 17 | require __DIR__ .'/../qero-packages/autoload.php'; |