Completed
Pull Request — develop (#1810)
by
unknown
18:58
created
vendor/gettext/gettext/src/Extractors/ExtractorInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      * @param Translations $translations The translations instance to append the new translations.
14 14
      * @param array        $options
15 15
      */
16
-    public static function fromFile($file, Translations $translations, array $options = []);
16
+    public static function fromFile( $file, Translations $translations, array $options = [ ] );
17 17
 
18 18
     /**
19 19
      * Parses a string and append the translations found in the Translations instance.
@@ -22,5 +22,5 @@  discard block
 block discarded – undo
22 22
      * @param Translations $translations
23 23
      * @param array        $options
24 24
      */
25
-    public static function fromString($string, Translations $translations, array $options = []);
25
+    public static function fromString( $string, Translations $translations, array $options = [ ] );
26 26
 }
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/Csv.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,31 +23,31 @@
 block discarded – undo
23 23
     /**
24 24
      * {@inheritdoc}
25 25
      */
26
-    public static function fromString($string, Translations $translations, array $options = [])
26
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
27 27
     {
28 28
         $options += static::$options;
29
-        $handle = fopen('php://memory', 'w');
29
+        $handle = fopen( 'php://memory', 'w' );
30 30
 
31
-        fputs($handle, $string);
32
-        rewind($handle);
31
+        fputs( $handle, $string );
32
+        rewind( $handle );
33 33
 
34
-        while ($row = static::fgetcsv($handle, $options)) {
35
-            $context = array_shift($row);
36
-            $original = array_shift($row);
34
+        while ( $row = static::fgetcsv( $handle, $options ) ) {
35
+            $context = array_shift( $row );
36
+            $original = array_shift( $row );
37 37
 
38
-            if ($context === '' && $original === '') {
39
-                static::extractHeaders(array_shift($row), $translations);
38
+            if ( $context === '' && $original === '' ) {
39
+                static::extractHeaders( array_shift( $row ), $translations );
40 40
                 continue;
41 41
             }
42 42
 
43
-            $translation = $translations->insert($context, $original);
43
+            $translation = $translations->insert( $context, $original );
44 44
 
45
-            if (!empty($row)) {
46
-                $translation->setTranslation(array_shift($row));
47
-                $translation->setPluralTranslations($row);
45
+            if ( ! empty( $row ) ) {
46
+                $translation->setTranslation( array_shift( $row ) );
47
+                $translation->setPluralTranslations( $row );
48 48
             }
49 49
         }
50 50
 
51
-        fclose($handle);
51
+        fclose( $handle );
52 52
     }
53 53
 }
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/PhpCode.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         // - array with strings to extract comments format.
19 19
         'extractComments' => false,
20 20
 
21
-        'constants' => [],
21
+        'constants' => [ ],
22 22
 
23 23
         'functions' => [
24 24
             'gettext' => 'gettext',
@@ -48,37 +48,37 @@  discard block
 block discarded – undo
48 48
      * {@inheritdoc}
49 49
      * @throws Exception
50 50
      */
51
-    public static function fromString($string, Translations $translations, array $options = [])
51
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
52 52
     {
53
-        static::fromStringMultiple($string, [$translations], $options);
53
+        static::fromStringMultiple( $string, [ $translations ], $options );
54 54
     }
55 55
 
56 56
     /**
57 57
      * @inheritDoc
58 58
      * @throws Exception
59 59
      */
60
-    public static function fromStringMultiple($string, array $translations, array $options = [])
60
+    public static function fromStringMultiple( $string, array $translations, array $options = [ ] )
61 61
     {
62 62
         $options += static::$options;
63 63
 
64 64
         /** @var FunctionsScanner $functions */
65
-        $functions = new static::$functionsScannerClass($string);
65
+        $functions = new static::$functionsScannerClass( $string );
66 66
 
67
-        if ($options['extractComments'] !== false) {
68
-            $functions->enableCommentsExtraction($options['extractComments']);
67
+        if ( $options[ 'extractComments' ] !== false ) {
68
+            $functions->enableCommentsExtraction( $options[ 'extractComments' ] );
69 69
         }
70 70
 
71
-        $functions->saveGettextFunctions($translations, $options);
71
+        $functions->saveGettextFunctions( $translations, $options );
72 72
     }
73 73
 
74 74
     /**
75 75
      * @inheritDoc
76 76
      */
77
-    public static function fromFileMultiple($file, array $translations, array $options = [])
77
+    public static function fromFileMultiple( $file, array $translations, array $options = [ ] )
78 78
     {
79
-        foreach (static::getFiles($file) as $file) {
80
-            $options['file'] = $file;
81
-            static::fromStringMultiple(static::readFile($file), $translations, $options);
79
+        foreach ( static::getFiles( $file ) as $file ) {
80
+            $options[ 'file' ] = $file;
81
+            static::fromStringMultiple( static::readFile( $file ), $translations, $options );
82 82
         }
83 83
     }
84 84
 
@@ -90,22 +90,22 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @return string
92 92
      */
93
-    public static function convertString($value)
93
+    public static function convertString( $value )
94 94
     {
95
-        if (strpos($value, '\\') === false) {
96
-            return substr($value, 1, -1);
95
+        if ( strpos( $value, '\\' ) === false ) {
96
+            return substr( $value, 1, -1 );
97 97
         }
98 98
 
99
-        if ($value[0] === "'") {
100
-            return strtr(substr($value, 1, -1), ['\\\\' => '\\', '\\\'' => '\'']);
99
+        if ( $value[ 0 ] === "'" ) {
100
+            return strtr( substr( $value, 1, -1 ), [ '\\\\' => '\\', '\\\'' => '\'' ] );
101 101
         }
102 102
 
103
-        $value = substr($value, 1, -1);
103
+        $value = substr( $value, 1, -1 );
104 104
 
105 105
         return preg_replace_callback(
106 106
             '/\\\(n|r|t|v|e|f|\$|"|\\\|x[0-9A-Fa-f]{1,2}|u{[0-9a-f]{1,6}}|[0-7]{1,3})/',
107
-            function ($match) {
108
-                switch ($match[1][0]) {
107
+            function( $match ) {
108
+                switch ( $match[ 1 ][ 0 ] ) {
109 109
                     case 'n':
110 110
                         return "\n";
111 111
                     case 'r':
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
                     case '\\':
126 126
                         return '\\';
127 127
                     case 'x':
128
-                        return chr(hexdec(substr($match[1], 1)));
128
+                        return chr( hexdec( substr( $match[ 1 ], 1 ) ) );
129 129
                     case 'u':
130
-                        return static::unicodeChar(hexdec(substr($match[1], 1)));
130
+                        return static::unicodeChar( hexdec( substr( $match[ 1 ], 1 ) ) );
131 131
                     default:
132
-                        return chr(octdec($match[1]));
132
+                        return chr( octdec( $match[ 1 ] ) );
133 133
                 }
134 134
             },
135 135
             $value
@@ -141,28 +141,28 @@  discard block
 block discarded – undo
141 141
      * @return string|null
142 142
      * @see http://php.net/manual/en/function.chr.php#118804
143 143
      */
144
-    protected static function unicodeChar($dec)
144
+    protected static function unicodeChar( $dec )
145 145
     {
146
-        if ($dec < 0x80) {
147
-            return chr($dec);
146
+        if ( $dec < 0x80 ) {
147
+            return chr( $dec );
148 148
         }
149 149
 
150
-        if ($dec < 0x0800) {
151
-            return chr(0xC0 + ($dec >> 6))
152
-                . chr(0x80 + ($dec & 0x3f));
150
+        if ( $dec < 0x0800 ) {
151
+            return chr( 0xC0 + ( $dec >> 6 ) )
152
+                . chr( 0x80 + ( $dec & 0x3f ) );
153 153
         }
154 154
 
155
-        if ($dec < 0x010000) {
156
-            return chr(0xE0 + ($dec >> 12))
157
-                . chr(0x80 + (($dec >> 6) & 0x3f))
158
-                . chr(0x80 + ($dec & 0x3f));
155
+        if ( $dec < 0x010000 ) {
156
+            return chr( 0xE0 + ( $dec >> 12 ) )
157
+                . chr( 0x80 + ( ( $dec >> 6 ) & 0x3f ) )
158
+                . chr( 0x80 + ( $dec & 0x3f ) );
159 159
         }
160 160
 
161
-        if ($dec < 0x200000) {
162
-            return chr(0xF0 + ($dec >> 18))
163
-                . chr(0x80 + (($dec >> 12) & 0x3f))
164
-                . chr(0x80 + (($dec >> 6) & 0x3f))
165
-                . chr(0x80 + ($dec & 0x3f));
161
+        if ( $dec < 0x200000 ) {
162
+            return chr( 0xF0 + ( $dec >> 18 ) )
163
+                . chr( 0x80 + ( ( $dec >> 12 ) & 0x3f ) )
164
+                . chr( 0x80 + ( ( $dec >> 6 ) & 0x3f ) )
165
+                . chr( 0x80 + ( $dec & 0x3f ) );
166 166
         }
167 167
 
168 168
         return null;
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/JsonDictionary.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@
 block discarded – undo
15 15
     /**
16 16
      * {@inheritdoc}
17 17
      */
18
-    public static function fromString($string, Translations $translations, array $options = [])
18
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
19 19
     {
20
-        $messages = json_decode($string, true);
20
+        $messages = json_decode( $string, true );
21 21
 
22
-        if (is_array($messages)) {
23
-            static::fromArray($messages, $translations);
22
+        if ( is_array( $messages ) ) {
23
+            static::fromArray( $messages, $translations );
24 24
         }
25 25
     }
26 26
 }
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/Mo.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -20,87 +20,87 @@  discard block
 block discarded – undo
20 20
     /**
21 21
      * {@inheritdoc}
22 22
      */
23
-    public static function fromString($string, Translations $translations, array $options = [])
23
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
24 24
     {
25 25
         /** @var StringReader $stream */
26
-        $stream = new static::$stringReaderClass($string);
27
-        $magic = static::readInt($stream, 'V');
26
+        $stream = new static::$stringReaderClass( $string );
27
+        $magic = static::readInt( $stream, 'V' );
28 28
 
29
-        if (($magic === static::MAGIC1) || ($magic === static::MAGIC3)) { //to make sure it works for 64-bit platforms
29
+        if ( ( $magic === static::MAGIC1 ) || ( $magic === static::MAGIC3 ) ) { //to make sure it works for 64-bit platforms
30 30
             $byteOrder = 'V'; //low endian
31
-        } elseif ($magic === (static::MAGIC2 & 0xFFFFFFFF)) {
31
+        } elseif ( $magic === ( static::MAGIC2 & 0xFFFFFFFF ) ) {
32 32
             $byteOrder = 'N'; //big endian
33 33
         } else {
34
-            throw new Exception('Not MO file');
34
+            throw new Exception( 'Not MO file' );
35 35
         }
36 36
 
37
-        static::readInt($stream, $byteOrder);
37
+        static::readInt( $stream, $byteOrder );
38 38
 
39
-        $total = static::readInt($stream, $byteOrder); //total string count
40
-        $originals = static::readInt($stream, $byteOrder); //offset of original table
41
-        $tran = static::readInt($stream, $byteOrder); //offset of translation table
39
+        $total = static::readInt( $stream, $byteOrder ); //total string count
40
+        $originals = static::readInt( $stream, $byteOrder ); //offset of original table
41
+        $tran = static::readInt( $stream, $byteOrder ); //offset of translation table
42 42
 
43
-        $stream->seekto($originals);
44
-        $table_originals = static::readIntArray($stream, $byteOrder, $total * 2);
43
+        $stream->seekto( $originals );
44
+        $table_originals = static::readIntArray( $stream, $byteOrder, $total * 2 );
45 45
 
46
-        $stream->seekto($tran);
47
-        $table_translations = static::readIntArray($stream, $byteOrder, $total * 2);
46
+        $stream->seekto( $tran );
47
+        $table_translations = static::readIntArray( $stream, $byteOrder, $total * 2 );
48 48
 
49
-        for ($i = 0; $i < $total; ++$i) {
49
+        for ( $i = 0; $i < $total; ++$i ) {
50 50
             $next = $i * 2;
51 51
 
52
-            $stream->seekto($table_originals[$next + 2]);
53
-            $original = $stream->read($table_originals[$next + 1]);
52
+            $stream->seekto( $table_originals[ $next + 2 ] );
53
+            $original = $stream->read( $table_originals[ $next + 1 ] );
54 54
 
55
-            $stream->seekto($table_translations[$next + 2]);
56
-            $translated = $stream->read($table_translations[$next + 1]);
55
+            $stream->seekto( $table_translations[ $next + 2 ] );
56
+            $translated = $stream->read( $table_translations[ $next + 1 ] );
57 57
 
58
-            if ($original === '') {
58
+            if ( $original === '' ) {
59 59
                 // Headers
60
-                foreach (explode("\n", $translated) as $headerLine) {
61
-                    if ($headerLine === '') {
60
+                foreach ( explode( "\n", $translated ) as $headerLine ) {
61
+                    if ( $headerLine === '' ) {
62 62
                         continue;
63 63
                     }
64 64
 
65
-                    $headerChunks = preg_split('/:\s*/', $headerLine, 2);
66
-                    $translations->setHeader($headerChunks[0], isset($headerChunks[1]) ? $headerChunks[1] : '');
65
+                    $headerChunks = preg_split( '/:\s*/', $headerLine, 2 );
66
+                    $translations->setHeader( $headerChunks[ 0 ], isset( $headerChunks[ 1 ] ) ? $headerChunks[ 1 ] : '' );
67 67
                 }
68 68
 
69 69
                 continue;
70 70
             }
71 71
 
72
-            $chunks = explode("\x04", $original, 2);
72
+            $chunks = explode( "\x04", $original, 2 );
73 73
 
74
-            if (isset($chunks[1])) {
75
-                $context = $chunks[0];
76
-                $original = $chunks[1];
74
+            if ( isset( $chunks[ 1 ] ) ) {
75
+                $context = $chunks[ 0 ];
76
+                $original = $chunks[ 1 ];
77 77
             } else {
78 78
                 $context = '';
79 79
             }
80 80
 
81
-            $chunks = explode("\x00", $original, 2);
81
+            $chunks = explode( "\x00", $original, 2 );
82 82
 
83
-            if (isset($chunks[1])) {
84
-                $original = $chunks[0];
85
-                $plural = $chunks[1];
83
+            if ( isset( $chunks[ 1 ] ) ) {
84
+                $original = $chunks[ 0 ];
85
+                $plural = $chunks[ 1 ];
86 86
             } else {
87 87
                 $plural = '';
88 88
             }
89 89
 
90
-            $translation = $translations->insert($context, $original, $plural);
90
+            $translation = $translations->insert( $context, $original, $plural );
91 91
 
92
-            if ($translated === '') {
92
+            if ( $translated === '' ) {
93 93
                 continue;
94 94
             }
95 95
 
96
-            if ($plural === '') {
97
-                $translation->setTranslation($translated);
96
+            if ( $plural === '' ) {
97
+                $translation->setTranslation( $translated );
98 98
                 continue;
99 99
             }
100 100
 
101
-            $v = explode("\x00", $translated);
102
-            $translation->setTranslation(array_shift($v));
103
-            $translation->setPluralTranslations($v);
101
+            $v = explode( "\x00", $translated );
102
+            $translation->setTranslation( array_shift( $v ) );
103
+            $translation->setPluralTranslations( $v );
104 104
         }
105 105
     }
106 106
 
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
      * @param StringReader $stream
109 109
      * @param string       $byteOrder
110 110
      */
111
-    protected static function readInt(StringReader $stream, $byteOrder)
111
+    protected static function readInt( StringReader $stream, $byteOrder )
112 112
     {
113
-        if (($read = $stream->read(4)) === false) {
113
+        if ( ( $read = $stream->read( 4 ) ) === false ) {
114 114
             return false;
115 115
         }
116 116
 
117
-        $read = unpack($byteOrder, $read);
117
+        $read = unpack( $byteOrder, $read );
118 118
 
119
-        return array_shift($read);
119
+        return array_shift( $read );
120 120
     }
121 121
 
122 122
     /**
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
      * @param string       $byteOrder
125 125
      * @param int          $count
126 126
      */
127
-    protected static function readIntArray(StringReader $stream, $byteOrder, $count)
127
+    protected static function readIntArray( StringReader $stream, $byteOrder, $count )
128 128
     {
129
-        return unpack($byteOrder.$count, $stream->read(4 * $count));
129
+        return unpack( $byteOrder . $count, $stream->read( 4 * $count ) );
130 130
     }
131 131
 }
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/Jed.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
     /**
13 13
      * {@inheritdoc}
14 14
      */
15
-    public static function fromString($string, Translations $translations, array $options = [])
15
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
16 16
     {
17
-        static::extract(json_decode($string, true), $translations);
17
+        static::extract( json_decode( $string, true ), $translations );
18 18
     }
19 19
 
20 20
     /**
@@ -23,33 +23,33 @@  discard block
 block discarded – undo
23 23
      * @param array        $content
24 24
      * @param Translations $translations
25 25
      */
26
-    public static function extract(array $content, Translations $translations)
26
+    public static function extract( array $content, Translations $translations )
27 27
     {
28
-        $messages = current($content);
29
-        $headers = isset($messages['']) ? $messages[''] : null;
30
-        unset($messages['']);
28
+        $messages = current( $content );
29
+        $headers = isset( $messages[ '' ] ) ? $messages[ '' ] : null;
30
+        unset( $messages[ '' ] );
31 31
 
32
-        if (!empty($headers['domain'])) {
33
-            $translations->setDomain($headers['domain']);
32
+        if ( ! empty( $headers[ 'domain' ] ) ) {
33
+            $translations->setDomain( $headers[ 'domain' ] );
34 34
         }
35 35
 
36
-        if (!empty($headers['lang'])) {
37
-            $translations->setLanguage($headers['lang']);
36
+        if ( ! empty( $headers[ 'lang' ] ) ) {
37
+            $translations->setLanguage( $headers[ 'lang' ] );
38 38
         }
39 39
 
40
-        if (!empty($headers['plural-forms'])) {
41
-            $translations->setHeader(Translations::HEADER_PLURAL, $headers['plural-forms']);
40
+        if ( ! empty( $headers[ 'plural-forms' ] ) ) {
41
+            $translations->setHeader( Translations::HEADER_PLURAL, $headers[ 'plural-forms' ] );
42 42
         }
43 43
 
44 44
         $context_glue = '\u0004';
45 45
 
46
-        foreach ($messages as $key => $translation) {
47
-            $key = explode($context_glue, $key);
48
-            $context = isset($key[1]) ? array_shift($key) : '';
46
+        foreach ( $messages as $key => $translation ) {
47
+            $key = explode( $context_glue, $key );
48
+            $context = isset( $key[ 1 ] ) ? array_shift( $key ) : '';
49 49
 
50
-            $translations->insert($context, array_shift($key))
51
-                ->setTranslation(array_shift($translation))
52
-                ->setPluralTranslations($translation);
50
+            $translations->insert( $context, array_shift( $key ) )
51
+                ->setTranslation( array_shift( $translation ) )
52
+                ->setPluralTranslations( $translation );
53 53
         }
54 54
     }
55 55
 }
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/Po.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -18,135 +18,135 @@  discard block
 block discarded – undo
18 18
      *
19 19
      * {@inheritdoc}
20 20
      */
21
-    public static function fromString($string, Translations $translations, array $options = [])
21
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
22 22
     {
23
-        $lines = explode("\n", $string);
23
+        $lines = explode( "\n", $string );
24 24
         $i = 0;
25 25
 
26
-        $translation = $translations->createNewTranslation('', '');
26
+        $translation = $translations->createNewTranslation( '', '' );
27 27
 
28
-        for ($n = count($lines); $i < $n; ++$i) {
29
-            $line = trim($lines[$i]);
30
-            $line = static::fixMultiLines($line, $lines, $i);
28
+        for ( $n = count( $lines ); $i < $n; ++$i ) {
29
+            $line = trim( $lines[ $i ] );
30
+            $line = static::fixMultiLines( $line, $lines, $i );
31 31
 
32
-            if ($line === '') {
33
-                if ($translation->is('', '')) {
34
-                    static::extractHeaders($translation->getTranslation(), $translations);
35
-                } elseif ($translation->hasOriginal()) {
36
-                    $translations[] = $translation;
32
+            if ( $line === '' ) {
33
+                if ( $translation->is( '', '' ) ) {
34
+                    static::extractHeaders( $translation->getTranslation(), $translations );
35
+                } elseif ( $translation->hasOriginal() ) {
36
+                    $translations[ ] = $translation;
37 37
                 }
38 38
 
39
-                $translation = $translations->createNewTranslation('', '');
39
+                $translation = $translations->createNewTranslation( '', '' );
40 40
                 continue;
41 41
             }
42 42
 
43
-            $splitLine = preg_split('/\s+/', $line, 2);
44
-            $key = $splitLine[0];
45
-            $data = isset($splitLine[1]) ? $splitLine[1] : '';
43
+            $splitLine = preg_split( '/\s+/', $line, 2 );
44
+            $key = $splitLine[ 0 ];
45
+            $data = isset( $splitLine[ 1 ] ) ? $splitLine[ 1 ] : '';
46 46
 
47
-            if ($key === '#~') {
48
-                $translation->setDisabled(true);
47
+            if ( $key === '#~' ) {
48
+                $translation->setDisabled( true );
49 49
 
50
-                $splitLine = preg_split('/\s+/', $data, 2);
51
-                $key = $splitLine[0];
52
-                $data = isset($splitLine[1]) ? $splitLine[1] : '';
50
+                $splitLine = preg_split( '/\s+/', $data, 2 );
51
+                $key = $splitLine[ 0 ];
52
+                $data = isset( $splitLine[ 1 ] ) ? $splitLine[ 1 ] : '';
53 53
             }
54 54
 
55
-            switch ($key) {
55
+            switch ( $key ) {
56 56
                 case '#':
57
-                    $translation->addComment($data);
57
+                    $translation->addComment( $data );
58 58
                     $append = null;
59 59
                     break;
60 60
 
61 61
                 case '#.':
62
-                    $translation->addExtractedComment($data);
62
+                    $translation->addExtractedComment( $data );
63 63
                     $append = null;
64 64
                     break;
65 65
 
66 66
                 case '#,':
67
-                    foreach (array_map('trim', explode(',', trim($data))) as $value) {
68
-                        $translation->addFlag($value);
67
+                    foreach ( array_map( 'trim', explode( ',', trim( $data ) ) ) as $value ) {
68
+                        $translation->addFlag( $value );
69 69
                     }
70 70
                     $append = null;
71 71
                     break;
72 72
 
73 73
                 case '#:':
74
-                    foreach (preg_split('/\s+/', trim($data)) as $value) {
75
-                        if (preg_match('/^(.+)(:(\d*))?$/U', $value, $matches)) {
76
-                            $translation->addReference($matches[1], isset($matches[3]) ? $matches[3] : null);
74
+                    foreach ( preg_split( '/\s+/', trim( $data ) ) as $value ) {
75
+                        if ( preg_match( '/^(.+)(:(\d*))?$/U', $value, $matches ) ) {
76
+                            $translation->addReference( $matches[ 1 ], isset( $matches[ 3 ] ) ? $matches[ 3 ] : null );
77 77
                         }
78 78
                     }
79 79
                     $append = null;
80 80
                     break;
81 81
 
82 82
                 case 'msgctxt':
83
-                    $translation = $translation->getClone(static::convertString($data));
83
+                    $translation = $translation->getClone( static::convertString( $data ) );
84 84
                     $append = 'Context';
85 85
                     break;
86 86
 
87 87
                 case 'msgid':
88
-                    $translation = $translation->getClone(null, static::convertString($data));
88
+                    $translation = $translation->getClone( null, static::convertString( $data ) );
89 89
                     $append = 'Original';
90 90
                     break;
91 91
 
92 92
                 case 'msgid_plural':
93
-                    $translation->setPlural(static::convertString($data));
93
+                    $translation->setPlural( static::convertString( $data ) );
94 94
                     $append = 'Plural';
95 95
                     break;
96 96
 
97 97
                 case 'msgstr':
98 98
                 case 'msgstr[0]':
99
-                    $translation->setTranslation(static::convertString($data));
99
+                    $translation->setTranslation( static::convertString( $data ) );
100 100
                     $append = 'Translation';
101 101
                     break;
102 102
 
103 103
                 case 'msgstr[1]':
104
-                    $translation->setPluralTranslations([static::convertString($data)]);
104
+                    $translation->setPluralTranslations( [ static::convertString( $data ) ] );
105 105
                     $append = 'PluralTranslation';
106 106
                     break;
107 107
 
108 108
                 default:
109
-                    if (strpos($key, 'msgstr[') === 0) {
109
+                    if ( strpos( $key, 'msgstr[' ) === 0 ) {
110 110
                         $p = $translation->getPluralTranslations();
111
-                        $p[] = static::convertString($data);
111
+                        $p[ ] = static::convertString( $data );
112 112
 
113
-                        $translation->setPluralTranslations($p);
113
+                        $translation->setPluralTranslations( $p );
114 114
                         $append = 'PluralTranslation';
115 115
                         break;
116 116
                     }
117 117
 
118
-                    if (isset($append)) {
119
-                        if ($append === 'Context') {
120
-                            $translation = $translation->getClone($translation->getContext()
118
+                    if ( isset( $append ) ) {
119
+                        if ( $append === 'Context' ) {
120
+                            $translation = $translation->getClone( $translation->getContext()
121 121
                                 ."\n"
122
-                                .static::convertString($data));
122
+                                .static::convertString( $data ) );
123 123
                             break;
124 124
                         }
125 125
 
126
-                        if ($append === 'Original') {
127
-                            $translation = $translation->getClone(null, $translation->getOriginal()
126
+                        if ( $append === 'Original' ) {
127
+                            $translation = $translation->getClone( null, $translation->getOriginal()
128 128
                                 ."\n"
129
-                                .static::convertString($data));
129
+                                .static::convertString( $data ) );
130 130
                             break;
131 131
                         }
132 132
 
133
-                        if ($append === 'PluralTranslation') {
133
+                        if ( $append === 'PluralTranslation' ) {
134 134
                             $p = $translation->getPluralTranslations();
135
-                            $p[] = array_pop($p)."\n".static::convertString($data);
136
-                            $translation->setPluralTranslations($p);
135
+                            $p[ ] = array_pop( $p ) . "\n" . static::convertString( $data );
136
+                            $translation->setPluralTranslations( $p );
137 137
                             break;
138 138
                         }
139 139
 
140
-                        $getMethod = 'get'.$append;
141
-                        $setMethod = 'set'.$append;
142
-                        $translation->$setMethod($translation->$getMethod()."\n".static::convertString($data));
140
+                        $getMethod = 'get' . $append;
141
+                        $setMethod = 'set' . $append;
142
+                        $translation->$setMethod( $translation->$getMethod() . "\n" . static::convertString( $data ) );
143 143
                     }
144 144
                     break;
145 145
             }
146 146
         }
147 147
 
148
-        if ($translation->hasOriginal() && !in_array($translation, iterator_to_array($translations))) {
149
-            $translations[] = $translation;
148
+        if ( $translation->hasOriginal() && ! in_array( $translation, iterator_to_array( $translations ) ) ) {
149
+            $translations[ ] = $translation;
150 150
         }
151 151
     }
152 152
 
@@ -159,17 +159,17 @@  discard block
 block discarded – undo
159 159
      *
160 160
      * @return string
161 161
      */
162
-    protected static function fixMultiLines($line, array $lines, &$i)
162
+    protected static function fixMultiLines( $line, array $lines, &$i )
163 163
     {
164
-        for ($j = $i, $t = count($lines); $j < $t; ++$j) {
165
-            if (substr($line, -1, 1) == '"' && isset($lines[$j + 1])) {
166
-                $nextLine = trim($lines[$j + 1]);
167
-                if (substr($nextLine, 0, 1) == '"') {
168
-                    $line = substr($line, 0, -1).substr($nextLine, 1);
164
+        for ( $j = $i, $t = count( $lines ); $j < $t; ++$j ) {
165
+            if ( substr( $line, -1, 1 ) == '"' && isset( $lines[ $j + 1 ] ) ) {
166
+                $nextLine = trim( $lines[ $j + 1 ] );
167
+                if ( substr( $nextLine, 0, 1 ) == '"' ) {
168
+                    $line = substr( $line, 0, -1 ) . substr( $nextLine, 1 );
169 169
                     continue;
170 170
                 }
171
-                if (substr($nextLine, 0, 4) == '#~ "') {
172
-                    $line = substr($line, 0, -1).substr($nextLine, 4);
171
+                if ( substr( $nextLine, 0, 4 ) == '#~ "' ) {
172
+                    $line = substr( $line, 0, -1 ) . substr( $nextLine, 4 );
173 173
                     continue;
174 174
                 }
175 175
             }
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
      *
188 188
      * @return string
189 189
      */
190
-    public static function convertString($value)
190
+    public static function convertString( $value )
191 191
     {
192
-        if (!$value) {
192
+        if ( ! $value ) {
193 193
             return '';
194 194
         }
195 195
 
196
-        if ($value[0] === '"') {
197
-            $value = substr($value, 1, -1);
196
+        if ( $value[ 0 ] === '"' ) {
197
+            $value = substr( $value, 1, -1 );
198 198
         }
199 199
 
200 200
         return strtr(
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/VueJs.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 class VueJs extends Extractor implements ExtractorInterface, ExtractorMultiInterface
18 18
 {
19 19
     public static $options = [
20
-        'constants' => [],
20
+        'constants' => [ ],
21 21
 
22 22
         'functions' => [
23 23
             'gettext' => 'gettext',
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
      * @inheritDoc
48 48
      * @throws Exception
49 49
      */
50
-    public static function fromFileMultiple($file, array $translations, array $options = [])
50
+    public static function fromFileMultiple( $file, array $translations, array $options = [ ] )
51 51
     {
52
-        foreach (static::getFiles($file) as $file) {
53
-            $options['file'] = $file;
54
-            static::fromStringMultiple(static::readFile($file), $translations, $options);
52
+        foreach ( static::getFiles( $file ) as $file ) {
53
+            $options[ 'file' ] = $file;
54
+            static::fromStringMultiple( static::readFile( $file ), $translations, $options );
55 55
         }
56 56
     }
57 57
 
@@ -59,16 +59,16 @@  discard block
 block discarded – undo
59 59
      * @inheritdoc
60 60
      * @throws Exception
61 61
      */
62
-    public static function fromString($string, Translations $translations, array $options = [])
62
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
63 63
     {
64
-        static::fromStringMultiple($string, [$translations], $options);
64
+        static::fromStringMultiple( $string, [ $translations ], $options );
65 65
     }
66 66
 
67 67
     /**
68 68
      * @inheritDoc
69 69
      * @throws Exception
70 70
      */
71
-    public static function fromStringMultiple($string, array $translations, array $options = [])
71
+    public static function fromStringMultiple( $string, array $translations, array $options = [ ] )
72 72
     {
73 73
         $options += static::$options;
74 74
         $options += [
@@ -105,20 +105,20 @@  discard block
 block discarded – undo
105 105
         // So if there are new lines between <template> and next element, they are lost
106 106
         // So we insert a "." which is a text node, and it will prevent that newlines are stripped between elements.
107 107
         // Same thing happens between template and script tag.
108
-        $string = str_replace('<template>', '<template>.', $string);
109
-        $string = str_replace('</template>', '</template>.', $string);
108
+        $string = str_replace( '<template>', '<template>.', $string );
109
+        $string = str_replace( '</template>', '</template>.', $string );
110 110
 
111 111
         // Normalize newlines
112
-        $string = str_replace(["\r\n", "\n\r", "\r"], "\n", $string);
112
+        $string = str_replace( [ "\r\n", "\n\r", "\r" ], "\n", $string );
113 113
 
114 114
         // VueJS files are valid HTML files, we will operate with the DOM here
115
-        $dom = static::convertHtmlToDom($string);
115
+        $dom = static::convertHtmlToDom( $string );
116 116
 
117
-        $script = static::extractScriptTag($string);
117
+        $script = static::extractScriptTag( $string );
118 118
 
119 119
         // Parse the script part as a regular JS code
120
-        if ($script) {
121
-            $scriptLineNumber = $dom->getElementsByTagName('script')->item(0)->getLineNo();
120
+        if ( $script ) {
121
+            $scriptLineNumber = $dom->getElementsByTagName( 'script' )->item( 0 )->getLineNo();
122 122
             static::getScriptTranslationsFromString(
123 123
                 $script,
124 124
                 $translations,
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 
130 130
         // Template part is parsed separately, all variables will be extracted
131 131
         // and handled as a regular JS code
132
-        $template = $dom->getElementsByTagName('template')->item(0);
133
-        if ($template) {
132
+        $template = $dom->getElementsByTagName( 'template' )->item( 0 );
133
+        if ( $template ) {
134 134
             static::getTemplateTranslations(
135 135
                 $template,
136 136
                 $translations,
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
      * @param $string
148 148
      * @return bool|string
149 149
      */
150
-    protected static function extractScriptTag($string)
150
+    protected static function extractScriptTag( $string )
151 151
     {
152
-        if (preg_match('#<\s*?script\b[^>]*>(.*?)</script\b[^>]*>#s', $string, $matches)) {
153
-            return $matches[1];
152
+        if ( preg_match( '#<\s*?script\b[^>]*>(.*?)</script\b[^>]*>#s', $string, $matches ) ) {
153
+            return $matches[ 1 ];
154 154
         }
155 155
 
156 156
         return '';
@@ -160,15 +160,15 @@  discard block
 block discarded – undo
160 160
      * @param string $html
161 161
      * @return DOMDocument
162 162
      */
163
-    protected static function convertHtmlToDom($html)
163
+    protected static function convertHtmlToDom( $html )
164 164
     {
165 165
         $dom = new DOMDocument;
166 166
 
167
-        libxml_use_internal_errors(true);
167
+        libxml_use_internal_errors( true );
168 168
 
169 169
         // Prepend xml encoding so DOMDocument document handles UTF8 correctly.
170 170
         // Assuming that vue template files will not have any xml encoding tags, because duplicate tags may be ignored.
171
-        $dom->loadHTML('<?xml encoding="utf-8"?>' . $html);
171
+        $dom->loadHTML( '<?xml encoding="utf-8"?>' . $html );
172 172
 
173 173
         libxml_clear_errors();
174 174
 
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
     protected static function getScriptTranslationsFromString(
188 188
         $scriptContents,
189 189
         $translations,
190
-        array $options = [],
190
+        array $options = [ ],
191 191
         $lineOffset = 0
192 192
     ) {
193 193
         /** @var FunctionsScanner $functions */
194
-        $functions = new static::$functionsScannerClass($scriptContents);
195
-        $options['lineOffset'] = $lineOffset;
196
-        $functions->saveGettextFunctions($translations, $options);
194
+        $functions = new static::$functionsScannerClass( $scriptContents );
195
+        $options[ 'lineOffset' ] = $lineOffset;
196
+        $functions->saveGettextFunctions( $translations, $options );
197 197
     }
198 198
 
199 199
     /**
@@ -212,16 +212,16 @@  discard block
 block discarded – undo
212 212
         $lineOffset = 0
213 213
     ) {
214 214
         // Build a JS string from all template attribute expressions
215
-        $fakeAttributeJs = static::getTemplateAttributeFakeJs($options, $dom);
215
+        $fakeAttributeJs = static::getTemplateAttributeFakeJs( $options, $dom );
216 216
 
217 217
         // 1 line offset is necessary because parent template element was ignored when converting to DOM
218
-        static::getScriptTranslationsFromString($fakeAttributeJs, $translations, $options, $lineOffset);
218
+        static::getScriptTranslationsFromString( $fakeAttributeJs, $translations, $options, $lineOffset );
219 219
 
220 220
         // Build a JS string from template element content expressions
221
-        $fakeTemplateJs = static::getTemplateFakeJs($dom);
222
-        static::getScriptTranslationsFromString($fakeTemplateJs, $translations, $options, $lineOffset);
221
+        $fakeTemplateJs = static::getTemplateFakeJs( $dom );
222
+        static::getScriptTranslationsFromString( $fakeTemplateJs, $translations, $options, $lineOffset );
223 223
 
224
-        static::getTagTranslations($options, $dom, $translations);
224
+        static::getTagTranslations( $options, $dom, $translations );
225 225
     }
226 226
 
227 227
     /**
@@ -229,22 +229,22 @@  discard block
 block discarded – undo
229 229
      * @param DOMNode $dom
230 230
      * @param Translations|Translations[] $translations
231 231
      */
232
-    protected static function getTagTranslations(array $options, DOMNode $dom, $translations)
232
+    protected static function getTagTranslations( array $options, DOMNode $dom, $translations )
233 233
     {
234 234
         // Since tag scanning does not support domains, we always use the first translation given
235
-        $translations = is_array($translations) ? reset($translations) : $translations;
235
+        $translations = is_array( $translations ) ? reset( $translations ) : $translations;
236 236
 
237 237
         $children = $dom->childNodes;
238
-        for ($i = 0; $i < $children->length; $i++) {
239
-            $node = $children->item($i);
238
+        for ( $i = 0; $i < $children->length; $i++ ) {
239
+            $node = $children->item( $i );
240 240
 
241
-            if (!($node instanceof DOMElement)) {
241
+            if ( ! ( $node instanceof DOMElement ) ) {
242 242
                 continue;
243 243
             }
244 244
 
245 245
             $translatable = false;
246 246
 
247
-            if (in_array($node->tagName, $options['tagNames'], true)) {
247
+            if ( in_array( $node->tagName, $options[ 'tagNames' ], true ) ) {
248 248
                 $translatable = true;
249 249
             }
250 250
 
@@ -253,34 +253,34 @@  discard block
 block discarded – undo
253 253
             $plural = "";
254 254
             $comment = null;
255 255
 
256
-            for ($j = 0; $j < $attrList->length; $j++) {
256
+            for ( $j = 0; $j < $attrList->length; $j++ ) {
257 257
                 /** @var DOMAttr $domAttr */
258
-                $domAttr = $attrList->item($j);
258
+                $domAttr = $attrList->item( $j );
259 259
                 // Check if this is a dynamic vue attribute
260
-                if (in_array($domAttr->name, $options['tagAttributes'])) {
260
+                if ( in_array( $domAttr->name, $options[ 'tagAttributes' ] ) ) {
261 261
                     $translatable = true;
262 262
                 }
263
-                if (in_array($domAttr->name, $options['contextAttributes'])) {
263
+                if ( in_array( $domAttr->name, $options[ 'contextAttributes' ] ) ) {
264 264
                     $context = $domAttr->value;
265 265
                 }
266
-                if (in_array($domAttr->name, $options['pluralAttributes'])) {
266
+                if ( in_array( $domAttr->name, $options[ 'pluralAttributes' ] ) ) {
267 267
                     $plural = $domAttr->value;
268 268
                 }
269
-                if (in_array($domAttr->name, $options['commentAttributes'])) {
269
+                if ( in_array( $domAttr->name, $options[ 'commentAttributes' ] ) ) {
270 270
                     $comment = $domAttr->value;
271 271
                 }
272 272
             }
273 273
 
274
-            if ($translatable) {
275
-                $translation = $translations->insert($context, trim($node->textContent), $plural);
276
-                $translation->addReference($options['file'], $node->getLineNo());
277
-                if ($comment) {
278
-                    $translation->addExtractedComment($comment);
274
+            if ( $translatable ) {
275
+                $translation = $translations->insert( $context, trim( $node->textContent ), $plural );
276
+                $translation->addReference( $options[ 'file' ], $node->getLineNo() );
277
+                if ( $comment ) {
278
+                    $translation->addExtractedComment( $comment );
279 279
                 }
280 280
             }
281 281
 
282
-            if ($node->hasChildNodes()) {
283
-                static::getTagTranslations($options, $node, $translations);
282
+            if ( $node->hasChildNodes() ) {
283
+                static::getTagTranslations( $options, $node, $translations );
284 284
             }
285 285
         }
286 286
     }
@@ -293,20 +293,20 @@  discard block
 block discarded – undo
293 293
      * @param DOMNode $dom
294 294
      * @return string JS code
295 295
      */
296
-    protected static function getTemplateAttributeFakeJs(array $options, DOMNode $dom)
296
+    protected static function getTemplateAttributeFakeJs( array $options, DOMNode $dom )
297 297
     {
298
-        $expressionsByLine = static::getVueAttributeExpressions($options['attributePrefixes'], $dom);
298
+        $expressionsByLine = static::getVueAttributeExpressions( $options[ 'attributePrefixes' ], $dom );
299 299
 
300
-        if (empty($expressionsByLine)) {
300
+        if ( empty( $expressionsByLine ) ) {
301 301
             return '';
302 302
         }
303 303
 
304
-        $maxLines = max(array_keys($expressionsByLine));
304
+        $maxLines = max( array_keys( $expressionsByLine ) );
305 305
         $fakeJs = '';
306 306
 
307
-        for ($line = 1; $line <= $maxLines; $line++) {
308
-            if (isset($expressionsByLine[$line])) {
309
-                $fakeJs .= implode("; ", $expressionsByLine[$line]);
307
+        for ( $line = 1; $line <= $maxLines; $line++ ) {
308
+            if ( isset( $expressionsByLine[ $line ] ) ) {
309
+                $fakeJs .= implode( "; ", $expressionsByLine[ $line ] );
310 310
             }
311 311
             $fakeJs .= "\n";
312 312
         }
@@ -325,32 +325,32 @@  discard block
 block discarded – undo
325 325
     protected static function getVueAttributeExpressions(
326 326
         array $attributePrefixes,
327 327
         DOMNode $dom,
328
-        array &$expressionByLine = []
328
+        array &$expressionByLine = [ ]
329 329
     ) {
330 330
         $children = $dom->childNodes;
331 331
 
332
-        for ($i = 0; $i < $children->length; $i++) {
333
-            $node = $children->item($i);
332
+        for ( $i = 0; $i < $children->length; $i++ ) {
333
+            $node = $children->item( $i );
334 334
 
335
-            if (!($node instanceof DOMElement)) {
335
+            if ( ! ( $node instanceof DOMElement ) ) {
336 336
                 continue;
337 337
             }
338 338
             $attrList = $node->attributes;
339 339
 
340
-            for ($j = 0; $j < $attrList->length; $j++) {
340
+            for ( $j = 0; $j < $attrList->length; $j++ ) {
341 341
                 /** @var DOMAttr $domAttr */
342
-                $domAttr = $attrList->item($j);
342
+                $domAttr = $attrList->item( $j );
343 343
 
344 344
                 // Check if this is a dynamic vue attribute
345
-                if (static::isAttributeMatching($domAttr->name, $attributePrefixes)) {
345
+                if ( static::isAttributeMatching( $domAttr->name, $attributePrefixes ) ) {
346 346
                     $line = $domAttr->getLineNo();
347
-                    $expressionByLine += [$line => []];
348
-                    $expressionByLine[$line][] = $domAttr->value;
347
+                    $expressionByLine += [ $line => [ ] ];
348
+                    $expressionByLine[ $line ][ ] = $domAttr->value;
349 349
                 }
350 350
             }
351 351
 
352
-            if ($node->hasChildNodes()) {
353
-                $expressionByLine = static::getVueAttributeExpressions($attributePrefixes, $node, $expressionByLine);
352
+            if ( $node->hasChildNodes() ) {
353
+                $expressionByLine = static::getVueAttributeExpressions( $attributePrefixes, $node, $expressionByLine );
354 354
             }
355 355
         }
356 356
 
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
      * @param string[] $attributePrefixes
365 365
      * @return bool
366 366
      */
367
-    protected static function isAttributeMatching($attributeName, $attributePrefixes)
367
+    protected static function isAttributeMatching( $attributeName, $attributePrefixes )
368 368
     {
369
-        foreach ($attributePrefixes as $prefix) {
370
-            if (strpos($attributeName, $prefix) === 0) {
369
+        foreach ( $attributePrefixes as $prefix ) {
370
+            if ( strpos( $attributeName, $prefix ) === 0 ) {
371 371
                 return true;
372 372
             }
373 373
         }
@@ -381,16 +381,16 @@  discard block
 block discarded – undo
381 381
      * @param DOMNode $dom
382 382
      * @return string JS code
383 383
      */
384
-    protected static function getTemplateFakeJs(DOMNode $dom)
384
+    protected static function getTemplateFakeJs( DOMNode $dom )
385 385
     {
386 386
         $fakeJs = '';
387
-        $lines = explode("\n", $dom->textContent);
387
+        $lines = explode( "\n", $dom->textContent );
388 388
 
389 389
         // Build a fake JS file from template by extracting JS expressions within each template line
390
-        foreach ($lines as $line) {
391
-            $expressionMatched = static::parseOneTemplateLine($line);
390
+        foreach ( $lines as $line ) {
391
+            $expressionMatched = static::parseOneTemplateLine( $line );
392 392
 
393
-            $fakeJs .= implode("; ", $expressionMatched) . "\n";
393
+            $fakeJs .= implode( "; ", $expressionMatched ) . "\n";
394 394
         }
395 395
 
396 396
         return $fakeJs;
@@ -402,21 +402,21 @@  discard block
 block discarded – undo
402 402
      * @param string $line
403 403
      * @return string[]
404 404
      */
405
-    protected static function parseOneTemplateLine($line)
405
+    protected static function parseOneTemplateLine( $line )
406 406
     {
407
-        $line = trim($line);
407
+        $line = trim( $line );
408 408
 
409
-        if (!$line) {
410
-            return [];
409
+        if ( ! $line ) {
410
+            return [ ];
411 411
         }
412 412
 
413 413
         $regex = '#\{\{(.*?)\}\}#';
414 414
 
415
-        preg_match_all($regex, $line, $matches);
415
+        preg_match_all( $regex, $line, $matches );
416 416
 
417
-        $matched = array_map(function ($v) {
418
-            return trim($v, '\'"{}');
419
-        }, $matches[1]);
417
+        $matched = array_map( function( $v ) {
418
+            return trim( $v, '\'"{}' );
419
+        }, $matches[ 1 ] );
420 420
 
421 421
         return $matched;
422 422
     }
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/Extractor.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
     /**
12 12
      * {@inheritdoc}
13 13
      */
14
-    public static function fromFile($file, Translations $translations, array $options = [])
14
+    public static function fromFile( $file, Translations $translations, array $options = [ ] )
15 15
     {
16
-        foreach (static::getFiles($file) as $file) {
17
-            $options['file'] = $file;
18
-            static::fromString(static::readFile($file), $translations, $options);
16
+        foreach ( static::getFiles( $file ) as $file ) {
17
+            $options[ 'file' ] = $file;
18
+            static::fromString( static::readFile( $file ), $translations, $options );
19 19
         }
20 20
     }
21 21
 
@@ -26,35 +26,35 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @return array The file paths
28 28
      */
29
-    protected static function getFiles($file)
29
+    protected static function getFiles( $file )
30 30
     {
31
-        if (empty($file)) {
32
-            throw new InvalidArgumentException('There is not any file defined');
31
+        if ( empty( $file ) ) {
32
+            throw new InvalidArgumentException( 'There is not any file defined' );
33 33
         }
34 34
 
35
-        if (is_string($file)) {
36
-            if (!is_file($file)) {
37
-                throw new InvalidArgumentException("'$file' is not a valid file");
35
+        if ( is_string( $file ) ) {
36
+            if ( ! is_file( $file ) ) {
37
+                throw new InvalidArgumentException( "'$file' is not a valid file" );
38 38
             }
39 39
 
40
-            if (!is_readable($file)) {
41
-                throw new InvalidArgumentException("'$file' is not a readable file");
40
+            if ( ! is_readable( $file ) ) {
41
+                throw new InvalidArgumentException( "'$file' is not a readable file" );
42 42
             }
43 43
 
44
-            return [$file];
44
+            return [ $file ];
45 45
         }
46 46
 
47
-        if (is_array($file)) {
48
-            $files = [];
47
+        if ( is_array( $file ) ) {
48
+            $files = [ ];
49 49
 
50
-            foreach ($file as $f) {
51
-                $files = array_merge($files, static::getFiles($f));
50
+            foreach ( $file as $f ) {
51
+                $files = array_merge( $files, static::getFiles( $f ) );
52 52
             }
53 53
 
54 54
             return $files;
55 55
         }
56 56
 
57
-        throw new InvalidArgumentException('The first argument must be string or array');
57
+        throw new InvalidArgumentException( 'The first argument must be string or array' );
58 58
     }
59 59
 
60 60
     /**
@@ -64,16 +64,16 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @return string
66 66
      */
67
-    protected static function readFile($file)
67
+    protected static function readFile( $file )
68 68
     {
69
-        $length = filesize($file);
69
+        $length = filesize( $file );
70 70
 
71
-        if (!($fd = fopen($file, 'rb'))) {
72
-            throw new Exception("Cannot read the file '$file', probably permissions");
71
+        if ( ! ( $fd = fopen( $file, 'rb' ) ) ) {
72
+            throw new Exception( "Cannot read the file '$file', probably permissions" );
73 73
         }
74 74
 
75
-        $content = $length ? fread($fd, $length) : '';
76
-        fclose($fd);
75
+        $content = $length ? fread( $fd, $length ) : '';
76
+        fclose( $fd );
77 77
 
78 78
         return $content;
79 79
     }
Please login to merge, or discard this patch.