Completed
Push — develop ( 2094a2...f42d0b )
by Mathias
19:21 queued 08:54
created
module/Core/src/Core/Controller/Plugin/ContentCollector.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
                       $response = new ViewModel(array('target' => $target));
87 87
                       $response->setTemplate($template);
88 88
             }
89
-            $viewModel->addChild($response, $this->_captureTo . $i);
89
+            $viewModel->addChild($response, $this->_captureTo.$i);
90 90
         }
91 91
                 
92 92
         return $viewModel;
Please login to merge, or discard this patch.
module/Core/src/Core/Controller/Plugin/Mail.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -153,18 +153,18 @@  discard block
 block discarded – undo
153 153
         $replyTo = $this->stringFromMailHeader($this->getReplyTo());
154 154
         
155 155
         return str_pad($template, 30)
156
-                . 'to: ' . str_pad($to, 50)
157
-                . 'cc: ' . str_pad($cc, 50)
158
-                . 'bcc: ' . str_pad($bcc, 50)
159
-                . 'from: ' . str_pad($from, 50)
160
-                . 'replyTo: ' . str_pad($replyTo, 50)
156
+                . 'to: '.str_pad($to, 50)
157
+                . 'cc: '.str_pad($cc, 50)
158
+                . 'bcc: '.str_pad($bcc, 50)
159
+                . 'from: '.str_pad($from, 50)
160
+                . 'replyTo: '.str_pad($replyTo, 50)
161 161
                 //. str_pad(implode(',', ArrayUtils::iteratorToArray($this->getSender())),50)
162
-                . 'subject: ' . str_pad($this->getSubject(), 50);
162
+                . 'subject: '.str_pad($this->getSubject(), 50);
163 163
     }
164 164
     
165 165
     public function template($template)
166 166
     {
167
-        $controller =  get_class($this->controller);
167
+        $controller = get_class($this->controller);
168 168
         
169 169
         $event = new Event();
170 170
         $eventManager = $this->eventManager;
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
         $controllerIdentifier = strtolower(substr($controller, 0, strpos($controller, '\\')));
182 182
         $viewResolver = $this->viewResolver;
183 183
                 
184
-        $templateHalf = 'mail/' . $template;
184
+        $templateHalf = 'mail/'.$template;
185 185
         $resource = $viewResolver->resolve($templateHalf);
186 186
         
187 187
         if (empty($resource)) {
188
-            $templateFull = $controllerIdentifier . '/mail/' . $template;
188
+            $templateFull = $controllerIdentifier.'/mail/'.$template;
189 189
             $resource = $viewResolver->resolve($templateFull);
190 190
         }
191 191
         
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                     unset($__vars[$key]);
213 213
                 }
214 214
             }
215
-            unset($__vars['content'],$__vars['controllerIdentifier'],$__vars['controller'],$__vars['resource'],$__vars['template'],$__vars['viewResolver']);
215
+            unset($__vars['content'], $__vars['controllerIdentifier'], $__vars['controller'], $__vars['resource'], $__vars['template'], $__vars['viewResolver']);
216 216
             $this->config = $__vars;
217 217
         }
218 218
     }
@@ -237,20 +237,20 @@  discard block
 block discarded – undo
237 237
         if (isset($this->config['from'])) {
238 238
             $from = $this->config['from'];
239 239
         } else {
240
-            $log->err('A from email address must be provided (Variable $from) in Template: ' . $template);
241
-            throw new \InvalidArgumentException('A from email address must be provided (Variable $from) in Template: ' . $template);
240
+            $log->err('A from email address must be provided (Variable $from) in Template: '.$template);
241
+            throw new \InvalidArgumentException('A from email address must be provided (Variable $from) in Template: '.$template);
242 242
         }
243 243
         if (isset($this->config['fromName'])) {
244 244
             $fromName = $this->config['fromName'];
245 245
         } else {
246
-            $log->err('A from name must be provided (Variable $fromName) in Template: ' . $template);
247
-            throw new \InvalidArgumentException('A from name must be provided (Variable $fromName) in Template: ' . $template);
246
+            $log->err('A from name must be provided (Variable $fromName) in Template: '.$template);
247
+            throw new \InvalidArgumentException('A from name must be provided (Variable $fromName) in Template: '.$template);
248 248
         }
249 249
         if (isset($this->config['subject'])) {
250 250
             $subject = $this->config['subject'];
251 251
         } else {
252
-            $log->err('A subject must be provided (Variable $subject) in Template: ' . $template);
253
-            throw new \InvalidArgumentException('A subject must be provided (Variable $subject) in Template: ' . $template);
252
+            $log->err('A subject must be provided (Variable $subject) in Template: '.$template);
253
+            throw new \InvalidArgumentException('A subject must be provided (Variable $subject) in Template: '.$template);
254 254
         }
255 255
         $this->setFrom($from, $fromName);
256 256
         $this->setSubject($subject);
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
             $erg = true;
272 272
             $log->info($this);
273 273
         } catch (\Exception $e) {
274
-            $log->err('Mail failure ' . $e->getMessage());
274
+            $log->err('Mail failure '.$e->getMessage());
275 275
         }
276 276
         return $erg;
277 277
     }
@@ -288,6 +288,6 @@  discard block
 block discarded – undo
288 288
         $viewResolver   = $container->get('ViewResolver');
289 289
         $eventManager   = $container->get('EventManager');
290 290
         $moduleManager  = $container->get('ModuleManager');
291
-        return new static($mailLog,$viewResolver,$eventManager,$moduleManager);
291
+        return new static($mailLog, $viewResolver, $eventManager, $moduleManager);
292 292
     }
293 293
 }
Please login to merge, or discard this patch.
module/Core/src/Core/Controller/Plugin/ConfigFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
  */
14 14
 class ConfigFactory implements FactoryInterface
15 15
 {
16
-	public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
16
+	public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
17 17
 	{
18 18
 		$config = $container->get('Config');
19 19
 		$plugin = new Config($config);
Please login to merge, or discard this patch.
module/Core/Module.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     public function getConsoleBanner(Console $console)
42 42
     {
43 43
         $version = `git describe 2>/dev/null`;
44
-        $name = 'YAWIK ' . trim($version);
44
+        $name = 'YAWIK '.trim($version);
45 45
         $width = $console->getWidth();
46 46
         return sprintf(
47 47
             "==%1\$s==\n%2\$s%3\$s\n**%1\$s**\n",
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
             /* @var \Core\Options\ModuleOptions $options */
86 86
             $languageRouteListener = new LanguageRouteListener(
87
-                $sm->get('Core/Locale'),$sm->get('Core/Options')
87
+                $sm->get('Core/Locale'), $sm->get('Core/Options')
88 88
             );
89 89
             $languageRouteListener->attach($eventManager);
90 90
         
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 
114 114
         $eventManager->attach(
115 115
             MvcEvent::EVENT_DISPATCH_ERROR,
116
-            function ($event) {
117
-            	if($event instanceof MvcEvent){
116
+            function($event) {
117
+            	if ($event instanceof MvcEvent) {
118 118
 		            $application = $event->getApplication();
119 119
 		            
120 120
 		            if ($application::ERROR_EXCEPTION == $event->getError()) {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         );
130 130
         $eventManager->attach(
131 131
             MvcEvent::EVENT_DISPATCH,
132
-            function ($event) use ($eventManager) {
132
+            function($event) use ($eventManager) {
133 133
                 $eventManager->trigger('postDispatch', $event);
134 134
             },
135 135
             -150
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     public function getConfig()
146 146
     {
147
-        $config = include __DIR__ . '/config/module.config.php';
147
+        $config = include __DIR__.'/config/module.config.php';
148 148
         return $config;
149 149
     }
150 150
 
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
     {
158 158
         return array(
159 159
             'Zend\Loader\ClassMapAutoloader' => [
160
-                __DIR__ . '/src/autoload_classmap.php'
160
+                __DIR__.'/src/autoload_classmap.php'
161 161
             ],
162 162
             'Zend\Loader\StandardAutoloader' => array(
163 163
                 'namespaces' => array(
164
-                    __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
165
-                    'CoreTest' => __DIR__ . '/test/' . 'CoreTest',
166
-                    'CoreTestUtils' => __DIR__ . '/test/CoreTestUtils',
164
+                    __NAMESPACE__ => __DIR__.'/src/'.__NAMESPACE__,
165
+                    'CoreTest' => __DIR__.'/test/'.'CoreTest',
166
+                    'CoreTestUtils' => __DIR__.'/test/CoreTestUtils',
167 167
                 ),
168 168
             ),
169 169
         );
Please login to merge, or discard this patch.
module/Core/src/Core/Listener/LanguageRouteListener.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
         }
125 125
         
126 126
         $router = $e->getRouter();
127
-        $basePath=$router->getBaseUrl();
127
+        $basePath = $router->getBaseUrl();
128 128
         $match = [];
129 129
         
130
-        if (preg_match('~^' . $basePath . '/([a-z]{2})(?:/|$)~', $e->getRequest()->getRequestUri(), $match)) {
130
+        if (preg_match('~^'.$basePath.'/([a-z]{2})(?:/|$)~', $e->getRequest()->getRequestUri(), $match)) {
131 131
             /* It seems we have already a language in the URI
132 132
              * Now there are two possibilities:
133 133
              *
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
         $options = $this->moduleOptions;
163 163
         // using default language if detect language is disabled
164
-        $lang = $options->isDetectLanguage() ? $this->detectLanguage($e):$options->getDefaultLanguage();
164
+        $lang = $options->isDetectLanguage() ? $this->detectLanguage($e) : $options->getDefaultLanguage();
165 165
         $langUri = rtrim("$basePath/$lang$origUri", '/');
166 166
         if ($router->match($request->setUri($langUri)) instanceof RouteMatch) {
167 167
             $e->stopPropagation(true);
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
         setlocale(
213 213
             LC_ALL,
214 214
             array(
215
-            $locale . ".utf8",
216
-            $locale . ".iso88591",
215
+            $locale.".utf8",
216
+            $locale.".iso88591",
217 217
             $locale,
218 218
             substr($locale, 0, 2),
219 219
             'de_DE.utf8',
Please login to merge, or discard this patch.
module/Core/src/Core/Mail/FileTransport.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     {
33 33
         $options  = $this->options;
34 34
         $filename = call_user_func($options->getCallback(), $this);
35
-        $file     = $options->getPath() . DIRECTORY_SEPARATOR . $filename;
35
+        $file     = $options->getPath().DIRECTORY_SEPARATOR.$filename;
36 36
 
37 37
 
38 38
         $contents = $message->toString();
Please login to merge, or discard this patch.
module/Core/src/Core/Mail/MailServiceFactory.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  */
27 27
 class MailServiceFactory implements FactoryInterface
28 28
 {
29
-	public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
29
+	public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
30 30
 	{
31 31
 		$config = $container->get('Config');
32 32
 		$mails = isset($config['mails']) ? $config['mails'] : [];
@@ -48,12 +48,12 @@  discard block
 block discarded – undo
48 48
 		$configArray = array_merge($configArray, $mails);
49 49
 		
50 50
 		$config = new MailServiceConfig($configArray);
51
-		$service   = new MailService($container,$config->toArray());
51
+		$service = new MailService($container, $config->toArray());
52 52
 		$config->configureServiceManager($service);
53
-		foreach($config->toArray() as $name=>$value){
53
+		foreach ($config->toArray() as $name=>$value) {
54 54
 			$method = 'set'.$name;
55
-			if(method_exists($service,$method)){
56
-				call_user_func([$service,$method],$value);
55
+			if (method_exists($service, $method)) {
56
+				call_user_func([$service, $method], $value);
57 57
 			}
58 58
 		}
59 59
 		
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
         $type = $mailServiceOptions->getTransportClass();
66 66
         if (MailService::TRANSPORT_SMTP == $type) {
67 67
             return new Smtp($mailServiceOptions);
68
-        }elseif(MailService::TRANSPORT_FILE == $type){
68
+        }elseif (MailService::TRANSPORT_FILE == $type) {
69 69
             $fileOptions = new FileOptions();
70 70
             $fileOptions->setPath($mailServiceOptions->getPath());
71 71
             return new FileTransport($fileOptions);
72
-        }elseif(MailService::TRANSPORT_SENDMAIL == $type){
72
+        }elseif (MailService::TRANSPORT_SENDMAIL == $type) {
73 73
             return new Sendmail();
74 74
         }
75 75
 
Please login to merge, or discard this patch.
module/Core/src/Core/Options/MailServiceOptions.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         return $this;
100 100
     }
101 101
 
102
-    public function getUsername(){
102
+    public function getUsername() {
103 103
         return $this->connectionConfig['username'];
104 104
     }
105 105
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         return $this;
111 111
     }
112 112
 
113
-    public function getPassword(){
113
+    public function getPassword() {
114 114
         return $this->connectionConfig['password'];
115 115
     }
116 116
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         return $this;
122 122
     }
123 123
 
124
-    public function getSsl(){
124
+    public function getSsl() {
125 125
         return $this->connectionConfig['ssl'];
126 126
     }
127 127
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         return $this;
131 131
     }
132 132
 
133
-    public function getTransportClass(){
133
+    public function getTransportClass() {
134 134
         return $this->transportClass;
135 135
     }
136 136
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function getPath()
141 141
     {
142
-        if(is_null($this->path)){
142
+        if (is_null($this->path)) {
143 143
             $this->setPath(sys_get_temp_dir().'/yawik/mails');
144 144
         }
145 145
         return $this->path;
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function setPath($path)
153 153
     {
154
-        if(!is_dir($path)){
155
-            mkdir($path,0777,true);
156
-            chmod($path,0777);
154
+        if (!is_dir($path)) {
155
+            mkdir($path, 0777, true);
156
+            chmod($path, 0777);
157 157
         }
158 158
         $this->path = $path;
159 159
         return $this;
Please login to merge, or discard this patch.
module/Behat/src/MailContext.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $core = $scope->getEnvironment()->getContext(CoreContext::class);
50 50
         /* @var FileTransport $transport */
51 51
         $transport = $core->getServiceManager()->get('Core/MailService')->getTransport();
52
-        $path = $transport->getOptions()->getPath() . '/*.eml';
52
+        $path = $transport->getOptions()->getPath().'/*.eml';
53 53
         foreach (glob($path) as $filename) {
54 54
             unlink($filename);
55 55
         }
@@ -105,25 +105,25 @@  discard block
 block discarded – undo
105 105
         $regex = '/.*('.preg_quote($text).').*/im';
106 106
         $matches = [];
107 107
         $multiMessages = false;
108
-        if(count($this->messages) > 1){
108
+        if (count($this->messages) > 1) {
109 109
             $multiMessages = true;
110 110
         }
111 111
         $content = "";
112
-        foreach($this->messages as $key=>$definition){
112
+        foreach ($this->messages as $key=>$definition) {
113 113
             $content = $definition['contents'];
114
-            if(preg_match($regex,$content,$match)){
114
+            if (preg_match($regex, $content, $match)) {
115 115
                 $matches[] = $match;
116 116
             }
117 117
         }
118
-        $failMessage = sprintf('Can not find text "%s" in any email sent',$text);
119
-        if(!$multiMessages){
118
+        $failMessage = sprintf('Can not find text "%s" in any email sent', $text);
119
+        if (!$multiMessages) {
120 120
             $failMessage = sprintf(
121 121
                 'Can not find text "%s" in sent email. Here\'s the email content: %s',
122 122
                 $text,
123 123
                 PHP_EOL.PHP_EOL.$content
124 124
             );
125 125
         }
126
-        Assert::true(count($matches)>0,$failMessage);
126
+        Assert::true(count($matches) > 0, $failMessage);
127 127
     }
128 128
 
129 129
     /**
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
 
137 137
         $path = $transport->getOptions()->getPath().'/*.eml';
138 138
 
139
-        foreach(glob($path) as $filename){
139
+        foreach (glob($path) as $filename) {
140 140
             $id = md5($filename);
141
-            if(!isset($this->messages[$id])){
141
+            if (!isset($this->messages[$id])) {
142 142
                 $contents = file_get_contents($filename);
143
-                $this->messages[$id]  = $this->parseEmail($contents);
143
+                $this->messages[$id] = $this->parseEmail($contents);
144 144
             }
145 145
         }
146 146
 
147 147
         Assert::true(
148
-            count($this->messages)>0,
148
+            count($this->messages) > 0,
149 149
             'No email have been sent'
150 150
         );
151 151
     }
@@ -153,33 +153,33 @@  discard block
 block discarded – undo
153 153
     private function parseEmail($contents)
154 154
     {
155 155
         $addresses = $this->parseEmailAddress($contents);
156
-        $subject =$this->parseSubject($contents);
156
+        $subject = $this->parseSubject($contents);
157 157
 
158 158
         $contents = strip_tags($contents);
159 159
         $contents = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $contents);
160 160
 
161
-        return array_merge($addresses,$subject,['contents' => $contents]);
161
+        return array_merge($addresses, $subject, ['contents' => $contents]);
162 162
     }
163 163
 
164 164
     private function parseEmailAddress($contents)
165 165
     {
166 166
         // pattern to get email address
167
-        $radd =  '(\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b)';
167
+        $radd = '(\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,6}\b)';
168 168
 
169 169
         // get email from address
170
-        $regex = sprintf('/^From\:.*%s/im',$radd);
171
-        $hasMatch = preg_match($regex,$contents,$matches);
172
-        $fromAddress = $hasMatch ? $matches[1]:null;
170
+        $regex = sprintf('/^From\:.*%s/im', $radd);
171
+        $hasMatch = preg_match($regex, $contents, $matches);
172
+        $fromAddress = $hasMatch ? $matches[1] : null;
173 173
 
174 174
         // get email to address
175
-        $regex = sprintf('/^To\:\s+%s/im',$radd);
176
-        $hasMatch = preg_match($regex,$contents,$matches);
177
-        $toAddress1 = $hasMatch ? $matches[1]:null;
175
+        $regex = sprintf('/^To\:\s+%s/im', $radd);
176
+        $hasMatch = preg_match($regex, $contents, $matches);
177
+        $toAddress1 = $hasMatch ? $matches[1] : null;
178 178
 
179 179
         // get email to address
180
-        $regex = sprintf('/^To\:.*%s/im',$radd);
181
-        $hasMatch = preg_match($regex,$contents,$matches);
182
-        $toAddress2 = $hasMatch ? $matches[1]:null;
180
+        $regex = sprintf('/^To\:.*%s/im', $radd);
181
+        $hasMatch = preg_match($regex, $contents, $matches);
182
+        $toAddress2 = $hasMatch ? $matches[1] : null;
183 183
 
184 184
         $this->fromMails[] = $fromAddress;
185 185
         $this->toMails[] = $toAddress1;
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 
188 188
         return [
189 189
             'from' => $fromAddress,
190
-            'to' => [$toAddress1,$toAddress2],
190
+            'to' => [$toAddress1, $toAddress2],
191 191
         ];
192 192
     }
193 193
 
194 194
     private function parseSubject($contents)
195 195
     {
196 196
         $pattern = '/Subject\:(.*)/i';
197
-        preg_match($pattern,$contents,$matches);
198
-        $subject = isset($matches[1]) ? $matches[1]:null;
197
+        preg_match($pattern, $contents, $matches);
198
+        $subject = isset($matches[1]) ? $matches[1] : null;
199 199
         $this->subjects[] = $subject;
200 200
         return [
201 201
             'subject' => trim($subject)
Please login to merge, or discard this patch.