Passed
Push — master ( d1c5ab...f07f8a )
by Kirill
03:58
created
src/Tokenizer/tests/InvocationsTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     protected function someFunction()
20 20
     {
21 21
         $result = $this->sampleMethod('hello world');
22
-        print_r(self::sampleMethod($result . 'plus'));
22
+        print_r(self::sampleMethod($result.'plus'));
23 23
     }
24 24
 
25 25
     public function testInstance()
Please login to merge, or discard this patch.
src/Tokenizer/tests/ReflectionFileTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@
 block discarded – undo
22 22
         $this->assertContains(TestTrait::class, $reflection->getTraits());
23 23
         $this->assertContains(TestInterface::class, $reflection->getInterfaces());
24 24
 
25
-        $this->assertSame([__NAMESPACE__ . '\hello'], $reflection->getFunctions());
25
+        $this->assertSame([__NAMESPACE__.'\hello'], $reflection->getFunctions());
26 26
 
27 27
         $functionA = null;
28 28
         $functionB = null;
29 29
 
30
-        foreach ($reflection->getInvocations() as $invocation) {
31
-            if ($invocation->getName() == 'test_function_a') {
30
+        foreach ($reflection->getInvocations() as $invocation){
31
+            if ($invocation->getName() == 'test_function_a'){
32 32
                 $functionA = $invocation;
33 33
             }
34 34
 
35
-            if ($invocation->getName() == 'test_function_b') {
35
+            if ($invocation->getName() == 'test_function_b'){
36 36
                 $functionB = $invocation;
37 37
             }
38 38
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,12 +27,15 @@
 block discarded – undo
27 27
         $functionA = null;
28 28
         $functionB = null;
29 29
 
30
-        foreach ($reflection->getInvocations() as $invocation) {
31
-            if ($invocation->getName() == 'test_function_a') {
30
+        foreach ($reflection->getInvocations() as $invocation)
31
+        {
32
+            if ($invocation->getName() == 'test_function_a')
33
+            {
32 34
                 $functionA = $invocation;
33 35
             }
34 36
 
35
-            if ($invocation->getName() == 'test_function_b') {
37
+            if ($invocation->getName() == 'test_function_b')
38
+            {
36 39
                 $functionB = $invocation;
37 40
             }
38 41
         }
Please login to merge, or discard this patch.
src/Translator/src/Catalogue.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function has(string $domain, string $id): bool
59 59
     {
60
-        if (!isset($this->data[$domain])) {
60
+        if (!isset($this->data[$domain])){
61 61
             return false;
62 62
         }
63 63
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function get(string $domain, string $string): string
71 71
     {
72
-        if (!$this->has($domain, $string)) {
72
+        if (!$this->has($domain, $string)){
73 73
             throw new CatalogueException("Undefined string in domain '{$domain}'");
74 74
         }
75 75
 
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function mergeFrom(MessageCatalogue $catalogue, bool $follow = true): void
101 101
     {
102
-        foreach ($catalogue->all() as $domain => $messages) {
103
-            if (!isset($this->data[$domain])) {
102
+        foreach ($catalogue->all() as $domain => $messages){
103
+            if (!isset($this->data[$domain])){
104 104
                 $this->data[$domain] = [];
105 105
             }
106 106
 
107
-            if ($follow) {
107
+            if ($follow){
108 108
                 //MessageCatalogue string has higher priority that string stored in memory
109 109
                 $this->data[$domain] = array_merge($messages, $this->data[$domain]);
110
-            } else {
110
+            }else{
111 111
                 $this->data[$domain] = array_merge($this->data[$domain], $messages);
112 112
             }
113 113
         }
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -57,7 +57,8 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function has(string $domain, string $id): bool
59 59
     {
60
-        if (!isset($this->data[$domain])) {
60
+        if (!isset($this->data[$domain]))
61
+        {
61 62
             return false;
62 63
         }
63 64
 
@@ -69,7 +70,8 @@  discard block
 block discarded – undo
69 70
      */
70 71
     public function get(string $domain, string $string): string
71 72
     {
72
-        if (!$this->has($domain, $string)) {
73
+        if (!$this->has($domain, $string))
74
+        {
73 75
             throw new CatalogueException("Undefined string in domain '{$domain}'");
74 76
         }
75 77
 
@@ -99,15 +101,20 @@  discard block
 block discarded – undo
99 101
      */
100 102
     public function mergeFrom(MessageCatalogue $catalogue, bool $follow = true): void
101 103
     {
102
-        foreach ($catalogue->all() as $domain => $messages) {
103
-            if (!isset($this->data[$domain])) {
104
+        foreach ($catalogue->all() as $domain => $messages)
105
+        {
106
+            if (!isset($this->data[$domain]))
107
+            {
104 108
                 $this->data[$domain] = [];
105 109
             }
106 110
 
107
-            if ($follow) {
111
+            if ($follow)
112
+            {
108 113
                 //MessageCatalogue string has higher priority that string stored in memory
109 114
                 $this->data[$domain] = array_merge($messages, $this->data[$domain]);
110
-            } else {
115
+            }
116
+            else
117
+            {
111 118
                 $this->data[$domain] = array_merge($this->data[$domain], $messages);
112 119
             }
113 120
         }
Please login to merge, or discard this patch.
src/Translator/src/Matcher.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@
 block discarded – undo
37 37
      */
38 38
     public function matches(string $string, string $pattern): bool
39 39
     {
40
-        if ($string === $pattern) {
40
+        if ($string === $pattern){
41 41
             return true;
42 42
         }
43
-        if (!$this->isPattern($pattern)) {
43
+        if (!$this->isPattern($pattern)){
44 44
             return false;
45 45
         }
46 46
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,10 +37,12 @@
 block discarded – undo
37 37
      */
38 38
     public function matches(string $string, string $pattern): bool
39 39
     {
40
-        if ($string === $pattern) {
40
+        if ($string === $pattern)
41
+        {
41 42
             return true;
42 43
         }
43
-        if (!$this->isPattern($pattern)) {
44
+        if (!$this->isPattern($pattern))
45
+        {
44 46
             return false;
45 47
         }
46 48
 
Please login to merge, or discard this patch.
src/Translator/src/Traits/TranslatorTrait.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected function say(string $string, array $options = [], $bundle = null): string
43 43
     {
44
-        if (Translator::isMessage($string)) {
44
+        if (Translator::isMessage($string)){
45 45
             //Cut [[ and ]]
46 46
             $string = substr($string, 2, -2);
47 47
         }
48 48
 
49 49
         $container = ContainerScope::getContainer();
50
-        if (empty($container) || !$container->has(TranslatorInterface::class)) {
50
+        if (empty($container) || !$container->has(TranslatorInterface::class)){
51 51
             return Translator::interpolate($string, $options);
52 52
         }
53 53
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
          */
57 57
         $translator = $container->get(TranslatorInterface::class);
58 58
 
59
-        if (is_null($bundle)) {
59
+        if (is_null($bundle)){
60 60
             $bundle = $translator->getDomain(static::class);
61 61
         }
62 62
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,13 +41,15 @@  discard block
 block discarded – undo
41 41
      */
42 42
     protected function say(string $string, array $options = [], $bundle = null): string
43 43
     {
44
-        if (Translator::isMessage($string)) {
44
+        if (Translator::isMessage($string))
45
+        {
45 46
             //Cut [[ and ]]
46 47
             $string = substr($string, 2, -2);
47 48
         }
48 49
 
49 50
         $container = ContainerScope::getContainer();
50
-        if (empty($container) || !$container->has(TranslatorInterface::class)) {
51
+        if (empty($container) || !$container->has(TranslatorInterface::class))
52
+        {
51 53
             return Translator::interpolate($string, $options);
52 54
         }
53 55
 
@@ -56,7 +58,8 @@  discard block
 block discarded – undo
56 58
          */
57 59
         $translator = $container->get(TranslatorInterface::class);
58 60
 
59
-        if (is_null($bundle)) {
61
+        if (is_null($bundle))
62
+        {
60 63
             $bundle = $translator->getDomain(static::class);
61 64
         }
62 65
 
Please login to merge, or discard this patch.
src/Translator/src/Config/TranslatorConfig.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function getLocaleDirectory(string $locale): string
96 96
     {
97
-        return $this->getLocalesDirectory() . $locale . '/';
97
+        return $this->getLocalesDirectory().$locale.'/';
98 98
     }
99 99
 
100 100
     /**
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
     {
108 108
         $bundle = strtolower(str_replace(['/', '\\'], '-', $bundle));
109 109
 
110
-        foreach ($this->config['domains'] as $domain => $patterns) {
111
-            foreach ($patterns as $pattern) {
112
-                if ($this->matcher->matches($bundle, $pattern)) {
110
+        foreach ($this->config['domains'] as $domain => $patterns){
111
+            foreach ($patterns as $pattern){
112
+                if ($this->matcher->matches($bundle, $pattern)){
113 113
                     return $domain;
114 114
                 }
115 115
             }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -107,9 +107,12 @@
 block discarded – undo
107 107
     {
108 108
         $bundle = strtolower(str_replace(['/', '\\'], '-', $bundle));
109 109
 
110
-        foreach ($this->config['domains'] as $domain => $patterns) {
111
-            foreach ($patterns as $pattern) {
112
-                if ($this->matcher->matches($bundle, $pattern)) {
110
+        foreach ($this->config['domains'] as $domain => $patterns)
111
+        {
112
+            foreach ($patterns as $pattern)
113
+            {
114
+                if ($this->matcher->matches($bundle, $pattern))
115
+                {
113 116
                     return $domain;
114 117
                 }
115 118
             }
Please login to merge, or discard this patch.
src/Translator/src/Catalogue/RuntimeLoader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
      */
51 51
     public function loadCatalogue(string $locale): CatalogueInterface
52 52
     {
53
-        if (!$this->hasLocale($locale)) {
53
+        if (!$this->hasLocale($locale)){
54 54
             throw new LocaleException($locale);
55 55
         }
56 56
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,8 @@
 block discarded – undo
50 50
      */
51 51
     public function loadCatalogue(string $locale): CatalogueInterface
52 52
     {
53
-        if (!$this->hasLocale($locale)) {
53
+        if (!$this->hasLocale($locale))
54
+        {
54 55
             throw new LocaleException($locale);
55 56
         }
56 57
 
Please login to merge, or discard this patch.
src/Translator/src/Catalogue/CatalogueManager.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function getLocales(): array
52 52
     {
53
-        if ($this->locales !== []) {
53
+        if ($this->locales !== []){
54 54
             return $this->locales;
55 55
         }
56 56
 
57 57
         $this->locales = (array)$this->cache->getLocales();
58
-        if ($this->locales === []) {
58
+        if ($this->locales === []){
59 59
             $this->locales = $this->loader->getLocales();
60 60
             $this->cache->setLocales($this->locales);
61 61
         }
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
      */
69 69
     public function load(string $locale): CatalogueInterface
70 70
     {
71
-        if (isset($this->catalogues[$locale])) {
71
+        if (isset($this->catalogues[$locale])){
72 72
             return $this->catalogues[$locale];
73 73
         }
74 74
 
75 75
         $data = (array)$this->cache->loadLocale($locale);
76
-        if (!empty($data)) {
76
+        if (!empty($data)){
77 77
             $this->catalogues[$locale] = new Catalogue($locale, $data);
78
-        } else {
78
+        }else{
79 79
             $this->catalogues[$locale] = $this->loader->loadCatalogue($locale);
80 80
         }
81 81
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     public function reset(): void
113 113
     {
114 114
         $this->cache->setLocales(null);
115
-        foreach ($this->getLocales() as $locale) {
115
+        foreach ($this->getLocales() as $locale){
116 116
             $this->cache->saveLocale($locale, null);
117 117
         }
118 118
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,12 +50,14 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function getLocales(): array
52 52
     {
53
-        if ($this->locales !== []) {
53
+        if ($this->locales !== [])
54
+        {
54 55
             return $this->locales;
55 56
         }
56 57
 
57 58
         $this->locales = (array)$this->cache->getLocales();
58
-        if ($this->locales === []) {
59
+        if ($this->locales === [])
60
+        {
59 61
             $this->locales = $this->loader->getLocales();
60 62
             $this->cache->setLocales($this->locales);
61 63
         }
@@ -68,14 +70,18 @@  discard block
 block discarded – undo
68 70
      */
69 71
     public function load(string $locale): CatalogueInterface
70 72
     {
71
-        if (isset($this->catalogues[$locale])) {
73
+        if (isset($this->catalogues[$locale]))
74
+        {
72 75
             return $this->catalogues[$locale];
73 76
         }
74 77
 
75 78
         $data = (array)$this->cache->loadLocale($locale);
76
-        if (!empty($data)) {
79
+        if (!empty($data))
80
+        {
77 81
             $this->catalogues[$locale] = new Catalogue($locale, $data);
78
-        } else {
82
+        }
83
+        else
84
+        {
79 85
             $this->catalogues[$locale] = $this->loader->loadCatalogue($locale);
80 86
         }
81 87
 
@@ -112,7 +118,8 @@  discard block
 block discarded – undo
112 118
     public function reset(): void
113 119
     {
114 120
         $this->cache->setLocales(null);
115
-        foreach ($this->getLocales() as $locale) {
121
+        foreach ($this->getLocales() as $locale)
122
+        {
116 123
             $this->cache->saveLocale($locale, null);
117 124
         }
118 125
 
Please login to merge, or discard this patch.
src/Translator/src/Catalogue/CatalogueLoader.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function getLocales(): array
50 50
     {
51
-        if (!is_dir($this->config->getLocalesDirectory())) {
51
+        if (!is_dir($this->config->getLocalesDirectory())){
52 52
             return [];
53 53
         }
54 54
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         /**
61 61
          * @var \Symfony\Component\Finder\SplFileInfo $directory
62 62
          */
63
-        foreach ($finder->directories()->getIterator() as $directory) {
63
+        foreach ($finder->directories()->getIterator() as $directory){
64 64
             $locales[] = $directory->getFilename();
65 65
         }
66 66
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $locale = preg_replace('/[^a-zA-Z_]/', '', mb_strtolower($locale));
76 76
         $catalogue = new Catalogue($locale);
77 77
 
78
-        if (!$this->hasLocale($locale)) {
78
+        if (!$this->hasLocale($locale)){
79 79
             return $catalogue;
80 80
         }
81 81
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         /**
86 86
          * @var SplFileInfo $file
87 87
          */
88
-        foreach ($finder->getIterator() as $file) {
88
+        foreach ($finder->getIterator() as $file){
89 89
             $this->getLogger()->info(
90 90
                 sprintf(
91 91
                     "found locale domain file '%s'",
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
             //Per application agreement domain name must present in filename
98 98
             $domain = strstr($file->getFilename(), '.', true);
99 99
 
100
-            if (!$this->config->hasLoader($file->getExtension())) {
100
+            if (!$this->config->hasLoader($file->getExtension())){
101 101
                 $this->getLogger()->warning(
102 102
                     sprintf(
103 103
                         "unable to load domain file '%s', no loader found",
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,8 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function getLocales(): array
50 50
     {
51
-        if (!is_dir($this->config->getLocalesDirectory())) {
51
+        if (!is_dir($this->config->getLocalesDirectory()))
52
+        {
52 53
             return [];
53 54
         }
54 55
 
@@ -60,7 +61,8 @@  discard block
 block discarded – undo
60 61
         /**
61 62
          * @var \Symfony\Component\Finder\SplFileInfo $directory
62 63
          */
63
-        foreach ($finder->directories()->getIterator() as $directory) {
64
+        foreach ($finder->directories()->getIterator() as $directory)
65
+        {
64 66
             $locales[] = $directory->getFilename();
65 67
         }
66 68
 
@@ -75,7 +77,8 @@  discard block
 block discarded – undo
75 77
         $locale = preg_replace('/[^a-zA-Z_]/', '', mb_strtolower($locale));
76 78
         $catalogue = new Catalogue($locale);
77 79
 
78
-        if (!$this->hasLocale($locale)) {
80
+        if (!$this->hasLocale($locale))
81
+        {
79 82
             return $catalogue;
80 83
         }
81 84
 
@@ -85,7 +88,8 @@  discard block
 block discarded – undo
85 88
         /**
86 89
          * @var SplFileInfo $file
87 90
          */
88
-        foreach ($finder->getIterator() as $file) {
91
+        foreach ($finder->getIterator() as $file)
92
+        {
89 93
             $this->getLogger()->info(
90 94
                 sprintf(
91 95
                     "found locale domain file '%s'",
@@ -97,7 +101,8 @@  discard block
 block discarded – undo
97 101
             //Per application agreement domain name must present in filename
98 102
             $domain = strstr($file->getFilename(), '.', true);
99 103
 
100
-            if (!$this->config->hasLoader($file->getExtension())) {
104
+            if (!$this->config->hasLoader($file->getExtension()))
105
+            {
101 106
                 $this->getLogger()->warning(
102 107
                     sprintf(
103 108
                         "unable to load domain file '%s', no loader found",
Please login to merge, or discard this patch.