@@ -30,7 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | public function onRequest(Application $application, Request $request): void { |
| 32 | 32 | $locale = $request->getParameter($this->param); |
| 33 | - if($request->method === Request::FORWARD AND is_null($locale)) { |
|
| 33 | + if($request->method === Request::FORWARD and is_null($locale)) { |
|
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | $this->request = $request; |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | $variants = explode("|", $message); |
| 79 | 79 | foreach($variants as $variant) { |
| 80 | 80 | $interval = Intervals::findInterval($variant); |
| 81 | - if(is_string($interval) AND Intervals::isInInterval($count, $interval)) { |
|
| 81 | + if(is_string($interval) and Intervals::isInInterval($count, $interval)) { |
|
| 82 | 82 | return Strings::trim(Strings::after($variant, $interval)); |
| 83 | 83 | } |
| 84 | 84 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | protected function parseFile(string $filename): array { |
| 19 | 19 | $result = parse_ini_file($filename, true); |
| 20 | 20 | if($result === false) { |
| 21 | - throw new \RuntimeException("File $filename does not exist or cannot be read."); |
|
| 21 | + throw new \RuntimeException("file $filename does not exist or cannot be read."); |
|
| 22 | 22 | } |
| 23 | 23 | return $result; |
| 24 | 24 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | protected function parseFile(string $filename): array { |
| 22 | 22 | $content = file_get_contents($filename); |
| 23 | 23 | if($content === false) { |
| 24 | - throw new \RuntimeException("File $filename does not exist or cannot be read."); |
|
| 24 | + throw new \RuntimeException("file $filename does not exist or cannot be read."); |
|
| 25 | 25 | } |
| 26 | 26 | return Json::decode($content, Json::FORCE_ARRAY); |
| 27 | 27 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | public function setFolders(array $folders): void { |
| 98 | 98 | foreach($folders as $folder) { |
| 99 | 99 | if(!is_dir($folder)) { |
| 100 | - throw new InvalidFolderException("Folder $folder does not exist."); |
|
| 100 | + throw new InvalidFolderException("folder $folder does not exist."); |
|
| 101 | 101 | } |
| 102 | 102 | $this->folders[] = $folder; |
| 103 | 103 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | protected function addResource(string $filename, string $domain): void { |
| 108 | - if(!isset($this->resources[$domain]) OR !in_array($filename, $this->resources[$domain], true)) { |
|
| 108 | + if(!isset($this->resources[$domain]) or !in_array($filename, $this->resources[$domain], true)) { |
|
| 109 | 109 | $this->resources[$domain][] = $filename; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $lang = []; |
| 137 | 137 | $filename = str_replace($defaultLang, $this->lang, $defaultFilename); |
| 138 | 138 | $filename = str_replace($defaultFilename, $filename, $file->getPathname()); |
| 139 | - if($this->lang != $defaultLang AND is_file($filename)) { |
|
| 139 | + if($this->lang != $defaultLang and is_file($filename)) { |
|
| 140 | 140 | $lang = $this->parseFile($filename); |
| 141 | 141 | $this->addResource($filename, $name); |
| 142 | 142 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | protected function parseFile(string $filename): array { |
| 21 | 21 | $content = file_get_contents($filename); |
| 22 | 22 | if($content === false) { |
| 23 | - throw new \RuntimeException("File $filename does not exist or cannot be read."); |
|
| 23 | + throw new \RuntimeException("file $filename does not exist or cannot be read."); |
|
| 24 | 24 | } |
| 25 | 25 | return Neon::decode($content); |
| 26 | 26 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | final class MessageSelector implements IMessageSelector { |
| 15 | 15 | public function isMultiChoice(string $message): bool { |
| 16 | - return is_string(Intervals::findInterval($message)) AND Strings::contains($message, "|"); |
|
| 16 | + return is_string(Intervals::findInterval($message)) and Strings::contains($message, "|"); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | public function choose(string $message, int $count): string { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $variants = explode("|", $message); |
| 24 | 24 | foreach($variants as $variant) { |
| 25 | 25 | $interval = Intervals::findInterval($variant); |
| 26 | - if(is_string($interval) AND Intervals::isInInterval($count, $interval)) { |
|
| 26 | + if(is_string($interval) and Intervals::isInInterval($count, $interval)) { |
|
| 27 | 27 | return Strings::trim((string) Strings::after($variant, $interval)); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $resolver = Arrays::get($this->resolvers, strtolower($resolverName), ""); |
| 120 | 120 | if($resolver !== "") { |
| 121 | 121 | $return[] = $resolver; |
| 122 | - } elseif(class_exists($resolverName) AND is_subclass_of($resolverName, ILocaleResolver::class)) { |
|
| 122 | + } elseif(class_exists($resolverName) and is_subclass_of($resolverName, ILocaleResolver::class)) { |
|
| 123 | 123 | $return[] = $resolverName; |
| 124 | 124 | } else { |
| 125 | 125 | throw new InvalidLocaleResolverException("Invalid locale resolver $resolverName."); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $loader = Arrays::get($this->loaders, strtolower($loaderName), ""); |
| 140 | 140 | if($loader !== "") { |
| 141 | 141 | return $loader; |
| 142 | - } elseif(class_exists($loaderName) AND is_subclass_of($loaderName, ILoader::class)) { |
|
| 142 | + } elseif(class_exists($loaderName) and is_subclass_of($loaderName, ILoader::class)) { |
|
| 143 | 143 | return $loaderName; |
| 144 | 144 | } |
| 145 | 145 | throw new InvalidLoaderException("Invalid translation loader $loaderName."); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | foreach($folders as $folder) { |
| 161 | 161 | if(!is_dir($folder)) { |
| 162 | - throw new InvalidFolderException("Folder $folder does not exist."); |
|
| 162 | + throw new InvalidFolderException("folder $folder does not exist."); |
|
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | return $folders; |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $config = $this->getConfig(); |
| 174 | 174 | /** @var string $messageSelector */ |
| 175 | 175 | $messageSelector = $config->messageSelector; |
| 176 | - if(class_exists($messageSelector) AND is_subclass_of($messageSelector, IMessageSelector::class)) { |
|
| 176 | + if(class_exists($messageSelector) and is_subclass_of($messageSelector, IMessageSelector::class)) { |
|
| 177 | 177 | return $messageSelector; |
| 178 | 178 | } |
| 179 | 179 | throw new InvalidMessageSelectorException("Invalid message selector $messageSelector."); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $chainResolver->addSetup('$service[] = ?', [$resolverService]); |
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | - if($config->debugger AND interface_exists(\Tracy\IBarPanel::class)) { |
|
| 215 | + if($config->debugger and interface_exists(\Tracy\IBarPanel::class)) { |
|
| 216 | 216 | $builder->addDefinition($this->prefix(static::SERVICE_PANEL)) |
| 217 | 217 | ->setType(TranslationPanel::class); |
| 218 | 218 | /** @var ServiceDefinition $tracy */ |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | * @param string $message |
| 85 | 85 | */ |
| 86 | 86 | public function translate($message, ... $parameters): string { |
| 87 | - if(count($parameters) === 1 AND is_array($parameters[0])) { |
|
| 87 | + if(count($parameters) === 1 and is_array($parameters[0])) { |
|
| 88 | 88 | $count = $parameters[0]["count"] ?? 0; |
| 89 | 89 | $params = $parameters[0]; |
| 90 | 90 | } else { |