@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * @var RangeSetInterface[] |
| 29 | 29 | */ |
| 30 | - private $cache = []; |
|
| 30 | + private $cache=[]; |
|
| 31 | 31 | |
| 32 | 32 | public static function create(): self |
| 33 | 33 | { |
| 34 | 34 | /** @psalm-var array<string,string> $index */ |
| 35 | - $index = require __DIR__ . '/../config/ranges.php'; |
|
| 35 | + $index=require __DIR__ . '/../config/ranges.php'; |
|
| 36 | 36 | |
| 37 | 37 | return new self(__DIR__, $index); |
| 38 | 38 | } |
@@ -44,14 +44,14 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function __construct(string $path, array $index) |
| 46 | 46 | { |
| 47 | - $this->path = $path; |
|
| 48 | - $this->index = $index; |
|
| 47 | + $this->path=$path; |
|
| 48 | + $this->index=$index; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public function getRangeSet(string $propertyName): RangeSetInterface |
| 52 | 52 | { |
| 53 | 53 | if (!isset($this->cache[$propertyName])) { |
| 54 | - $this->cache[$propertyName] = $this->loadRangeSet($propertyName); |
|
| 54 | + $this->cache[$propertyName]=$this->loadRangeSet($propertyName); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | return $this->cache[$propertyName]; |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** @var mixed $file */ |
| 67 | - $file = $this->index[$propertyName]; |
|
| 67 | + $file=$this->index[$propertyName]; |
|
| 68 | 68 | if (!is_string($file)) { |
| 69 | 69 | throw new Exception\InvalidPropertyConfigException($propertyName, $file); |
| 70 | 70 | } |
| 71 | - $fileName = $this->path . $file; |
|
| 71 | + $fileName=$this->path . $file; |
|
| 72 | 72 | error_clear_last(); |
| 73 | 73 | /** |
| 74 | 74 | * @noinspection PhpIncludeInspection |
| 75 | 75 | * @psalm-suppress UnresolvableInclude |
| 76 | 76 | * @var RangeSetInterface|false $rangeSet |
| 77 | 77 | */ |
| 78 | - $rangeSet = @include $fileName; |
|
| 78 | + $rangeSet=@include $fileName; |
|
| 79 | 79 | if (false === $rangeSet) { |
| 80 | - $lastError = error_get_last(); |
|
| 80 | + $lastError=error_get_last(); |
|
| 81 | 81 | if (isset($lastError)) { |
| 82 | 82 | throw new Exception\PropertyFileNotLoadedException( |
| 83 | 83 | $propertyName, |
@@ -29,17 +29,17 @@ |
||
| 29 | 29 | string $propertyName, |
| 30 | 30 | string $propertyFile, |
| 31 | 31 | ?string $errorMessage, |
| 32 | - Throwable $previous = null |
|
| 32 | + Throwable $previous=null |
|
| 33 | 33 | ) { |
| 34 | - $this->propertyName = $propertyName; |
|
| 35 | - $this->propertyFile = $propertyFile; |
|
| 36 | - $this->errorMessage = $errorMessage; |
|
| 34 | + $this->propertyName=$propertyName; |
|
| 35 | + $this->propertyFile=$propertyFile; |
|
| 36 | + $this->errorMessage=$errorMessage; |
|
| 37 | 37 | parent::__construct($this->buildMessage(), 0, $previous); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | private function buildMessage(): string |
| 41 | 41 | { |
| 42 | - $message = |
|
| 42 | + $message= |
|
| 43 | 43 | "Failed to load range set for Unicode property '{$this->propertyName}' " . |
| 44 | 44 | "from file {$this->propertyFile}"; |
| 45 | 45 | |
@@ -29,16 +29,16 @@ |
||
| 29 | 29 | * @param mixed $propertyFile |
| 30 | 30 | * @param Throwable|null $previous |
| 31 | 31 | */ |
| 32 | - public function __construct(string $propertyName, $propertyFile, Throwable $previous = null) |
|
| 32 | + public function __construct(string $propertyName, $propertyFile, Throwable $previous=null) |
|
| 33 | 33 | { |
| 34 | - $this->propertyName = $propertyName; |
|
| 35 | - $this->propertyFile = $propertyFile; |
|
| 34 | + $this->propertyName=$propertyName; |
|
| 35 | + $this->propertyFile=$propertyFile; |
|
| 36 | 36 | parent::__construct($this->buildMessage(), 0, $previous); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | private function buildMessage(): string |
| 40 | 40 | { |
| 41 | - $fileNameType = gettype($this->propertyFile); |
|
| 41 | + $fileNameType=gettype($this->propertyFile); |
|
| 42 | 42 | |
| 43 | 43 | return |
| 44 | 44 | "Invalid config for Unicode property '{$this->propertyName}': " . |
@@ -15,9 +15,9 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | private $propertyName; |
| 17 | 17 | |
| 18 | - public function __construct(string $propertyName, Throwable $previous = null) |
|
| 18 | + public function __construct(string $propertyName, Throwable $previous=null) |
|
| 19 | 19 | { |
| 20 | - $this->propertyName = $propertyName; |
|
| 20 | + $this->propertyName=$propertyName; |
|
| 21 | 21 | parent::__construct("Range set not found for Unicode property '{$this->propertyName}'", 0, $previous); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -38,20 +38,20 @@ |
||
| 38 | 38 | * @param mixed $rangeSet |
| 39 | 39 | * @param Throwable|null $previous |
| 40 | 40 | */ |
| 41 | - public function __construct(string $propertyName, string $propertyFile, $rangeSet, Throwable $previous = null) |
|
| 41 | + public function __construct(string $propertyName, string $propertyFile, $rangeSet, Throwable $previous=null) |
|
| 42 | 42 | { |
| 43 | - $this->propertyName = $propertyName; |
|
| 44 | - $this->propertyFile = $propertyFile; |
|
| 45 | - $this->rangeSet = $rangeSet; |
|
| 43 | + $this->propertyName=$propertyName; |
|
| 44 | + $this->propertyFile=$propertyFile; |
|
| 45 | + $this->rangeSet=$rangeSet; |
|
| 46 | 46 | parent::__construct($this->buildMessage(), 0, $previous); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | private function buildMessage(): string |
| 50 | 50 | { |
| 51 | - $actualType = is_object($this->rangeSet) |
|
| 51 | + $actualType=is_object($this->rangeSet) |
|
| 52 | 52 | ? get_class($this->rangeSet) |
| 53 | 53 | : gettype($this->rangeSet); |
| 54 | - $expectedType = RangeSetInterface::class; |
|
| 54 | + $expectedType=RangeSetInterface::class; |
|
| 55 | 55 | |
| 56 | 56 | return |
| 57 | 57 | "Invalid range set loaded from {$this->propertyFile} for Unicode property '{$this->propertyName}':\n" . |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * @var RangeSetInterface[] |
| 35 | 35 | */ |
| 36 | - private $rangeSets = []; |
|
| 36 | + private $rangeSets=[]; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * @var string[] |
| 40 | 40 | */ |
| 41 | - private $scripts = []; |
|
| 41 | + private $scripts=[]; |
|
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * @var BuilderFactory |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | /** |
| 54 | 54 | * @var RangeInterface[][] |
| 55 | 55 | */ |
| 56 | - private $rangeBuffer = []; |
|
| 56 | + private $rangeBuffer=[]; |
|
| 57 | 57 | |
| 58 | 58 | public function __construct(PrettyPrinterAbstract $printer) |
| 59 | 59 | { |
| 60 | - $this->phpBuilder = new BuilderFactory(); |
|
| 61 | - $this->printer = $printer; |
|
| 60 | + $this->phpBuilder=new BuilderFactory(); |
|
| 61 | + $this->printer=$printer; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | public function parseUnicodeData(SplFileObject $file, callable $onProgress): void |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | public function parseScripts(SplFileObject $file, callable $onProgress): void |
| 72 | 72 | { |
| 73 | - $otherProperties = array_keys($this->rangeBuffer); |
|
| 73 | + $otherProperties=array_keys($this->rangeBuffer); |
|
| 74 | 74 | $this->parseProperties($file, $onProgress); |
| 75 | - $this->scripts = array_diff(array_keys($this->rangeBuffer), $otherProperties); |
|
| 75 | + $this->scripts=array_diff(array_keys($this->rangeBuffer), $otherProperties); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function parseProperties(SplFileObject $file, callable $onProgress): void |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | private function addRangeToBuffer(string $prop, RangeInterface ...$ranges): void |
| 86 | 86 | { |
| 87 | - $this->rangeBuffer[$prop] = array_merge($this->rangeBuffer[$prop] ?? [], $ranges); |
|
| 87 | + $this->rangeBuffer[$prop]=array_merge($this->rangeBuffer[$prop] ?? [], $ranges); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | public function getRangeBufferSize(): int |
@@ -99,17 +99,17 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | public function fetchBufferedRangeSets(callable $onProgress): void |
| 101 | 101 | { |
| 102 | - $count = 0; |
|
| 102 | + $count=0; |
|
| 103 | 103 | foreach ($this->rangeBuffer as $prop => $ranges) { |
| 104 | 104 | $this->addRangeSet($prop, ...$ranges); |
| 105 | 105 | $onProgress(++$count); |
| 106 | 106 | } |
| 107 | - $this->rangeBuffer = []; |
|
| 107 | + $this->rangeBuffer=[]; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | public function buildUnicodeDataDerivatives(callable $onProgress): void |
| 111 | 111 | { |
| 112 | - $map = [ |
|
| 112 | + $map=[ |
|
| 113 | 113 | 'C' => ['Cc', 'Cf', 'Co', 'Cs'], |
| 114 | 114 | 'L' => ['Ll', 'Lm', 'Lo', 'Lt', 'Lu'], |
| 115 | 115 | 'L&' => ['Lu', 'Ll', 'Lt'], |
@@ -120,18 +120,18 @@ discard block |
||
| 120 | 120 | 'Z' => ['Zl', 'Zp', 'Zs'], |
| 121 | 121 | ]; |
| 122 | 122 | |
| 123 | - $notCnRanges = []; |
|
| 123 | + $notCnRanges=[]; |
|
| 124 | 124 | foreach ($map as $targetProp => $sourceProps) { |
| 125 | 125 | foreach ($sourceProps as $prop) { |
| 126 | - $rangeSet = $this->getRangeSet($prop); |
|
| 127 | - $notCnRanges = array_merge($notCnRanges, $rangeSet->getRanges()); |
|
| 126 | + $rangeSet=$this->getRangeSet($prop); |
|
| 127 | + $notCnRanges=array_merge($notCnRanges, $rangeSet->getRanges()); |
|
| 128 | 128 | $this->addRangeToBuffer($targetProp, ...$rangeSet->getRanges()); |
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | try { |
| 133 | - $targetProp = 'Any'; |
|
| 134 | - $anyRangeSet = RangeSet::createUnsafe(new Range(0x00, 0x10FFFF)); |
|
| 133 | + $targetProp='Any'; |
|
| 134 | + $anyRangeSet=RangeSet::createUnsafe(new Range(0x00, 0x10FFFF)); |
|
| 135 | 135 | } catch (Throwable $e) { |
| 136 | 136 | throw new Exception\RangeSetNotBuiltException($targetProp, $e); |
| 137 | 137 | } |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | $this->addRangeToBuffer($targetProp, ...$anyRangeSet->getRanges()); |
| 140 | 140 | |
| 141 | 141 | try { |
| 142 | - $targetProp = 'Cn'; |
|
| 143 | - $notCnRangeSet = RangeSet::create(...$notCnRanges); |
|
| 142 | + $targetProp='Cn'; |
|
| 143 | + $notCnRangeSet=RangeSet::create(...$notCnRanges); |
|
| 144 | 144 | $onProgress(); |
| 145 | - $cnRanges = $notCnRangeSet |
|
| 145 | + $cnRanges=$notCnRangeSet |
|
| 146 | 146 | ->createSymmetricDifference($anyRangeSet) |
| 147 | 147 | ->getRanges(); |
| 148 | 148 | } catch (Throwable $e) { |
@@ -154,16 +154,16 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | public function buildScriptsDerivatives(callable $onProgress): void |
| 156 | 156 | { |
| 157 | - $knownRanges = []; |
|
| 157 | + $knownRanges=[]; |
|
| 158 | 158 | foreach ($this->scripts as $prop) { |
| 159 | - $knownRanges = array_merge($knownRanges, $this->getRangeSet($prop)->getRanges()); |
|
| 159 | + $knownRanges=array_merge($knownRanges, $this->getRangeSet($prop)->getRanges()); |
|
| 160 | 160 | $onProgress(); |
| 161 | 161 | } |
| 162 | 162 | try { |
| 163 | - $targetProp = 'Unknown'; |
|
| 164 | - $knownRangeSet = RangeSet::create(...$knownRanges); |
|
| 163 | + $targetProp='Unknown'; |
|
| 164 | + $knownRangeSet=RangeSet::create(...$knownRanges); |
|
| 165 | 165 | $onProgress(); |
| 166 | - $unknownRanges = $knownRangeSet |
|
| 166 | + $unknownRanges=$knownRangeSet |
|
| 167 | 167 | ->createSymmetricDifference($this->getRangeSet('Any')) |
| 168 | 168 | ->getRanges(); |
| 169 | 169 | } catch (Throwable $e) { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | throw new Exception\RangeSetAlreadyExistsException($prop); |
| 180 | 180 | } |
| 181 | 181 | try { |
| 182 | - $this->rangeSets[$prop] = RangeSet::create(...$ranges); |
|
| 182 | + $this->rangeSets[$prop]=RangeSet::create(...$ranges); |
|
| 183 | 183 | } catch (Throwable $e) { |
| 184 | 184 | throw new Exception\RangeSetNotBuiltException($prop, $e); |
| 185 | 185 | } |
@@ -196,22 +196,22 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | public function writeFiles(string $targetIndexRootDir, string $targetRootDir, callable $onProgress): void |
| 198 | 198 | { |
| 199 | - $fileIndex = []; |
|
| 199 | + $fileIndex=[]; |
|
| 200 | 200 | foreach ($this->rangeSets as $prop => $rangeSet) { |
| 201 | - $baseName = "/Ranges/{$prop}.php"; |
|
| 202 | - $fileName = $targetRootDir . $baseName; |
|
| 201 | + $baseName="/Ranges/{$prop}.php"; |
|
| 202 | + $fileName=$targetRootDir . $baseName; |
|
| 203 | 203 | try { |
| 204 | - $code = $this->buildPropertyFile($rangeSet); |
|
| 204 | + $code=$this->buildPropertyFile($rangeSet); |
|
| 205 | 205 | \Safe\file_put_contents($fileName, $code); |
| 206 | 206 | } catch (Throwable $e) { |
| 207 | 207 | throw new Exception\FileNotWrittenException($fileName); |
| 208 | 208 | } |
| 209 | - $fileIndex[$prop] = $baseName; |
|
| 209 | + $fileIndex[$prop]=$baseName; |
|
| 210 | 210 | $onProgress(); |
| 211 | 211 | } |
| 212 | - $fileName = $targetIndexRootDir . "/ranges.php"; |
|
| 212 | + $fileName=$targetIndexRootDir . "/ranges.php"; |
|
| 213 | 213 | try { |
| 214 | - $code = $this->buildIndexFile($fileIndex); |
|
| 214 | + $code=$this->buildIndexFile($fileIndex); |
|
| 215 | 215 | \Safe\file_put_contents($fileName, $code); |
| 216 | 216 | } catch (Throwable $e) { |
| 217 | 217 | throw new Exception\FileNotWrittenException($fileName); |
@@ -221,40 +221,40 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | private function buildIndexFile(array $index): string |
| 223 | 223 | { |
| 224 | - $array = var_export($index, true); |
|
| 224 | + $array=var_export($index, true); |
|
| 225 | 225 | |
| 226 | 226 | return "<?php\n\nreturn {$array};\n"; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | private function buildPropertyFile(RangeSetInterface $rangeSet): string |
| 230 | 230 | { |
| 231 | - $rangeSetClass = new ReflectionClass(RangeSet::class); |
|
| 231 | + $rangeSetClass=new ReflectionClass(RangeSet::class); |
|
| 232 | 232 | |
| 233 | - $phpNodes = []; |
|
| 234 | - $declare = new Declare_([new DeclareDeclare('strict_types', $this->phpBuilder->val(1))]); |
|
| 233 | + $phpNodes=[]; |
|
| 234 | + $declare=new Declare_([new DeclareDeclare('strict_types', $this->phpBuilder->val(1))]); |
|
| 235 | 235 | $declare->setDocComment(new Doc('/** @noinspection PhpUnhandledExceptionInspection */')); |
| 236 | - $phpNodes[] = $declare; |
|
| 237 | - $phpNodes[] = $this->phpBuilder->namespace(__NAMESPACE__ . '\\Properties')->getNode(); |
|
| 238 | - $phpNodes[] = $this->phpBuilder->use($rangeSetClass->getName())->getNode(); |
|
| 239 | - $phpRanges = []; |
|
| 236 | + $phpNodes[]=$declare; |
|
| 237 | + $phpNodes[]=$this->phpBuilder->namespace(__NAMESPACE__ . '\\Properties')->getNode(); |
|
| 238 | + $phpNodes[]=$this->phpBuilder->use($rangeSetClass->getName())->getNode(); |
|
| 239 | + $phpRanges=[]; |
|
| 240 | 240 | |
| 241 | 241 | foreach ($rangeSet->getRanges() as $range) { |
| 242 | - $rangeStart = $range->getStart(); |
|
| 243 | - $rangeFinish = $range->getFinish(); |
|
| 244 | - $phpRangeStart = $this->phpBuilder->val($rangeStart); |
|
| 242 | + $rangeStart=$range->getStart(); |
|
| 243 | + $rangeFinish=$range->getFinish(); |
|
| 244 | + $phpRangeStart=$this->phpBuilder->val($rangeStart); |
|
| 245 | 245 | $phpRangeStart->setAttribute('kind', LNumber::KIND_HEX); |
| 246 | - $phpRangeArgs = [$phpRangeStart]; |
|
| 246 | + $phpRangeArgs=[$phpRangeStart]; |
|
| 247 | 247 | if ($rangeStart != $rangeFinish) { |
| 248 | - $phpRangeFinish = $this->phpBuilder->val($rangeFinish); |
|
| 248 | + $phpRangeFinish=$this->phpBuilder->val($rangeFinish); |
|
| 249 | 249 | $phpRangeFinish->setAttribute('kind', LNumber::KIND_HEX); |
| 250 | - $phpRangeArgs[] = $phpRangeFinish; |
|
| 250 | + $phpRangeArgs[]=$phpRangeFinish; |
|
| 251 | 251 | } |
| 252 | - $phpRanges[] = new Array_($phpRangeArgs, ['kind' => Array_::KIND_SHORT]); |
|
| 252 | + $phpRanges[]=new Array_($phpRangeArgs, ['kind' => Array_::KIND_SHORT]); |
|
| 253 | 253 | } |
| 254 | - $import = $this |
|
| 254 | + $import=$this |
|
| 255 | 255 | ->phpBuilder |
| 256 | 256 | ->staticCall($rangeSetClass->getShortName(), 'importRanges', $phpRanges); |
| 257 | - $phpReturn = new Return_( |
|
| 257 | + $phpReturn=new Return_( |
|
| 258 | 258 | $this->phpBuilder->staticCall( |
| 259 | 259 | $rangeSetClass->getShortName(), |
| 260 | 260 | 'createUnsafe', |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | ) |
| 263 | 263 | ); |
| 264 | 264 | $phpReturn->setDocComment(new Doc('/** phpcs:disable Generic.Files.LineLength.TooLong */')); |
| 265 | - $phpNodes[] = $phpReturn; |
|
| 265 | + $phpNodes[]=$phpReturn; |
|
| 266 | 266 | |
| 267 | 267 | return $this->printer->prettyPrintFile($phpNodes); |
| 268 | 268 | } |
@@ -23,15 +23,15 @@ discard block |
||
| 23 | 23 | final class BuildPropertiesCommand extends Command |
| 24 | 24 | { |
| 25 | 25 | |
| 26 | - private const OPTION_TARGET_ROOT_PATH = 'target-root-path'; |
|
| 27 | - private const OPTION_TARGET_INDEX_ROOT_PATH = 'target-index-root-path'; |
|
| 28 | - private const OPTION_SOURCE_ROOT_PATH = 'source-root-path'; |
|
| 29 | - private const OPTION_SOURCE_UNICODE_DATA = 'source-unicode-data'; |
|
| 30 | - private const OPTION_SOURCE_SCRIPTS = 'source-scripts'; |
|
| 31 | - private const OPTION_SOURCE_PROP_LIST = 'source-prop-list'; |
|
| 32 | - private const OPTION_SOURCE_DERIVED_CORE_PROPERTIES = 'source-derived-core-properties'; |
|
| 26 | + private const OPTION_TARGET_ROOT_PATH='target-root-path'; |
|
| 27 | + private const OPTION_TARGET_INDEX_ROOT_PATH='target-index-root-path'; |
|
| 28 | + private const OPTION_SOURCE_ROOT_PATH='source-root-path'; |
|
| 29 | + private const OPTION_SOURCE_UNICODE_DATA='source-unicode-data'; |
|
| 30 | + private const OPTION_SOURCE_SCRIPTS='source-scripts'; |
|
| 31 | + private const OPTION_SOURCE_PROP_LIST='source-prop-list'; |
|
| 32 | + private const OPTION_SOURCE_DERIVED_CORE_PROPERTIES='source-derived-core-properties'; |
|
| 33 | 33 | |
| 34 | - protected static $defaultName = 'build'; |
|
| 34 | + protected static $defaultName='build'; |
|
| 35 | 35 | |
| 36 | 36 | protected function configure() |
| 37 | 37 | { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | protected function execute(InputInterface $input, OutputInterface $output) |
| 122 | 122 | { |
| 123 | 123 | $output->writeln($this->getApplication()->getName()); |
| 124 | - $propertyBuilder = new PropertyBuilder(new Standard()); |
|
| 124 | + $propertyBuilder=new PropertyBuilder(new Standard()); |
|
| 125 | 125 | $this->parseUnicodeData($propertyBuilder, $input, $output); |
| 126 | 126 | $this->parseScripts($propertyBuilder, $input, $output); |
| 127 | 127 | $this->parsePropList($propertyBuilder, $input, $output); |
@@ -136,13 +136,13 @@ discard block |
||
| 136 | 136 | InputInterface $input, |
| 137 | 137 | OutputInterface $output |
| 138 | 138 | ): void { |
| 139 | - $progressBar = new ProgressBar($output); |
|
| 140 | - $progressIndicator = new ProgressIndicator($output); |
|
| 139 | + $progressBar=new ProgressBar($output); |
|
| 140 | + $progressIndicator=new ProgressIndicator($output); |
|
| 141 | 141 | |
| 142 | 142 | $output->writeln(' Parsing UnicodeData.txt...'); |
| 143 | - $unicodeData = new SplFileObject($this->getSourceUnicodeData($input)); |
|
| 143 | + $unicodeData=new SplFileObject($this->getSourceUnicodeData($input)); |
|
| 144 | 144 | $progressBar->setMaxSteps($unicodeData->getSize()); |
| 145 | - $onParseProgress = function (int $byteCount) use ($progressBar): void { |
|
| 145 | + $onParseProgress=function(int $byteCount) use ($progressBar): void { |
|
| 146 | 146 | $progressBar->advance($byteCount); |
| 147 | 147 | }; |
| 148 | 148 | $progressBar->start(); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $this->fetchRangeSets($output, $propertyBuilder, $progressBar); |
| 154 | 154 | |
| 155 | 155 | $progressIndicator->start('Building UnicodeData derivatives...'); |
| 156 | - $onBuildProgress = function () use ($progressIndicator) { |
|
| 156 | + $onBuildProgress=function() use ($progressIndicator) { |
|
| 157 | 157 | $progressIndicator->advance(); |
| 158 | 158 | }; |
| 159 | 159 | $propertyBuilder->buildUnicodeDataDerivatives($onBuildProgress); |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | ProgressBar $progressBar |
| 168 | 168 | ): void { |
| 169 | 169 | $output->writeln(' Creating range sets from buffer...'); |
| 170 | - $bufferSize = $propertyBuilder->getRangeBufferSize(); |
|
| 170 | + $bufferSize=$propertyBuilder->getRangeBufferSize(); |
|
| 171 | 171 | $progressBar->setMaxSteps($bufferSize); |
| 172 | - $onFetchProgress = function (int $rangeSetIndex) use ($progressBar): void { |
|
| 172 | + $onFetchProgress=function(int $rangeSetIndex) use ($progressBar): void { |
|
| 173 | 173 | $progressBar->setProgress($rangeSetIndex); |
| 174 | 174 | }; |
| 175 | 175 | $progressBar->start(); |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | private function getSourceRootPath(InputInterface $input): string |
| 183 | 183 | { |
| 184 | - $optionName = self::OPTION_SOURCE_ROOT_PATH; |
|
| 185 | - $sourceRootPath = $input->getOption($optionName); |
|
| 184 | + $optionName=self::OPTION_SOURCE_ROOT_PATH; |
|
| 185 | + $sourceRootPath=$input->getOption($optionName); |
|
| 186 | 186 | if (is_string($sourceRootPath)) { |
| 187 | 187 | return $sourceRootPath; |
| 188 | 188 | } |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | private function getTargetRootPath(InputInterface $input): string |
| 194 | 194 | { |
| 195 | - $optionName = self::OPTION_TARGET_ROOT_PATH; |
|
| 196 | - $targetRootPath = $input->getOption($optionName); |
|
| 195 | + $optionName=self::OPTION_TARGET_ROOT_PATH; |
|
| 196 | + $targetRootPath=$input->getOption($optionName); |
|
| 197 | 197 | if (is_string($targetRootPath)) { |
| 198 | 198 | return $targetRootPath; |
| 199 | 199 | } |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | private function getTargetIndexRootPath(InputInterface $input): string |
| 205 | 205 | { |
| 206 | - $optionName = self::OPTION_TARGET_INDEX_ROOT_PATH; |
|
| 207 | - $targetRootPath = $input->getOption($optionName); |
|
| 206 | + $optionName=self::OPTION_TARGET_INDEX_ROOT_PATH; |
|
| 207 | + $targetRootPath=$input->getOption($optionName); |
|
| 208 | 208 | if (is_string($targetRootPath)) { |
| 209 | 209 | return $targetRootPath; |
| 210 | 210 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | private function getSourceFile(string $optionName, InputInterface $input): string |
| 236 | 236 | { |
| 237 | - $sourceScripts = $input->getOption($optionName); |
|
| 237 | + $sourceScripts=$input->getOption($optionName); |
|
| 238 | 238 | if (is_string($sourceScripts)) { |
| 239 | 239 | return $this->getSourceRootPath($input) . $sourceScripts; |
| 240 | 240 | } |
@@ -247,14 +247,14 @@ discard block |
||
| 247 | 247 | InputInterface $input, |
| 248 | 248 | OutputInterface $output |
| 249 | 249 | ): void { |
| 250 | - $progressBar = new ProgressBar($output); |
|
| 251 | - $progressIndicator = new ProgressIndicator($output); |
|
| 250 | + $progressBar=new ProgressBar($output); |
|
| 251 | + $progressIndicator=new ProgressIndicator($output); |
|
| 252 | 252 | |
| 253 | 253 | $output->writeln(' Parsing Scripts.txt...'); |
| 254 | 254 | |
| 255 | - $scripts = new SplFileObject($this->getSourceScripts($input)); |
|
| 255 | + $scripts=new SplFileObject($this->getSourceScripts($input)); |
|
| 256 | 256 | $progressBar->setMaxSteps($scripts->getSize()); |
| 257 | - $onParseProgress = function (int $byteCount) use ($progressBar): void { |
|
| 257 | + $onParseProgress=function(int $byteCount) use ($progressBar): void { |
|
| 258 | 258 | $progressBar->advance($byteCount); |
| 259 | 259 | }; |
| 260 | 260 | $progressBar->start(); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $this->fetchRangeSets($output, $propertyBuilder, $progressBar); |
| 266 | 266 | |
| 267 | 267 | $progressIndicator->start('Building Scripts derivatives...'); |
| 268 | - $onBuildProgress = function () use ($progressIndicator) { |
|
| 268 | + $onBuildProgress=function() use ($progressIndicator) { |
|
| 269 | 269 | $progressIndicator->advance(); |
| 270 | 270 | }; |
| 271 | 271 | $propertyBuilder->buildScriptsDerivatives($onBuildProgress); |
@@ -278,12 +278,12 @@ discard block |
||
| 278 | 278 | InputInterface $input, |
| 279 | 279 | OutputInterface $output |
| 280 | 280 | ): void { |
| 281 | - $progressBar = new ProgressBar($output); |
|
| 281 | + $progressBar=new ProgressBar($output); |
|
| 282 | 282 | |
| 283 | 283 | $output->writeln(' Parsing PropList.txt...'); |
| 284 | - $propList = new SplFileObject($this->getSourcePropList($input)); |
|
| 284 | + $propList=new SplFileObject($this->getSourcePropList($input)); |
|
| 285 | 285 | $progressBar->setMaxSteps($propList->getSize()); |
| 286 | - $onParseProgress = function (int $byteCount) use ($progressBar): void { |
|
| 286 | + $onParseProgress=function(int $byteCount) use ($progressBar): void { |
|
| 287 | 287 | $progressBar->advance($byteCount); |
| 288 | 288 | }; |
| 289 | 289 | $progressBar->start(); |
@@ -299,12 +299,12 @@ discard block |
||
| 299 | 299 | InputInterface $input, |
| 300 | 300 | OutputInterface $output |
| 301 | 301 | ): void { |
| 302 | - $progressBar = new ProgressBar($output); |
|
| 302 | + $progressBar=new ProgressBar($output); |
|
| 303 | 303 | |
| 304 | 304 | $output->writeln(' Parsing DerivedCoreProperties.txt...'); |
| 305 | - $derivedCoreProperties = new SplFileObject($this->getSourceDerivedCoreProperties($input)); |
|
| 305 | + $derivedCoreProperties=new SplFileObject($this->getSourceDerivedCoreProperties($input)); |
|
| 306 | 306 | $progressBar->setMaxSteps($derivedCoreProperties->getSize()); |
| 307 | - $onParseProgress = function (int $byteCount) use ($progressBar): void { |
|
| 307 | + $onParseProgress=function(int $byteCount) use ($progressBar): void { |
|
| 308 | 308 | $progressBar->advance($byteCount); |
| 309 | 309 | }; |
| 310 | 310 | $progressBar->start(); |
@@ -320,11 +320,11 @@ discard block |
||
| 320 | 320 | InputInterface $input, |
| 321 | 321 | OutputInterface $output |
| 322 | 322 | ): void { |
| 323 | - $progressBar = new ProgressBar($output); |
|
| 323 | + $progressBar=new ProgressBar($output); |
|
| 324 | 324 | |
| 325 | 325 | $output->writeln(' Writing target files...'); |
| 326 | 326 | $progressBar->setMaxSteps($propertyBuilder->getFileCount()); |
| 327 | - $onWriteProgress = function () use ($progressBar): void { |
|
| 327 | + $onWriteProgress=function() use ($progressBar): void { |
|
| 328 | 328 | $progressBar->advance(); |
| 329 | 329 | }; |
| 330 | 330 | $progressBar->start(); |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function __construct(SplFileObject $file, callable $onProgress) |
| 27 | 27 | { |
| 28 | - $this->file = $file; |
|
| 29 | - $this->onProgress = $onProgress; |
|
| 28 | + $this->file=$file; |
|
| 29 | + $this->onProgress=$onProgress; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function getIterator(): Iterator |
| 33 | 33 | { |
| 34 | 34 | while (!$this->file->eof()) { |
| 35 | - $line = $this->fetchNextLine($this->file); |
|
| 35 | + $line=$this->fetchNextLine($this->file); |
|
| 36 | 36 | if (!isset($line)) { |
| 37 | 37 | continue; |
| 38 | 38 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | private function fetchNextLine(SplFileObject $file): ?string |
| 46 | 46 | { |
| 47 | - $line = $file->fgets(); |
|
| 47 | + $line=$file->fgets(); |
|
| 48 | 48 | if (false === $line) { |
| 49 | 49 | throw new Exception\LineNotReadException($file->getFilename()); |
| 50 | 50 | } |
@@ -54,20 +54,20 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | private function fetchPropertyRange(string $line): Iterator |
| 56 | 56 | { |
| 57 | - $dataWithComment = explode('#', $line, 2); |
|
| 58 | - $data = trim($dataWithComment[0] ?? ''); |
|
| 57 | + $dataWithComment=explode('#', $line, 2); |
|
| 58 | + $data=trim($dataWithComment[0] ?? ''); |
|
| 59 | 59 | if ('' == $data) { |
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | - $rangeWithProp = explode(';', $data); |
|
| 63 | - $unSplitRange = trim($rangeWithProp[0] ?? null); |
|
| 64 | - $prop = trim($rangeWithProp[1] ?? null); |
|
| 62 | + $rangeWithProp=explode(';', $data); |
|
| 63 | + $unSplitRange=trim($rangeWithProp[0] ?? null); |
|
| 64 | + $prop=trim($rangeWithProp[1] ?? null); |
|
| 65 | 65 | if (!isset($unSplitRange, $prop)) { |
| 66 | 66 | throw new Exception\InvalidLineException($line); |
| 67 | 67 | } |
| 68 | - $splitRange = explode('..', $unSplitRange); |
|
| 69 | - $start = hexdec($splitRange[0]); |
|
| 70 | - $finish = isset($splitRange[1]) |
|
| 68 | + $splitRange=explode('..', $unSplitRange); |
|
| 69 | + $start=hexdec($splitRange[0]); |
|
| 70 | + $finish=isset($splitRange[1]) |
|
| 71 | 71 | ? hexdec($splitRange[1]) |
| 72 | 72 | : $start; |
| 73 | 73 | |
@@ -32,28 +32,28 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | private $rangeStart; |
| 34 | 34 | |
| 35 | - private $namedStarts = []; |
|
| 35 | + private $namedStarts=[]; |
|
| 36 | 36 | |
| 37 | 37 | public function __construct(SplFileObject $file, callable $onProgress) |
| 38 | 38 | { |
| 39 | - $this->file = $file; |
|
| 40 | - $this->onProgress = $onProgress; |
|
| 39 | + $this->file=$file; |
|
| 40 | + $this->onProgress=$onProgress; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function getIterator(): Iterator |
| 44 | 44 | { |
| 45 | 45 | while (!$this->file->eof()) { |
| 46 | - $line = $this->fetchNextLine($this->file); |
|
| 46 | + $line=$this->fetchNextLine($this->file); |
|
| 47 | 47 | if (!isset($line)) { |
| 48 | 48 | continue; |
| 49 | 49 | } |
| 50 | - $range = $this->fetchUnicodeDataRange($line); |
|
| 50 | + $range=$this->fetchUnicodeDataRange($line); |
|
| 51 | 51 | if (isset($range)) { |
| 52 | 52 | yield $this->lastProp => $range; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $this->lastCode = $this->code; |
|
| 56 | - $this->lastProp = $this->prop; |
|
| 55 | + $this->lastCode=$this->code; |
|
| 56 | + $this->lastProp=$this->prop; |
|
| 57 | 57 | |
| 58 | 58 | ($this->onProgress)(strlen($line)); |
| 59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | private function fetchNextLine(SplFileObject $file): ?string |
| 63 | 63 | { |
| 64 | - $line = $file->fgets(); |
|
| 64 | + $line=$file->fgets(); |
|
| 65 | 65 | if (false === $line) { |
| 66 | 66 | throw new Exception\LineNotReadException($file->getFilename()); |
| 67 | 67 | } |
@@ -71,26 +71,26 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | private function parseUnicodeDataLineLine(string $line): void |
| 73 | 73 | { |
| 74 | - $splitLine = explode(';', $line); |
|
| 75 | - $codeHex = $splitLine[0] ?? null; |
|
| 76 | - $name = $splitLine[1] ?? null; |
|
| 77 | - $prop = $splitLine[2] ?? null; |
|
| 74 | + $splitLine=explode(';', $line); |
|
| 75 | + $codeHex=$splitLine[0] ?? null; |
|
| 76 | + $name=$splitLine[1] ?? null; |
|
| 77 | + $prop=$splitLine[2] ?? null; |
|
| 78 | 78 | if (!isset($codeHex, $name, $prop)) { |
| 79 | 79 | throw new Exception\InvalidLineException($line); |
| 80 | 80 | } |
| 81 | - $this->code = hexdec($codeHex); |
|
| 82 | - $this->name = $name; |
|
| 83 | - $this->prop = $prop; |
|
| 81 | + $this->code=hexdec($codeHex); |
|
| 82 | + $this->name=$name; |
|
| 83 | + $this->prop=$prop; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | private function fetchUnicodeDataRange(string $line): ?RangeInterface |
| 87 | 87 | { |
| 88 | 88 | $this->parseUnicodeDataLineLine($line); |
| 89 | 89 | |
| 90 | - [$firstName, $lastName] = $this->parseRangeBoundary($this->name); |
|
| 90 | + [$firstName, $lastName]=$this->parseRangeBoundary($this->name); |
|
| 91 | 91 | if (isset($firstName)) { |
| 92 | - $this->namedStarts[$firstName] = $this->code; |
|
| 93 | - $this->rangeStart = null; |
|
| 92 | + $this->namedStarts[$firstName]=$this->code; |
|
| 93 | + $this->rangeStart=null; |
|
| 94 | 94 | |
| 95 | 95 | return null; |
| 96 | 96 | } |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | return null; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - $range = isset($this->rangeStart, $this->lastCode) |
|
| 114 | + $range=isset($this->rangeStart, $this->lastCode) |
|
| 115 | 115 | ? $this->createRange($this->rangeStart, $this->lastCode) |
| 116 | 116 | : null; |
| 117 | 117 | |
| 118 | - $this->rangeStart = $this->code; |
|
| 118 | + $this->rangeStart=$this->code; |
|
| 119 | 119 | |
| 120 | 120 | return $range; |
| 121 | 121 | } |
@@ -123,12 +123,12 @@ discard block |
||
| 123 | 123 | private function parseRangeBoundary(string $name): array |
| 124 | 124 | { |
| 125 | 125 | try { |
| 126 | - $isFirst = 1 === \Safe\preg_match('#^<(.+), First>$#', $name, $matches); |
|
| 126 | + $isFirst=1 === \Safe\preg_match('#^<(.+), First>$#', $name, $matches); |
|
| 127 | 127 | if ($isFirst) { |
| 128 | 128 | return [$matches[1] ?? null, null]; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $isLast = 1 === \Safe\preg_match('#^<(.+), Last>$#', $name, $matches); |
|
| 131 | + $isLast=1 === \Safe\preg_match('#^<(.+), Last>$#', $name, $matches); |
|
| 132 | 132 | |
| 133 | 133 | return $isLast |
| 134 | 134 | ? [null, $matches[1] ?? null] |