@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | const BUILD_DIRECTORY = BASE_DIRECTORY . '/build'; |
| 15 | 15 | const EMOJIBASE_DATA_DIRECTORY = BASE_DIRECTORY . '/node_modules/emojibase-data'; |
| 16 | 16 | |
| 17 | -if (! is_dir(EMOJIBASE_DATA_DIRECTORY) || ! interface_exists(EmojibaseInterface::class)) { |
|
| 17 | +if (!is_dir(EMOJIBASE_DATA_DIRECTORY) || !interface_exists(EmojibaseInterface::class)) { |
|
| 18 | 18 | throw new \RuntimeException('You must first run `npm install && npm run build` to build the datasets.'); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | $data = array_column($json, null, 'hexcode'); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if (! isset($data)) { |
|
| 34 | + if (!isset($data)) { |
|
| 35 | 35 | throw new \RuntimeException(sprintf('Unable to load JSON: %s', $file)); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // Merge any skin variations into the main list (faster performance). |
| 39 | 39 | foreach ($data as $hexcode => &$item) { |
| 40 | - if (! isset($item['shortcodes'])) { |
|
| 40 | + if (!isset($item['shortcodes'])) { |
|
| 41 | 41 | $item['shortcodes'] = []; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $item['shortcodes'] = Normalize::shortcodes($item['shortcodes'], $shortcodes[$hexcode]); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - if (! isset($item['skins']) || ! count($item['skins'])) { |
|
| 50 | + if (!isset($item['skins']) || !count($item['skins'])) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | foreach (EmojibaseShortcodeInterface::PRESETS as $preset) { |
| 91 | 91 | // Skip presets that don't exist. |
| 92 | 92 | $file = sprintf('%s/%s/shortcodes/%s.json', EMOJIBASE_DATA_DIRECTORY, $locale, $preset); |
| 93 | - if (! file_exists($file) || ! ($c = file_get_contents($file)) || ! ($shortcodes = json_decode($c, true))) { |
|
| 93 | + if (!file_exists($file) || !($c = file_get_contents($file)) || !($shortcodes = json_decode($c, true))) { |
|
| 94 | 94 | continue; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | { |
| 94 | 94 | return \current( |
| 95 | 95 | $this->skins->filter( |
| 96 | - static function (Emoji $emoji) use ($tone) { |
|
| 96 | + static function(Emoji $emoji) use ($tone) { |
|
| 97 | 97 | return \in_array($tone, (array) $emoji->tone, true); |
| 98 | 98 | } |
| 99 | 99 | )->getArrayCopy() |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // Immediately return if already empty or null. |
| 57 | - if (($emptyNullable && ! $value) || ($nullable && $value === null)) { |
|
| 57 | + if (($emptyNullable && !$value) || ($nullable && $value === null)) { |
|
| 58 | 58 | return null; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -67,14 +67,14 @@ discard block |
||
| 67 | 67 | // Determine if PHP type. |
| 68 | 68 | $phpType = \in_array($type, self::TYPES, true); |
| 69 | 69 | |
| 70 | - if (! $phpType && \class_exists($type)) { |
|
| 70 | + if (!$phpType && \class_exists($type)) { |
|
| 71 | 71 | $value = new $type($value); |
| 72 | 72 | if ($iterable && \is_iterable($value)) { |
| 73 | 73 | return $value; |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if (! $phpType && \is_callable($type)) { |
|
| 77 | + if (!$phpType && \is_callable($type)) { |
|
| 78 | 78 | $value = $type($value); |
| 79 | 79 | if ($iterable && \is_iterable($value)) { |
| 80 | 80 | return $value; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public static function setType($value, string $type, bool $emptyNullable = false) |
| 103 | 103 | { |
| 104 | - if ($emptyNullable && ! $value) { |
|
| 104 | + if ($emptyNullable && !$value) { |
|
| 105 | 105 | return null; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | break; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - return $emptyNullable && ! $value ? null : $value; |
|
| 141 | + return $emptyNullable && !$value ? null : $value; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $normalized = \array_values(\array_unique(\array_merge( |
| 154 | 154 | $normalized, |
| 155 | 155 | \array_map( |
| 156 | - static function ($shortcode) { |
|
| 156 | + static function($shortcode) { |
|
| 157 | 157 | return \preg_replace('/[^a-z0-9-]/', '-', \strtolower(\trim($shortcode, ':(){}[]'))); |
| 158 | 158 | }, |
| 159 | 159 | (array) $shortcodes |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $emoji = new Emoji($emoji); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if (! $emoji instanceof Emoji) { |
|
| 37 | + if (!$emoji instanceof Emoji) { |
|
| 38 | 38 | throw new \RuntimeException(\sprintf('Passed array item must be an instance of %s.', Emoji::class)); |
| 39 | 39 | } |
| 40 | 40 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | foreach ($emoji->skins as &$skin) { |
| 49 | 49 | $skinKeys = \array_filter((array) $skin->$index); |
| 50 | 50 | foreach ($skinKeys as $sk) { |
| 51 | - if (! isset($dataset[$sk])) { |
|
| 51 | + if (!isset($dataset[$sk])) { |
|
| 52 | 52 | $dataset[$sk] = &$skin; |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public static function unarchive(string $filename): self |
| 63 | 63 | { |
| 64 | - if (! \file_exists($filename)) { |
|
| 64 | + if (!\file_exists($filename)) { |
|
| 65 | 65 | throw new FileNotFoundException($filename); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | if ( |
| 69 | - ! ($contents = \file_get_contents($filename)) || |
|
| 70 | - ! ($decoded = \gzdecode($contents)) |
|
| 69 | + !($contents = \file_get_contents($filename)) || |
|
| 70 | + !($decoded = \gzdecode($contents)) |
|
| 71 | 71 | ) { |
| 72 | 72 | throw new UnarchiveException($filename); |
| 73 | 73 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | throw new MalformedArchiveException($filename, $throwable); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (! $dataset instanceof Dataset) { |
|
| 81 | + if (!$dataset instanceof Dataset) { |
|
| 82 | 82 | throw new MalformedArchiveException($filename); |
| 83 | 83 | } |
| 84 | 84 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | public function indexBy(string $index = 'hexcode'): Dataset |
| 110 | 110 | { |
| 111 | - if (! isset($this->indices[$index])) { |
|
| 111 | + if (!isset($this->indices[$index])) { |
|
| 112 | 112 | $this->indices[$index] = new self($this, $index); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function __construct(string $filename, ?string $message = null, ?Throwable $previous = null) |
| 12 | 12 | { |
| 13 | - if (! isset($message)) { |
|
| 13 | + if (!isset($message)) { |
|
| 14 | 14 | $message = \sprintf('Empty or corrupted archive: %s.', $filename); |
| 15 | 15 | } |
| 16 | 16 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function offsetExists($index) // phpcs:ignore |
| 49 | 49 | { |
| 50 | - if (! \array_key_exists($index, $this->getArrayCopy())) { |
|
| 50 | + if (!\array_key_exists($index, $this->getArrayCopy())) { |
|
| 51 | 51 | throw new \OutOfRangeException(\sprintf('Unknown property: %s', $index)); |
| 52 | 52 | } |
| 53 | 53 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $method = 'get' . \ucfirst(\substr($key, 0, 3) === 'get' ? \substr($key, 3) : $key); |
| 69 | - if (! \method_exists($this, $method)) { |
|
| 69 | + if (!\method_exists($this, $method)) { |
|
| 70 | 70 | throw new \OutOfRangeException(\sprintf('Unknown property: %s', $key)); |
| 71 | 71 | } |
| 72 | 72 | |