Completed
Pull Request — develop (#1810)
by Zack
20:16
created
vendor/gettext/gettext/src/Extractors/CsvDictionary.php 3 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -11,37 +11,37 @@
 block discarded – undo
11 11
  */
12 12
 class CsvDictionary extends Extractor implements ExtractorInterface
13 13
 {
14
-    use HeadersExtractorTrait;
15
-    use CsvTrait;
16
-
17
-    public static $options = [
18
-        'delimiter' => ",",
19
-        'enclosure' => '"',
20
-        'escape_char' => "\\"
21
-    ];
22
-
23
-    /**
24
-     * {@inheritdoc}
25
-     */
26
-    public static function fromString($string, Translations $translations, array $options = [])
27
-    {
28
-        $options += static::$options;
29
-        $handle = fopen('php://memory', 'w');
30
-
31
-        fputs($handle, $string);
32
-        rewind($handle);
33
-
34
-        while ($row = static::fgetcsv($handle, $options)) {
35
-            list($original, $translation) = $row + ['', ''];
36
-
37
-            if ($original === '') {
38
-                static::extractHeaders($translation, $translations);
39
-                continue;
40
-            }
41
-
42
-            $translations->insert(null, $original)->setTranslation($translation);
43
-        }
44
-
45
-        fclose($handle);
46
-    }
14
+	use HeadersExtractorTrait;
15
+	use CsvTrait;
16
+
17
+	public static $options = [
18
+		'delimiter' => ",",
19
+		'enclosure' => '"',
20
+		'escape_char' => "\\"
21
+	];
22
+
23
+	/**
24
+	 * {@inheritdoc}
25
+	 */
26
+	public static function fromString($string, Translations $translations, array $options = [])
27
+	{
28
+		$options += static::$options;
29
+		$handle = fopen('php://memory', 'w');
30
+
31
+		fputs($handle, $string);
32
+		rewind($handle);
33
+
34
+		while ($row = static::fgetcsv($handle, $options)) {
35
+			list($original, $translation) = $row + ['', ''];
36
+
37
+			if ($original === '') {
38
+				static::extractHeaders($translation, $translations);
39
+				continue;
40
+			}
41
+
42
+			$translations->insert(null, $original)->setTranslation($translation);
43
+		}
44
+
45
+		fclose($handle);
46
+	}
47 47
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,25 +23,25 @@
 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
-            list($original, $translation) = $row + ['', ''];
34
+        while ( $row = static::fgetcsv( $handle, $options ) ) {
35
+            list( $original, $translation ) = $row + [ '', '' ];
36 36
 
37
-            if ($original === '') {
38
-                static::extractHeaders($translation, $translations);
37
+            if ( $original === '' ) {
38
+                static::extractHeaders( $translation, $translations );
39 39
                 continue;
40 40
             }
41 41
 
42
-            $translations->insert(null, $original)->setTranslation($translation);
42
+            $translations->insert( null, $original )->setTranslation( $translation );
43 43
         }
44 44
 
45
-        fclose($handle);
45
+        fclose( $handle );
46 46
     }
47 47
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@  discard block
 block discarded – undo
9 9
 /**
10 10
  * Class to get gettext strings from csv.
11 11
  */
12
-class CsvDictionary extends Extractor implements ExtractorInterface
13
-{
12
+class CsvDictionary extends Extractor implements ExtractorInterface {
14 13
     use HeadersExtractorTrait;
15 14
     use CsvTrait;
16 15
 
@@ -23,8 +22,7 @@  discard block
 block discarded – undo
23 22
     /**
24 23
      * {@inheritdoc}
25 24
      */
26
-    public static function fromString($string, Translations $translations, array $options = [])
27
-    {
25
+    public static function fromString($string, Translations $translations, array $options = []) {
28 26
         $options += static::$options;
29 27
         $handle = fopen('php://memory', 'w');
30 28
 
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/JsCode.php 3 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -11,64 +11,64 @@
 block discarded – undo
11 11
  */
12 12
 class JsCode extends Extractor implements ExtractorInterface, ExtractorMultiInterface
13 13
 {
14
-    public static $options = [
15
-        'constants' => [],
14
+	public static $options = [
15
+		'constants' => [],
16 16
 
17
-        'functions' => [
18
-            'gettext' => 'gettext',
19
-            '__' => 'gettext',
20
-            'ngettext' => 'ngettext',
21
-            'n__' => 'ngettext',
22
-            'pgettext' => 'pgettext',
23
-            'p__' => 'pgettext',
24
-            'dgettext' => 'dgettext',
25
-            'd__' => 'dgettext',
26
-            'dngettext' => 'dngettext',
27
-            'dn__' => 'dngettext',
28
-            'dpgettext' => 'dpgettext',
29
-            'dp__' => 'dpgettext',
30
-            'npgettext' => 'npgettext',
31
-            'np__' => 'npgettext',
32
-            'dnpgettext' => 'dnpgettext',
33
-            'dnp__' => 'dnpgettext',
34
-            'noop' => 'noop',
35
-            'noop__' => 'noop',
36
-        ],
37
-    ];
17
+		'functions' => [
18
+			'gettext' => 'gettext',
19
+			'__' => 'gettext',
20
+			'ngettext' => 'ngettext',
21
+			'n__' => 'ngettext',
22
+			'pgettext' => 'pgettext',
23
+			'p__' => 'pgettext',
24
+			'dgettext' => 'dgettext',
25
+			'd__' => 'dgettext',
26
+			'dngettext' => 'dngettext',
27
+			'dn__' => 'dngettext',
28
+			'dpgettext' => 'dpgettext',
29
+			'dp__' => 'dpgettext',
30
+			'npgettext' => 'npgettext',
31
+			'np__' => 'npgettext',
32
+			'dnpgettext' => 'dnpgettext',
33
+			'dnp__' => 'dnpgettext',
34
+			'noop' => 'noop',
35
+			'noop__' => 'noop',
36
+		],
37
+	];
38 38
 
39
-    protected static $functionsScannerClass = 'Gettext\Utils\JsFunctionsScanner';
39
+	protected static $functionsScannerClass = 'Gettext\Utils\JsFunctionsScanner';
40 40
 
41
-    /**
42
-     * @inheritdoc
43
-     * @throws Exception
44
-     */
45
-    public static function fromString($string, Translations $translations, array $options = [])
46
-    {
47
-        static::fromStringMultiple($string, [$translations], $options);
48
-    }
41
+	/**
42
+	 * @inheritdoc
43
+	 * @throws Exception
44
+	 */
45
+	public static function fromString($string, Translations $translations, array $options = [])
46
+	{
47
+		static::fromStringMultiple($string, [$translations], $options);
48
+	}
49 49
 
50
-    /**
51
-     * @inheritDoc
52
-     * @throws Exception
53
-     */
54
-    public static function fromStringMultiple($string, array $translations, array $options = [])
55
-    {
56
-        $options += static::$options;
50
+	/**
51
+	 * @inheritDoc
52
+	 * @throws Exception
53
+	 */
54
+	public static function fromStringMultiple($string, array $translations, array $options = [])
55
+	{
56
+		$options += static::$options;
57 57
 
58
-        /** @var FunctionsScanner $functions */
59
-        $functions = new static::$functionsScannerClass($string);
60
-        $functions->saveGettextFunctions($translations, $options);
61
-    }
58
+		/** @var FunctionsScanner $functions */
59
+		$functions = new static::$functionsScannerClass($string);
60
+		$functions->saveGettextFunctions($translations, $options);
61
+	}
62 62
 
63
-    /**
64
-     * @inheritDoc
65
-     * @throws Exception
66
-     */
67
-    public static function fromFileMultiple($file, array $translations, array $options = [])
68
-    {
69
-        foreach (static::getFiles($file) as $file) {
70
-            $options['file'] = $file;
71
-            static::fromStringMultiple(static::readFile($file), $translations, $options);
72
-        }
73
-    }
63
+	/**
64
+	 * @inheritDoc
65
+	 * @throws Exception
66
+	 */
67
+	public static function fromFileMultiple($file, array $translations, array $options = [])
68
+	{
69
+		foreach (static::getFiles($file) as $file) {
70
+			$options['file'] = $file;
71
+			static::fromStringMultiple(static::readFile($file), $translations, $options);
72
+		}
73
+	}
74 74
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 class JsCode extends Extractor implements ExtractorInterface, ExtractorMultiInterface
13 13
 {
14 14
     public static $options = [
15
-        'constants' => [],
15
+        'constants' => [ ],
16 16
 
17 17
         'functions' => [
18 18
             'gettext' => 'gettext',
@@ -42,33 +42,33 @@  discard block
 block discarded – undo
42 42
      * @inheritdoc
43 43
      * @throws Exception
44 44
      */
45
-    public static function fromString($string, Translations $translations, array $options = [])
45
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
46 46
     {
47
-        static::fromStringMultiple($string, [$translations], $options);
47
+        static::fromStringMultiple( $string, [ $translations ], $options );
48 48
     }
49 49
 
50 50
     /**
51 51
      * @inheritDoc
52 52
      * @throws Exception
53 53
      */
54
-    public static function fromStringMultiple($string, array $translations, array $options = [])
54
+    public static function fromStringMultiple( $string, array $translations, array $options = [ ] )
55 55
     {
56 56
         $options += static::$options;
57 57
 
58 58
         /** @var FunctionsScanner $functions */
59
-        $functions = new static::$functionsScannerClass($string);
60
-        $functions->saveGettextFunctions($translations, $options);
59
+        $functions = new static::$functionsScannerClass( $string );
60
+        $functions->saveGettextFunctions( $translations, $options );
61 61
     }
62 62
 
63 63
     /**
64 64
      * @inheritDoc
65 65
      * @throws Exception
66 66
      */
67
-    public static function fromFileMultiple($file, array $translations, array $options = [])
67
+    public static function fromFileMultiple( $file, array $translations, array $options = [ ] )
68 68
     {
69
-        foreach (static::getFiles($file) as $file) {
70
-            $options['file'] = $file;
71
-            static::fromStringMultiple(static::readFile($file), $translations, $options);
69
+        foreach ( static::getFiles( $file ) as $file ) {
70
+            $options[ 'file' ] = $file;
71
+            static::fromStringMultiple( static::readFile( $file ), $translations, $options );
72 72
         }
73 73
     }
74 74
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,8 +42,7 @@  discard block
 block discarded – undo
42 42
      * @inheritdoc
43 43
      * @throws Exception
44 44
      */
45
-    public static function fromString($string, Translations $translations, array $options = [])
46
-    {
45
+    public static function fromString($string, Translations $translations, array $options = []) {
47 46
         static::fromStringMultiple($string, [$translations], $options);
48 47
     }
49 48
 
@@ -51,8 +50,7 @@  discard block
 block discarded – undo
51 50
      * @inheritDoc
52 51
      * @throws Exception
53 52
      */
54
-    public static function fromStringMultiple($string, array $translations, array $options = [])
55
-    {
53
+    public static function fromStringMultiple($string, array $translations, array $options = []) {
56 54
         $options += static::$options;
57 55
 
58 56
         /** @var FunctionsScanner $functions */
@@ -64,8 +62,7 @@  discard block
 block discarded – undo
64 62
      * @inheritDoc
65 63
      * @throws Exception
66 64
      */
67
-    public static function fromFileMultiple($file, array $translations, array $options = [])
68
-    {
65
+    public static function fromFileMultiple($file, array $translations, array $options = []) {
69 66
         foreach (static::getFiles($file) as $file) {
70 67
             $options['file'] = $file;
71 68
             static::fromStringMultiple(static::readFile($file), $translations, $options);
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/Xliff.php 3 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -12,75 +12,75 @@
 block discarded – undo
12 12
 class Xliff extends Extractor implements ExtractorInterface
13 13
 {
14 14
 
15
-    public static $options = [
16
-        'unitid_as_id' => false
17
-    ];
18
-
19
-    /**
20
-     * {@inheritdoc}
21
-     */
22
-    public static function fromString($string, Translations $translations, array $options = [])
23
-    {
24
-        $options += static::$options;
25
-
26
-        $xml = new SimpleXMLElement($string, null, false);
27
-
28
-        foreach ($xml->file as $file) {
29
-            if (isset($file->notes)) {
30
-                foreach ($file->notes->note as $note) {
31
-                    $translations->setHeader($note['id'], (string) $note);
32
-                }
33
-            }
34
-
35
-            foreach ($file->unit as $unit) {
36
-                foreach ($unit->segment as $segment) {
37
-                    $targets = [];
38
-
39
-                    foreach ($segment->target as $target) {
40
-                        $targets[] = (string) $target;
41
-                    }
42
-
43
-                    $translation = $translations->createNewTranslation(null, (string) $segment->source);
44
-                    if (isset($unit['id'])) {
45
-                        $unitId = (string) $unit['id'];
46
-                        $translation->addComment("XLIFF_UNIT_ID: $unitId");
47
-                        if ($options['unitid_as_id']) {
48
-                            $translation->setId($unitId);
49
-                        }
50
-                    }
51
-                    $translation->setTranslation(array_shift($targets));
52
-                    $translation->setPluralTranslations($targets);
53
-
54
-                    if (isset($unit->notes)) {
55
-                        foreach ($unit->notes->note as $note) {
56
-                            switch ($note['category']) {
57
-                                case 'context':
58
-                                    $translation = $translation->getClone((string) $note);
59
-                                    break;
60
-
61
-                                case 'extracted-comment':
62
-                                    $translation->addExtractedComment((string) $note);
63
-                                    break;
64
-
65
-                                case 'flag':
66
-                                    $translation->addFlag((string) $note);
67
-                                    break;
68
-
69
-                                case 'reference':
70
-                                    $ref = explode(':', (string) $note, 2);
71
-                                    $translation->addReference($ref[0], isset($ref[1]) ? $ref[1] : null);
72
-                                    break;
73
-
74
-                                default:
75
-                                    $translation->addComment((string) $note);
76
-                                    break;
77
-                            }
78
-                        }
79
-                    }
80
-
81
-                    $translations[] = $translation;
82
-                }
83
-            }
84
-        }
85
-    }
15
+	public static $options = [
16
+		'unitid_as_id' => false
17
+	];
18
+
19
+	/**
20
+	 * {@inheritdoc}
21
+	 */
22
+	public static function fromString($string, Translations $translations, array $options = [])
23
+	{
24
+		$options += static::$options;
25
+
26
+		$xml = new SimpleXMLElement($string, null, false);
27
+
28
+		foreach ($xml->file as $file) {
29
+			if (isset($file->notes)) {
30
+				foreach ($file->notes->note as $note) {
31
+					$translations->setHeader($note['id'], (string) $note);
32
+				}
33
+			}
34
+
35
+			foreach ($file->unit as $unit) {
36
+				foreach ($unit->segment as $segment) {
37
+					$targets = [];
38
+
39
+					foreach ($segment->target as $target) {
40
+						$targets[] = (string) $target;
41
+					}
42
+
43
+					$translation = $translations->createNewTranslation(null, (string) $segment->source);
44
+					if (isset($unit['id'])) {
45
+						$unitId = (string) $unit['id'];
46
+						$translation->addComment("XLIFF_UNIT_ID: $unitId");
47
+						if ($options['unitid_as_id']) {
48
+							$translation->setId($unitId);
49
+						}
50
+					}
51
+					$translation->setTranslation(array_shift($targets));
52
+					$translation->setPluralTranslations($targets);
53
+
54
+					if (isset($unit->notes)) {
55
+						foreach ($unit->notes->note as $note) {
56
+							switch ($note['category']) {
57
+								case 'context':
58
+									$translation = $translation->getClone((string) $note);
59
+									break;
60
+
61
+								case 'extracted-comment':
62
+									$translation->addExtractedComment((string) $note);
63
+									break;
64
+
65
+								case 'flag':
66
+									$translation->addFlag((string) $note);
67
+									break;
68
+
69
+								case 'reference':
70
+									$ref = explode(':', (string) $note, 2);
71
+									$translation->addReference($ref[0], isset($ref[1]) ? $ref[1] : null);
72
+									break;
73
+
74
+								default:
75
+									$translation->addComment((string) $note);
76
+									break;
77
+							}
78
+						}
79
+					}
80
+
81
+					$translations[] = $translation;
82
+				}
83
+			}
84
+		}
85
+	}
86 86
 }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -19,66 +19,66 @@
 block discarded – undo
19 19
     /**
20 20
      * {@inheritdoc}
21 21
      */
22
-    public static function fromString($string, Translations $translations, array $options = [])
22
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
23 23
     {
24 24
         $options += static::$options;
25 25
 
26
-        $xml = new SimpleXMLElement($string, null, false);
26
+        $xml = new SimpleXMLElement( $string, null, false );
27 27
 
28
-        foreach ($xml->file as $file) {
29
-            if (isset($file->notes)) {
30
-                foreach ($file->notes->note as $note) {
31
-                    $translations->setHeader($note['id'], (string) $note);
28
+        foreach ( $xml->file as $file ) {
29
+            if ( isset( $file->notes ) ) {
30
+                foreach ( $file->notes->note as $note ) {
31
+                    $translations->setHeader( $note[ 'id' ], (string)$note );
32 32
                 }
33 33
             }
34 34
 
35
-            foreach ($file->unit as $unit) {
36
-                foreach ($unit->segment as $segment) {
37
-                    $targets = [];
35
+            foreach ( $file->unit as $unit ) {
36
+                foreach ( $unit->segment as $segment ) {
37
+                    $targets = [ ];
38 38
 
39
-                    foreach ($segment->target as $target) {
40
-                        $targets[] = (string) $target;
39
+                    foreach ( $segment->target as $target ) {
40
+                        $targets[ ] = (string)$target;
41 41
                     }
42 42
 
43
-                    $translation = $translations->createNewTranslation(null, (string) $segment->source);
44
-                    if (isset($unit['id'])) {
45
-                        $unitId = (string) $unit['id'];
46
-                        $translation->addComment("XLIFF_UNIT_ID: $unitId");
47
-                        if ($options['unitid_as_id']) {
48
-                            $translation->setId($unitId);
43
+                    $translation = $translations->createNewTranslation( null, (string)$segment->source );
44
+                    if ( isset( $unit[ 'id' ] ) ) {
45
+                        $unitId = (string)$unit[ 'id' ];
46
+                        $translation->addComment( "XLIFF_UNIT_ID: $unitId" );
47
+                        if ( $options[ 'unitid_as_id' ] ) {
48
+                            $translation->setId( $unitId );
49 49
                         }
50 50
                     }
51
-                    $translation->setTranslation(array_shift($targets));
52
-                    $translation->setPluralTranslations($targets);
51
+                    $translation->setTranslation( array_shift( $targets ) );
52
+                    $translation->setPluralTranslations( $targets );
53 53
 
54
-                    if (isset($unit->notes)) {
55
-                        foreach ($unit->notes->note as $note) {
56
-                            switch ($note['category']) {
54
+                    if ( isset( $unit->notes ) ) {
55
+                        foreach ( $unit->notes->note as $note ) {
56
+                            switch ( $note[ 'category' ] ) {
57 57
                                 case 'context':
58
-                                    $translation = $translation->getClone((string) $note);
58
+                                    $translation = $translation->getClone( (string)$note );
59 59
                                     break;
60 60
 
61 61
                                 case 'extracted-comment':
62
-                                    $translation->addExtractedComment((string) $note);
62
+                                    $translation->addExtractedComment( (string)$note );
63 63
                                     break;
64 64
 
65 65
                                 case 'flag':
66
-                                    $translation->addFlag((string) $note);
66
+                                    $translation->addFlag( (string)$note );
67 67
                                     break;
68 68
 
69 69
                                 case 'reference':
70
-                                    $ref = explode(':', (string) $note, 2);
71
-                                    $translation->addReference($ref[0], isset($ref[1]) ? $ref[1] : null);
70
+                                    $ref = explode( ':', (string)$note, 2 );
71
+                                    $translation->addReference( $ref[ 0 ], isset( $ref[ 1 ] ) ? $ref[ 1 ] : null );
72 72
                                     break;
73 73
 
74 74
                                 default:
75
-                                    $translation->addComment((string) $note);
75
+                                    $translation->addComment( (string)$note );
76 76
                                     break;
77 77
                             }
78 78
                         }
79 79
                     }
80 80
 
81
-                    $translations[] = $translation;
81
+                    $translations[ ] = $translation;
82 82
                 }
83 83
             }
84 84
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@  discard block
 block discarded – undo
9 9
 /**
10 10
  * Class to get gettext strings from xliff format.
11 11
  */
12
-class Xliff extends Extractor implements ExtractorInterface
13
-{
12
+class Xliff extends Extractor implements ExtractorInterface {
14 13
 
15 14
     public static $options = [
16 15
         'unitid_as_id' => false
@@ -19,8 +18,7 @@  discard block
 block discarded – undo
19 18
     /**
20 19
      * {@inheritdoc}
21 20
      */
22
-    public static function fromString($string, Translations $translations, array $options = [])
23
-    {
21
+    public static function fromString($string, Translations $translations, array $options = []) {
24 22
         $options += static::$options;
25 23
 
26 24
         $xml = new SimpleXMLElement($string, null, false);
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/YamlDictionary.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@
 block discarded – undo
11 11
  */
12 12
 class YamlDictionary extends Extractor implements ExtractorInterface
13 13
 {
14
-    use DictionaryTrait;
14
+	use DictionaryTrait;
15 15
 
16
-    /**
17
-     * {@inheritdoc}
18
-     */
19
-    public static function fromString($string, Translations $translations, array $options = [])
20
-    {
21
-        $messages = YamlParser::parse($string);
16
+	/**
17
+	 * {@inheritdoc}
18
+	 */
19
+	public static function fromString($string, Translations $translations, array $options = [])
20
+	{
21
+		$messages = YamlParser::parse($string);
22 22
 
23
-        if (is_array($messages)) {
24
-            static::fromArray($messages, $translations);
25
-        }
26
-    }
23
+		if (is_array($messages)) {
24
+			static::fromArray($messages, $translations);
25
+		}
26
+	}
27 27
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@
 block discarded – undo
16 16
     /**
17 17
      * {@inheritdoc}
18 18
      */
19
-    public static function fromString($string, Translations $translations, array $options = [])
19
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
20 20
     {
21
-        $messages = YamlParser::parse($string);
21
+        $messages = YamlParser::parse( $string );
22 22
 
23
-        if (is_array($messages)) {
24
-            static::fromArray($messages, $translations);
23
+        if ( is_array( $messages ) ) {
24
+            static::fromArray( $messages, $translations );
25 25
         }
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,15 +9,13 @@
 block discarded – undo
9 9
 /**
10 10
  * Class to get gettext strings from yaml.
11 11
  */
12
-class YamlDictionary extends Extractor implements ExtractorInterface
13
-{
12
+class YamlDictionary extends Extractor implements ExtractorInterface {
14 13
     use DictionaryTrait;
15 14
 
16 15
     /**
17 16
      * {@inheritdoc}
18 17
      */
19
-    public static function fromString($string, Translations $translations, array $options = [])
20
-    {
18
+    public static function fromString($string, Translations $translations, array $options = []) {
21 19
         $messages = YamlParser::parse($string);
22 20
 
23 21
         if (is_array($messages)) {
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/Twig.php 3 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -13,33 +13,33 @@
 block discarded – undo
13 13
  */
14 14
 class Twig extends Extractor implements ExtractorInterface
15 15
 {
16
-    public static $options = [
17
-        'extractComments' => 'notes:',
18
-        'twig' => null,
19
-    ];
20
-
21
-    /**
22
-     * {@inheritdoc}
23
-     */
24
-    public static function fromString($string, Translations $translations, array $options = [])
25
-    {
26
-        $options += static::$options;
27
-
28
-        $twig = $options['twig'] ?: static::createTwig();
29
-
30
-        PhpCode::fromString($twig->compileSource(new Twig_Source($string, '')), $translations, $options);
31
-    }
32
-
33
-    /**
34
-     * Returns a Twig instance.
35
-     *
36
-     * @return Twig_Environment
37
-     */
38
-    protected static function createTwig()
39
-    {
40
-        $twig = new Twig_Environment(new Twig_Loader_Array(['' => '']));
41
-        $twig->addExtension(new Twig_Extensions_Extension_I18n());
42
-
43
-        return static::$options['twig'] = $twig;
44
-    }
16
+	public static $options = [
17
+		'extractComments' => 'notes:',
18
+		'twig' => null,
19
+	];
20
+
21
+	/**
22
+	 * {@inheritdoc}
23
+	 */
24
+	public static function fromString($string, Translations $translations, array $options = [])
25
+	{
26
+		$options += static::$options;
27
+
28
+		$twig = $options['twig'] ?: static::createTwig();
29
+
30
+		PhpCode::fromString($twig->compileSource(new Twig_Source($string, '')), $translations, $options);
31
+	}
32
+
33
+	/**
34
+	 * Returns a Twig instance.
35
+	 *
36
+	 * @return Twig_Environment
37
+	 */
38
+	protected static function createTwig()
39
+	{
40
+		$twig = new Twig_Environment(new Twig_Loader_Array(['' => '']));
41
+		$twig->addExtension(new Twig_Extensions_Extension_I18n());
42
+
43
+		return static::$options['twig'] = $twig;
44
+	}
45 45
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * {@inheritdoc}
23 23
      */
24
-    public static function fromString($string, Translations $translations, array $options = [])
24
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
25 25
     {
26 26
         $options += static::$options;
27 27
 
28
-        $twig = $options['twig'] ?: static::createTwig();
28
+        $twig = $options[ 'twig' ] ?: static::createTwig();
29 29
 
30
-        PhpCode::fromString($twig->compileSource(new Twig_Source($string, '')), $translations, $options);
30
+        PhpCode::fromString( $twig->compileSource( new Twig_Source( $string, '' ) ), $translations, $options );
31 31
     }
32 32
 
33 33
     /**
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
      */
38 38
     protected static function createTwig()
39 39
     {
40
-        $twig = new Twig_Environment(new Twig_Loader_Array(['' => '']));
41
-        $twig->addExtension(new Twig_Extensions_Extension_I18n());
40
+        $twig = new Twig_Environment( new Twig_Loader_Array( [ '' => '' ] ) );
41
+        $twig->addExtension( new Twig_Extensions_Extension_I18n() );
42 42
 
43
-        return static::$options['twig'] = $twig;
43
+        return static::$options[ 'twig' ] = $twig;
44 44
     }
45 45
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@  discard block
 block discarded – undo
11 11
 /**
12 12
  * Class to get gettext strings from twig files returning arrays.
13 13
  */
14
-class Twig extends Extractor implements ExtractorInterface
15
-{
14
+class Twig extends Extractor implements ExtractorInterface {
16 15
     public static $options = [
17 16
         'extractComments' => 'notes:',
18 17
         'twig' => null,
@@ -21,8 +20,7 @@  discard block
 block discarded – undo
21 20
     /**
22 21
      * {@inheritdoc}
23 22
      */
24
-    public static function fromString($string, Translations $translations, array $options = [])
25
-    {
23
+    public static function fromString($string, Translations $translations, array $options = []) {
26 24
         $options += static::$options;
27 25
 
28 26
         $twig = $options['twig'] ?: static::createTwig();
@@ -35,8 +33,7 @@  discard block
 block discarded – undo
35 33
      *
36 34
      * @return Twig_Environment
37 35
      */
38
-    protected static function createTwig()
39
-    {
36
+    protected static function createTwig() {
40 37
         $twig = new Twig_Environment(new Twig_Loader_Array(['' => '']));
41 38
         $twig->addExtension(new Twig_Extensions_Extension_I18n());
42 39
 
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/Blade.php 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -11,24 +11,24 @@
 block discarded – undo
11 11
  */
12 12
 class Blade extends Extractor implements ExtractorInterface
13 13
 {
14
-    /**
15
-     * {@inheritdoc}
16
-     */
17
-    public static function fromString($string, Translations $translations, array $options = [])
18
-    {
19
-        if (empty($options['facade'])) {
20
-            $cachePath = empty($options['cachePath']) ? sys_get_temp_dir() : $options['cachePath'];
21
-            $bladeCompiler = new BladeCompiler(new Filesystem(), $cachePath);
14
+	/**
15
+	 * {@inheritdoc}
16
+	 */
17
+	public static function fromString($string, Translations $translations, array $options = [])
18
+	{
19
+		if (empty($options['facade'])) {
20
+			$cachePath = empty($options['cachePath']) ? sys_get_temp_dir() : $options['cachePath'];
21
+			$bladeCompiler = new BladeCompiler(new Filesystem(), $cachePath);
22 22
 
23
-            if (method_exists($bladeCompiler, 'withoutComponentTags')) {
24
-                $bladeCompiler->withoutComponentTags();
25
-            }
23
+			if (method_exists($bladeCompiler, 'withoutComponentTags')) {
24
+				$bladeCompiler->withoutComponentTags();
25
+			}
26 26
 
27
-            $string = $bladeCompiler->compileString($string);
28
-        } else {
29
-            $string = $options['facade']::compileString($string);
30
-        }
27
+			$string = $bladeCompiler->compileString($string);
28
+		} else {
29
+			$string = $options['facade']::compileString($string);
30
+		}
31 31
 
32
-        PhpCode::fromString($string, $translations, $options);
33
-    }
32
+		PhpCode::fromString($string, $translations, $options);
33
+	}
34 34
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@
 block discarded – undo
14 14
     /**
15 15
      * {@inheritdoc}
16 16
      */
17
-    public static function fromString($string, Translations $translations, array $options = [])
17
+    public static function fromString( $string, Translations $translations, array $options = [ ] )
18 18
     {
19
-        if (empty($options['facade'])) {
20
-            $cachePath = empty($options['cachePath']) ? sys_get_temp_dir() : $options['cachePath'];
21
-            $bladeCompiler = new BladeCompiler(new Filesystem(), $cachePath);
19
+        if ( empty( $options[ 'facade' ] ) ) {
20
+            $cachePath = empty( $options[ 'cachePath' ] ) ? sys_get_temp_dir() : $options[ 'cachePath' ];
21
+            $bladeCompiler = new BladeCompiler( new Filesystem(), $cachePath );
22 22
 
23
-            if (method_exists($bladeCompiler, 'withoutComponentTags')) {
23
+            if ( method_exists( $bladeCompiler, 'withoutComponentTags' ) ) {
24 24
                 $bladeCompiler->withoutComponentTags();
25 25
             }
26 26
 
27
-            $string = $bladeCompiler->compileString($string);
27
+            $string = $bladeCompiler->compileString( $string );
28 28
         } else {
29
-            $string = $options['facade']::compileString($string);
29
+            $string = $options[ 'facade' ]::compileString( $string );
30 30
         }
31 31
 
32
-        PhpCode::fromString($string, $translations, $options);
32
+        PhpCode::fromString( $string, $translations, $options );
33 33
     }
34 34
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,13 +9,11 @@
 block discarded – undo
9 9
 /**
10 10
  * Class to get gettext strings from blade.php files returning arrays.
11 11
  */
12
-class Blade extends Extractor implements ExtractorInterface
13
-{
12
+class Blade extends Extractor implements ExtractorInterface {
14 13
     /**
15 14
      * {@inheritdoc}
16 15
      */
17
-    public static function fromString($string, Translations $translations, array $options = [])
18
-    {
16
+    public static function fromString($string, Translations $translations, array $options = []) {
19 17
         if (empty($options['facade'])) {
20 18
             $cachePath = empty($options['cachePath']) ? sys_get_temp_dir() : $options['cachePath'];
21 19
             $bladeCompiler = new BladeCompiler(new Filesystem(), $cachePath);
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/ExtractorInterface.php 3 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,21 +6,21 @@
 block discarded – undo
6 6
 
7 7
 interface ExtractorInterface
8 8
 {
9
-    /**
10
-     * Extract the translations from a file.
11
-     *
12
-     * @param array|string $file         A path of a file or files
13
-     * @param Translations $translations The translations instance to append the new translations.
14
-     * @param array        $options
15
-     */
16
-    public static function fromFile($file, Translations $translations, array $options = []);
9
+	/**
10
+	 * Extract the translations from a file.
11
+	 *
12
+	 * @param array|string $file         A path of a file or files
13
+	 * @param Translations $translations The translations instance to append the new translations.
14
+	 * @param array        $options
15
+	 */
16
+	public static function fromFile($file, Translations $translations, array $options = []);
17 17
 
18
-    /**
19
-     * Parses a string and append the translations found in the Translations instance.
20
-     *
21
-     * @param string       $string
22
-     * @param Translations $translations
23
-     * @param array        $options
24
-     */
25
-    public static function fromString($string, Translations $translations, array $options = []);
18
+	/**
19
+	 * Parses a string and append the translations found in the Translations instance.
20
+	 *
21
+	 * @param string       $string
22
+	 * @param Translations $translations
23
+	 * @param array        $options
24
+	 */
25
+	public static function fromString($string, Translations $translations, array $options = []);
26 26
 }
Please login to merge, or discard this 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.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@
 block discarded – undo
4 4
 
5 5
 use Gettext\Translations;
6 6
 
7
-interface ExtractorInterface
8
-{
7
+interface ExtractorInterface {
9 8
     /**
10 9
      * Extract the translations from a file.
11 10
      *
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/Csv.php 3 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -11,43 +11,43 @@
 block discarded – undo
11 11
  */
12 12
 class Csv extends Extractor implements ExtractorInterface
13 13
 {
14
-    use HeadersExtractorTrait;
15
-    use CsvTrait;
16
-
17
-    public static $options = [
18
-        'delimiter' => ",",
19
-        'enclosure' => '"',
20
-        'escape_char' => "\\"
21
-    ];
22
-
23
-    /**
24
-     * {@inheritdoc}
25
-     */
26
-    public static function fromString($string, Translations $translations, array $options = [])
27
-    {
28
-        $options += static::$options;
29
-        $handle = fopen('php://memory', 'w');
30
-
31
-        fputs($handle, $string);
32
-        rewind($handle);
33
-
34
-        while ($row = static::fgetcsv($handle, $options)) {
35
-            $context = array_shift($row);
36
-            $original = array_shift($row);
37
-
38
-            if ($context === '' && $original === '') {
39
-                static::extractHeaders(array_shift($row), $translations);
40
-                continue;
41
-            }
42
-
43
-            $translation = $translations->insert($context, $original);
44
-
45
-            if (!empty($row)) {
46
-                $translation->setTranslation(array_shift($row));
47
-                $translation->setPluralTranslations($row);
48
-            }
49
-        }
50
-
51
-        fclose($handle);
52
-    }
14
+	use HeadersExtractorTrait;
15
+	use CsvTrait;
16
+
17
+	public static $options = [
18
+		'delimiter' => ",",
19
+		'enclosure' => '"',
20
+		'escape_char' => "\\"
21
+	];
22
+
23
+	/**
24
+	 * {@inheritdoc}
25
+	 */
26
+	public static function fromString($string, Translations $translations, array $options = [])
27
+	{
28
+		$options += static::$options;
29
+		$handle = fopen('php://memory', 'w');
30
+
31
+		fputs($handle, $string);
32
+		rewind($handle);
33
+
34
+		while ($row = static::fgetcsv($handle, $options)) {
35
+			$context = array_shift($row);
36
+			$original = array_shift($row);
37
+
38
+			if ($context === '' && $original === '') {
39
+				static::extractHeaders(array_shift($row), $translations);
40
+				continue;
41
+			}
42
+
43
+			$translation = $translations->insert($context, $original);
44
+
45
+			if (!empty($row)) {
46
+				$translation->setTranslation(array_shift($row));
47
+				$translation->setPluralTranslations($row);
48
+			}
49
+		}
50
+
51
+		fclose($handle);
52
+	}
53 53
 }
Please login to merge, or discard this 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.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@  discard block
 block discarded – undo
9 9
 /**
10 10
  * Class to get gettext strings from csv.
11 11
  */
12
-class Csv extends Extractor implements ExtractorInterface
13
-{
12
+class Csv extends Extractor implements ExtractorInterface {
14 13
     use HeadersExtractorTrait;
15 14
     use CsvTrait;
16 15
 
@@ -23,8 +22,7 @@  discard block
 block discarded – undo
23 22
     /**
24 23
      * {@inheritdoc}
25 24
      */
26
-    public static function fromString($string, Translations $translations, array $options = [])
27
-    {
25
+    public static function fromString($string, Translations $translations, array $options = []) {
28 26
         $options += static::$options;
29 27
         $handle = fopen('php://memory', 'w');
30 28
 
Please login to merge, or discard this patch.
vendor/gettext/gettext/src/Extractors/PhpCode.php 3 patches
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -11,160 +11,160 @@
 block discarded – undo
11 11
  */
12 12
 class PhpCode extends Extractor implements ExtractorInterface, ExtractorMultiInterface
13 13
 {
14
-    public static $options = [
15
-        // - false: to not extract comments
16
-        // - empty string: to extract all comments
17
-        // - non-empty string: to extract comments that start with that string
18
-        // - array with strings to extract comments format.
19
-        'extractComments' => false,
20
-
21
-        'constants' => [],
22
-
23
-        'functions' => [
24
-            'gettext' => 'gettext',
25
-            '__' => 'gettext',
26
-            'ngettext' => 'ngettext',
27
-            'n__' => 'ngettext',
28
-            'pgettext' => 'pgettext',
29
-            'p__' => 'pgettext',
30
-            'dgettext' => 'dgettext',
31
-            'd__' => 'dgettext',
32
-            'dngettext' => 'dngettext',
33
-            'dn__' => 'dngettext',
34
-            'dpgettext' => 'dpgettext',
35
-            'dp__' => 'dpgettext',
36
-            'npgettext' => 'npgettext',
37
-            'np__' => 'npgettext',
38
-            'dnpgettext' => 'dnpgettext',
39
-            'dnp__' => 'dnpgettext',
40
-            'noop' => 'noop',
41
-            'noop__' => 'noop',
42
-        ],
43
-    ];
44
-
45
-    protected static $functionsScannerClass = 'Gettext\Utils\PhpFunctionsScanner';
46
-
47
-    /**
48
-     * {@inheritdoc}
49
-     * @throws Exception
50
-     */
51
-    public static function fromString($string, Translations $translations, array $options = [])
52
-    {
53
-        static::fromStringMultiple($string, [$translations], $options);
54
-    }
55
-
56
-    /**
57
-     * @inheritDoc
58
-     * @throws Exception
59
-     */
60
-    public static function fromStringMultiple($string, array $translations, array $options = [])
61
-    {
62
-        $options += static::$options;
63
-
64
-        /** @var FunctionsScanner $functions */
65
-        $functions = new static::$functionsScannerClass($string);
66
-
67
-        if ($options['extractComments'] !== false) {
68
-            $functions->enableCommentsExtraction($options['extractComments']);
69
-        }
70
-
71
-        $functions->saveGettextFunctions($translations, $options);
72
-    }
73
-
74
-    /**
75
-     * @inheritDoc
76
-     */
77
-    public static function fromFileMultiple($file, array $translations, array $options = [])
78
-    {
79
-        foreach (static::getFiles($file) as $file) {
80
-            $options['file'] = $file;
81
-            static::fromStringMultiple(static::readFile($file), $translations, $options);
82
-        }
83
-    }
84
-
85
-
86
-    /**
87
-     * Decodes a T_CONSTANT_ENCAPSED_STRING string.
88
-     *
89
-     * @param string $value
90
-     *
91
-     * @return string
92
-     */
93
-    public static function convertString($value)
94
-    {
95
-        if (strpos($value, '\\') === false) {
96
-            return substr($value, 1, -1);
97
-        }
98
-
99
-        if ($value[0] === "'") {
100
-            return strtr(substr($value, 1, -1), ['\\\\' => '\\', '\\\'' => '\'']);
101
-        }
102
-
103
-        $value = substr($value, 1, -1);
104
-
105
-        return preg_replace_callback(
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]) {
109
-                    case 'n':
110
-                        return "\n";
111
-                    case 'r':
112
-                        return "\r";
113
-                    case 't':
114
-                        return "\t";
115
-                    case 'v':
116
-                        return "\v";
117
-                    case 'e':
118
-                        return "\e";
119
-                    case 'f':
120
-                        return "\f";
121
-                    case '$':
122
-                        return '$';
123
-                    case '"':
124
-                        return '"';
125
-                    case '\\':
126
-                        return '\\';
127
-                    case 'x':
128
-                        return chr(hexdec(substr($match[1], 1)));
129
-                    case 'u':
130
-                        return static::unicodeChar(hexdec(substr($match[1], 1)));
131
-                    default:
132
-                        return chr(octdec($match[1]));
133
-                }
134
-            },
135
-            $value
136
-        );
137
-    }
138
-
139
-    /**
140
-     * @param $dec
141
-     * @return string|null
142
-     * @see http://php.net/manual/en/function.chr.php#118804
143
-     */
144
-    protected static function unicodeChar($dec)
145
-    {
146
-        if ($dec < 0x80) {
147
-            return chr($dec);
148
-        }
149
-
150
-        if ($dec < 0x0800) {
151
-            return chr(0xC0 + ($dec >> 6))
152
-                . chr(0x80 + ($dec & 0x3f));
153
-        }
154
-
155
-        if ($dec < 0x010000) {
156
-            return chr(0xE0 + ($dec >> 12))
157
-                . chr(0x80 + (($dec >> 6) & 0x3f))
158
-                . chr(0x80 + ($dec & 0x3f));
159
-        }
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));
166
-        }
167
-
168
-        return null;
169
-    }
14
+	public static $options = [
15
+		// - false: to not extract comments
16
+		// - empty string: to extract all comments
17
+		// - non-empty string: to extract comments that start with that string
18
+		// - array with strings to extract comments format.
19
+		'extractComments' => false,
20
+
21
+		'constants' => [],
22
+
23
+		'functions' => [
24
+			'gettext' => 'gettext',
25
+			'__' => 'gettext',
26
+			'ngettext' => 'ngettext',
27
+			'n__' => 'ngettext',
28
+			'pgettext' => 'pgettext',
29
+			'p__' => 'pgettext',
30
+			'dgettext' => 'dgettext',
31
+			'd__' => 'dgettext',
32
+			'dngettext' => 'dngettext',
33
+			'dn__' => 'dngettext',
34
+			'dpgettext' => 'dpgettext',
35
+			'dp__' => 'dpgettext',
36
+			'npgettext' => 'npgettext',
37
+			'np__' => 'npgettext',
38
+			'dnpgettext' => 'dnpgettext',
39
+			'dnp__' => 'dnpgettext',
40
+			'noop' => 'noop',
41
+			'noop__' => 'noop',
42
+		],
43
+	];
44
+
45
+	protected static $functionsScannerClass = 'Gettext\Utils\PhpFunctionsScanner';
46
+
47
+	/**
48
+	 * {@inheritdoc}
49
+	 * @throws Exception
50
+	 */
51
+	public static function fromString($string, Translations $translations, array $options = [])
52
+	{
53
+		static::fromStringMultiple($string, [$translations], $options);
54
+	}
55
+
56
+	/**
57
+	 * @inheritDoc
58
+	 * @throws Exception
59
+	 */
60
+	public static function fromStringMultiple($string, array $translations, array $options = [])
61
+	{
62
+		$options += static::$options;
63
+
64
+		/** @var FunctionsScanner $functions */
65
+		$functions = new static::$functionsScannerClass($string);
66
+
67
+		if ($options['extractComments'] !== false) {
68
+			$functions->enableCommentsExtraction($options['extractComments']);
69
+		}
70
+
71
+		$functions->saveGettextFunctions($translations, $options);
72
+	}
73
+
74
+	/**
75
+	 * @inheritDoc
76
+	 */
77
+	public static function fromFileMultiple($file, array $translations, array $options = [])
78
+	{
79
+		foreach (static::getFiles($file) as $file) {
80
+			$options['file'] = $file;
81
+			static::fromStringMultiple(static::readFile($file), $translations, $options);
82
+		}
83
+	}
84
+
85
+
86
+	/**
87
+	 * Decodes a T_CONSTANT_ENCAPSED_STRING string.
88
+	 *
89
+	 * @param string $value
90
+	 *
91
+	 * @return string
92
+	 */
93
+	public static function convertString($value)
94
+	{
95
+		if (strpos($value, '\\') === false) {
96
+			return substr($value, 1, -1);
97
+		}
98
+
99
+		if ($value[0] === "'") {
100
+			return strtr(substr($value, 1, -1), ['\\\\' => '\\', '\\\'' => '\'']);
101
+		}
102
+
103
+		$value = substr($value, 1, -1);
104
+
105
+		return preg_replace_callback(
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]) {
109
+					case 'n':
110
+						return "\n";
111
+					case 'r':
112
+						return "\r";
113
+					case 't':
114
+						return "\t";
115
+					case 'v':
116
+						return "\v";
117
+					case 'e':
118
+						return "\e";
119
+					case 'f':
120
+						return "\f";
121
+					case '$':
122
+						return '$';
123
+					case '"':
124
+						return '"';
125
+					case '\\':
126
+						return '\\';
127
+					case 'x':
128
+						return chr(hexdec(substr($match[1], 1)));
129
+					case 'u':
130
+						return static::unicodeChar(hexdec(substr($match[1], 1)));
131
+					default:
132
+						return chr(octdec($match[1]));
133
+				}
134
+			},
135
+			$value
136
+		);
137
+	}
138
+
139
+	/**
140
+	 * @param $dec
141
+	 * @return string|null
142
+	 * @see http://php.net/manual/en/function.chr.php#118804
143
+	 */
144
+	protected static function unicodeChar($dec)
145
+	{
146
+		if ($dec < 0x80) {
147
+			return chr($dec);
148
+		}
149
+
150
+		if ($dec < 0x0800) {
151
+			return chr(0xC0 + ($dec >> 6))
152
+				. chr(0x80 + ($dec & 0x3f));
153
+		}
154
+
155
+		if ($dec < 0x010000) {
156
+			return chr(0xE0 + ($dec >> 12))
157
+				. chr(0x80 + (($dec >> 6) & 0x3f))
158
+				. chr(0x80 + ($dec & 0x3f));
159
+		}
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));
166
+		}
167
+
168
+		return null;
169
+	}
170 170
 }
Please login to merge, or discard this 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.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
      * {@inheritdoc}
49 49
      * @throws Exception
50 50
      */
51
-    public static function fromString($string, Translations $translations, array $options = [])
52
-    {
51
+    public static function fromString($string, Translations $translations, array $options = []) {
53 52
         static::fromStringMultiple($string, [$translations], $options);
54 53
     }
55 54
 
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
      * @inheritDoc
58 57
      * @throws Exception
59 58
      */
60
-    public static function fromStringMultiple($string, array $translations, array $options = [])
61
-    {
59
+    public static function fromStringMultiple($string, array $translations, array $options = []) {
62 60
         $options += static::$options;
63 61
 
64 62
         /** @var FunctionsScanner $functions */
@@ -74,8 +72,7 @@  discard block
 block discarded – undo
74 72
     /**
75 73
      * @inheritDoc
76 74
      */
77
-    public static function fromFileMultiple($file, array $translations, array $options = [])
78
-    {
75
+    public static function fromFileMultiple($file, array $translations, array $options = []) {
79 76
         foreach (static::getFiles($file) as $file) {
80 77
             $options['file'] = $file;
81 78
             static::fromStringMultiple(static::readFile($file), $translations, $options);
@@ -90,8 +87,7 @@  discard block
 block discarded – undo
90 87
      *
91 88
      * @return string
92 89
      */
93
-    public static function convertString($value)
94
-    {
90
+    public static function convertString($value) {
95 91
         if (strpos($value, '\\') === false) {
96 92
             return substr($value, 1, -1);
97 93
         }
@@ -141,8 +137,7 @@  discard block
 block discarded – undo
141 137
      * @return string|null
142 138
      * @see http://php.net/manual/en/function.chr.php#118804
143 139
      */
144
-    protected static function unicodeChar($dec)
145
-    {
140
+    protected static function unicodeChar($dec) {
146 141
         if ($dec < 0x80) {
147 142
             return chr($dec);
148 143
         }
Please login to merge, or discard this patch.