Passed
Push — master ( c58a40...6d37ad )
by Mathias
10:02 queued 04:27
created
module/Auth/src/Auth/Controller/ManageController.php 3 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -33,51 +33,51 @@  discard block
 block discarded – undo
33 33
  */
34 34
 class ManageController extends AbstractActionController
35 35
 {
36
-	private $userProfileContainer;
36
+    private $userProfileContainer;
37 37
 	
38
-	private $authService;
38
+    private $authService;
39 39
 	
40
-	private $socialProfileForm;
40
+    private $socialProfileForm;
41 41
 	
42
-	private $translator;
42
+    private $translator;
43 43
 	
44
-	private $repositories;
44
+    private $repositories;
45 45
 	
46
-	private $viewHelper;
46
+    private $viewHelper;
47 47
 	
48
-	private $hybridAuthAdapter;
48
+    private $hybridAuthAdapter;
49 49
 
50 50
     private UploadHandler $manageHandler;
51 51
 
52 52
     /**
53
-	 * @param ContainerInterface $container
54
-	 * @return ManageController
55
-	 */
56
-	static public function factory(ContainerInterface $container)
57
-	{
58
-		$forms = $container->get('forms');
59
-		$userProfileContainer = $forms->get('Auth/UserProfileContainer');
60
-		$socialProfileForm = $forms->get('Auth/SocialProfiles');
61
-		$authService = $container->get('AuthenticationService');
62
-		$translator = $container->get('translator');
63
-		$repositories = $container->get('repositories');
64
-		$viewHelper = $container->get('ViewHelperManager');
65
-		$hybridAuthAdapter = $container->get('HybridAuthAdapter');
66
-		$uploadHandler = $container->get(UploadHandler::class);
53
+     * @param ContainerInterface $container
54
+     * @return ManageController
55
+     */
56
+    static public function factory(ContainerInterface $container)
57
+    {
58
+        $forms = $container->get('forms');
59
+        $userProfileContainer = $forms->get('Auth/UserProfileContainer');
60
+        $socialProfileForm = $forms->get('Auth/SocialProfiles');
61
+        $authService = $container->get('AuthenticationService');
62
+        $translator = $container->get('translator');
63
+        $repositories = $container->get('repositories');
64
+        $viewHelper = $container->get('ViewHelperManager');
65
+        $hybridAuthAdapter = $container->get('HybridAuthAdapter');
66
+        $uploadHandler = $container->get(UploadHandler::class);
67 67
 
68
-		return new ManageController(
69
-			$userProfileContainer,
70
-			$authService,
71
-			$repositories,
72
-			$socialProfileForm,
73
-			$translator,
74
-			$viewHelper,
75
-			$hybridAuthAdapter,
68
+        return new ManageController(
69
+            $userProfileContainer,
70
+            $authService,
71
+            $repositories,
72
+            $socialProfileForm,
73
+            $translator,
74
+            $viewHelper,
75
+            $hybridAuthAdapter,
76 76
             $uploadHandler
77
-		);
78
-	}
77
+        );
78
+    }
79 79
 	
80
-	public function __construct(
80
+    public function __construct(
81 81
         UserProfileContainer $userProfileContainer,
82 82
         AuthenticationService $authService,
83 83
         RepositoryService $repositories,
@@ -86,19 +86,19 @@  discard block
 block discarded – undo
86 86
         HelperPluginManager $viewHelper,
87 87
         HybridAuth $hybridAuthAdapter,
88 88
         UploadHandler $manageHandler
89
-	)
90
-	{
91
-		$this->userProfileContainer = $userProfileContainer;
92
-		$this->authService = $authService;
93
-		$this->socialProfileForm = $socialProfileForm;
94
-		$this->repositories = $repositories;
95
-		$this->translator = $translator;
96
-		$this->viewHelper = $viewHelper;
97
-		$this->hybridAuthAdapter = $hybridAuthAdapter;
89
+    )
90
+    {
91
+        $this->userProfileContainer = $userProfileContainer;
92
+        $this->authService = $authService;
93
+        $this->socialProfileForm = $socialProfileForm;
94
+        $this->repositories = $repositories;
95
+        $this->translator = $translator;
96
+        $this->viewHelper = $viewHelper;
97
+        $this->hybridAuthAdapter = $hybridAuthAdapter;
98 98
         $this->manageHandler = $manageHandler;
99 99
     }
100 100
 	
101
-	/**
101
+    /**
102 102
      * @return array|JsonModel
103 103
      */
104 104
     public function profileAction()
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                 $postData  = $form->getOption('use_post_array') ? $_POST : array();
143 143
                 //@TODO: [ZF3] option use_files_array is false by default
144 144
                 //$filesData = $form->getOption('use_files_array') ? $_FILES : array();
145
-	            $filesData = $_FILES;
145
+                $filesData = $_FILES;
146 146
                 $data      = array_merge($postData, $filesData);
147 147
                 $form->setData($data);
148 148
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
         /* @var \Auth\Form\UserProfileContainer $userProfileContainer */
107 107
         $userProfileContainer = $this->userProfileContainer;
108 108
         $user = $this->authService->getUser(); /* @var $user \Auth\Entity\User */
109
-        $postProfiles = (array)$this->params()->fromPost('social_profiles');
109
+        $postProfiles = (array) $this->params()->fromPost('social_profiles');
110 110
         $userProfiles = $user->getProfile();
111 111
         $formSocialProfiles = $this->socialProfileForm
112 112
             ->setUseDefaultValidation(true)
113
-            ->setData(['social_profiles' => array_map(function ($array)
113
+            ->setData(['social_profiles' => array_map(function($array)
114 114
             {
115 115
                 return $array['data'];
116 116
             }, $userProfiles)]);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             $formName  = $this->params()->fromQuery('form');
129 129
             $form      = $userProfileContainer->getForm($formName);
130 130
 
131
-            if(!is_null($form) && 'info.image' === $formName) {
131
+            if (!is_null($form) && 'info.image' === $formName) {
132 132
                 $user = $this->manageHandler->handleUpload($user, $_FILES['image']);
133 133
                 $form->getParent()->setEntity($user->getInfo());
134 134
                 $content = $this->viewHelper->get('form')->__invoke($form);
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
                         'content' => $content,
139 139
                     )
140 140
                 );
141
-            }elseif($form) {
142
-                $postData  = $form->getOption('use_post_array') ? $_POST : array();
141
+            }elseif ($form) {
142
+                $postData = $form->getOption('use_post_array') ? $_POST : array();
143 143
                 //@TODO: [ZF3] option use_files_array is false by default
144 144
                 //$filesData = $form->getOption('use_files_array') ? $_FILES : array();
145 145
 	            $filesData = $_FILES;
146
-                $data      = array_merge($postData, $filesData);
146
+                $data = array_merge($postData, $filesData);
147 147
                 $form->setData($data);
148 148
 
149 149
                 if (!$form->isValid()) {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                                 ));
203 203
                             } else {
204 204
                                 $profile = [
205
-                                    'auth' => (array)$authProfile,
205
+                                    'auth' => (array) $authProfile,
206 206
                                     'data' => \Laminas\Json\Json::decode($dataProfiles[$network])
207 207
                                 ];
208 208
                                 $user->addProfile($network, $profile);
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                 }
213 213
                 
214 214
                 // keep data in sync & properly decoded
215
-                $formSocialProfiles->setData(['social_profiles' => array_map(function ($array)
215
+                $formSocialProfiles->setData(['social_profiles' => array_map(function($array)
216 216
                 {
217 217
                     return \Laminas\Json\Json::decode($array) ?: '';
218 218
                 }, $dataProfiles)]);
Please login to merge, or discard this patch.
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
                         'content' => $content,
139 139
                     )
140 140
                 );
141
-            }elseif($form) {
141
+            } elseif($form) {
142 142
                 $postData  = $form->getOption('use_post_array') ? $_POST : array();
143 143
                 //@TODO: [ZF3] option use_files_array is false by default
144 144
                 //$filesData = $form->getOption('use_files_array') ? $_FILES : array();
@@ -173,8 +173,7 @@  discard block
 block discarded – undo
173 173
                     'content' => $content,
174 174
                     )
175 175
                 );
176
-            }
177
-            elseif ($postProfiles) {
176
+            } elseif ($postProfiles) {
178 177
                 $formSocialProfiles->setData($this->params()->fromPost());
179 178
                 
180 179
                 if ($formSocialProfiles->isValid()) {
Please login to merge, or discard this patch.
module/Auth/src/Auth/Entity/UserImage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      */
30 30
     public function getUri(): string
31 31
     {
32
-        return '/file/Auth.UserImage/' . $this->id;
32
+        return '/file/Auth.UserImage/'.$this->id;
33 33
     }
34 34
 
35 35
     /**
Please login to merge, or discard this patch.
module/Install/src/Factory/Controller/Plugin/UserCreatorFactory.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 
52 52
         $config = $container->get('doctrine.documentmanager.odm_default')->getConfiguration();
53 53
         $config->setDefaultDB($database);
54
-        $dm = $this->createDocumentManager($options['connection'],$config);
54
+        $dm = $this->createDocumentManager($options['connection'], $config);
55 55
 
56
-        $plugin = new UserCreator($credentialFilter,$dm);
56
+        $plugin = new UserCreator($credentialFilter, $dm);
57 57
         return $plugin;
58 58
     }
59 59
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function createDocumentManager($connection, $config)
69 69
     {
70
-        try{
70
+        try {
71 71
             $dbConn = new Client($connection, [], [
72 72
                 'typeMap' => [
73 73
                     'root' => 'array',
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
                 ]
76 76
             ]);
77 77
             $dbConn->selectDatabase('YAWIK');
78
-            $dm = DocumentManager::create($dbConn,$config);
78
+            $dm = DocumentManager::create($dbConn, $config);
79 79
             return $dm;
80
-        }catch (\Exception $e){
80
+        } catch (\Exception $e) {
81 81
             throw new \Exception("Can't create document manager: {$e->getMessage()}");
82 82
         }
83 83
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
             $dbConn->selectDatabase('YAWIK');
78 78
             $dm = DocumentManager::create($dbConn,$config);
79 79
             return $dm;
80
-        }catch (\Exception $e){
80
+        } catch (\Exception $e){
81 81
             throw new \Exception("Can't create document manager: {$e->getMessage()}");
82 82
         }
83 83
     }
Please login to merge, or discard this patch.
module/Cv/test/CvTest/Entity/ContactImageTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@
 block discarded – undo
29 29
         ContactImage::class,
30 30
     ];
31 31
 
32
-    private $inheritance = [ FileInterface::class ];
32
+    private $inheritance = [FileInterface::class];
33 33
 
34 34
     public function propertiesProvider()
35 35
     {
36 36
         return [
37
-            [ 'uri', [
38
-                'pre' => function () {
37
+            ['uri', [
38
+                'pre' => function() {
39 39
                     $this->target->setId('some-id')->setName('some-name');
40 40
                 },
41 41
                 'ignore_setter' => true,
42
-                'value' => '/file/Cv.ContactImage/some-id/' . urlencode('some-name'),
42
+                'value' => '/file/Cv.ContactImage/some-id/'.urlencode('some-name'),
43 43
             ]],
44 44
         ];
45 45
     }
Please login to merge, or discard this patch.
module/Cv/test/CvTest/Entity/AttachmentTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
43 43
      */
44 44
     private $metadata;
45 45
 
46
-    private $inheritance = [ FileInterface::class ];
46
+    private $inheritance = [FileInterface::class];
47 47
 
48 48
     private $properties = [
49
-        [ 'uri', [ 'ignore_setter' => true, 'value' => "/file/Cv.Attachment/test/name" ]]
49
+        ['uri', ['ignore_setter' => true, 'value' => "/file/Cv.Attachment/test/name"]]
50 50
     ];
51 51
 
52 52
     private function setupSetterGetterTarget()
Please login to merge, or discard this patch.
Cv/test/CvTest/Repository/Event/UpdateFilesPermissionsSubscriberTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@
 block discarded – undo
43 43
         '@testGetFilesAppendsContactImage' => UfpsMock::class,
44 44
     ];
45 45
 
46
-    private $inheritance = [ AbstractUpdateFilesPermissionsSubscriber::class ];
46
+    private $inheritance = [AbstractUpdateFilesPermissionsSubscriber::class];
47 47
 
48 48
     public function testDefaultAttributesValues()
49 49
     {
50 50
         $this->assertAttributeEquals(Cv::class, 'targetDocument', $this->target);
51
-        $this->assertAttributeEquals([ 'attachments' ], 'filesProperties', $this->target);
51
+        $this->assertAttributeEquals(['attachments'], 'filesProperties', $this->target);
52 52
     }
53 53
 
54 54
     /*
Please login to merge, or discard this patch.
module/Cv/test/CvTest/Repository/Filter/PaginationQueryTest.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         'getTargetArgs',
40 40
     ];
41 41
 
42
-    private $inheritance = [ AbstractPaginationQuery::class ];
42
+    private $inheritance = [AbstractPaginationQuery::class];
43 43
 
44 44
     private function getTargetArgs()
45 45
     {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         }
61 61
 
62 62
         $this->user = $user;
63
-        return [ $user ];
63
+        return [$user];
64 64
     }
65 65
 
66 66
     public function testDefaultPropertyValues()
@@ -92,29 +92,29 @@  discard block
 block discarded – undo
92 92
         $exprExpects = [];
93 93
 
94 94
         if ('search' == $mode || true === $mode) {
95
-            $exprExpects['operator'][] = [ 'with' => ['$text', ['$search' => strtolower($params['search'])]]];
96
-            $exprExpects['getQuery'][] = [ 'return' => ['exprQuery'] ];
97
-            $qbExpects['field'][] = [ 'with' => [""]];
98
-            $qbExpects['equals'][] = [ 'with' => [['exprQuery']]];
95
+            $exprExpects['operator'][] = ['with' => ['$text', ['$search' => strtolower($params['search'])]]];
96
+            $exprExpects['getQuery'][] = ['return' => ['exprQuery']];
97
+            $qbExpects['field'][] = ['with' => [""]];
98
+            $qbExpects['equals'][] = ['with' => [['exprQuery']]];
99 99
         }
100 100
 
101 101
         if ('location' == $mode || true === $mode) {
102 102
             $coords = $params['l']->getCoordinates()->getCoordinates();
103 103
             $qbExpects['field'][] = ['with' => ['preferredJob.desiredLocations.coordinates']];
104
-            $qbExpects['geoWithinCenter'][] = ['with' => [$coords[0], $coords[1],(float)$params['d'] / 100]];
104
+            $qbExpects['geoWithinCenter'][] = ['with' => [$coords[0], $coords[1], (float) $params['d'] / 100]];
105 105
         }
106 106
 
107
-        $exprExpects['field'][] = [ 'with' => ['permissions.view']];
108
-        $exprExpects['equals'][] = [ 'with' => [ $this->user->getId()]];
109
-        $exprExpects['field'][] = [ 'with' => ['status.name']];
110
-        $exprExpects['equals'][] = [ 'with' => [Status::PUBLIC_TO_ALL]];
107
+        $exprExpects['field'][] = ['with' => ['permissions.view']];
108
+        $exprExpects['equals'][] = ['with' => [$this->user->getId()]];
109
+        $exprExpects['field'][] = ['with' => ['status.name']];
110
+        $exprExpects['equals'][] = ['with' => [Status::PUBLIC_TO_ALL]];
111 111
 
112
-        $qbExpects['addOr'][] = [ 'with' => [$expr] ];
113
-        $qbExpects['addOr'][] = [ 'with' => [$expr] ];
112
+        $qbExpects['addOr'][] = ['with' => [$expr]];
113
+        $qbExpects['addOr'][] = ['with' => [$expr]];
114 114
 
115 115
 
116 116
 
117
-        $configureMock = function ($mock, $expects) {
117
+        $configureMock = function($mock, $expects) {
118 118
             foreach ($expects as $method => $spec) {
119 119
                 $count = count($spec);
120 120
                 $with = [];
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
     public function provideCreateQueryTestData()
142 142
     {
143 143
         $loc = new Location();
144
-        $loc->setCoordinates(new Point([1,1]));
144
+        $loc->setCoordinates(new Point([1, 1]));
145 145
         return [
146
-            'woParams'    => [ null, null ],
147
-            'emptySearch' => [ null, ['search' => '']],
148
-            'search'      => [ 'search', ['search' => 'MusBeLowerCase']],
149
-            'emptyLocation' => [ null, ['l' => new Location()]],
150
-            'location'    => [ 'location', ['l' => $loc, 'd' => 10]],
151
-            'all'         => [ true, ['search' => 'MustLowerThisOneToo', 'l' => $loc, 'd' => 5]],
146
+            'woParams'    => [null, null],
147
+            'emptySearch' => [null, ['search' => '']],
148
+            'search'      => ['search', ['search' => 'MusBeLowerCase']],
149
+            'emptyLocation' => [null, ['l' => new Location()]],
150
+            'location'    => ['location', ['l' => $loc, 'd' => 10]],
151
+            'all'         => [true, ['search' => 'MustLowerThisOneToo', 'l' => $loc, 'd' => 5]],
152 152
 
153 153
         ];
154 154
     }
Please login to merge, or discard this patch.
module/Cv/src/Service/UploadHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@
 block discarded – undo
165 165
         $metadata = new ImageMetadata();
166 166
 
167 167
         $contact = $cv->getContact();
168
-        if(!is_null($contact->getImage())){
168
+        if (!is_null($contact->getImage())) {
169 169
             $contact->setImage(null);
170 170
             $dm->persist($cv);
171 171
             $dm->flush();
Please login to merge, or discard this patch.
module/Cv/src/Controller/ManageController.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
                 $viewHelperManager = $this->viewHelper;
107 107
                 $uploadHandler = $this->uploadHandler;
108 108
 
109
-                if('image' === $formId){
109
+                if ('image' === $formId) {
110 110
                     // handles image upload
111 111
                     $uploadHandler->handleImageUpload($cv, $_FILES['image']);
112 112
                 }
113
-                elseif('attachments' === $formId){
113
+                elseif ('attachments' === $formId) {
114 114
                     // handles attachment upload
115 115
                     $attachment = $uploadHandler->handleAttachmentUpload($cv, $_FILES['attachments']);
116 116
                     $content = $viewHelperManager->get('basepath')
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                         'content' => $content,
121 121
                     ]);
122 122
                 }
123
-                else{
123
+                else {
124 124
                     if (!$form->isValid()) {
125 125
                         return new JsonModel([
126 126
                             'valid' => false,
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -109,8 +109,7 @@  discard block
 block discarded – undo
109 109
                 if('image' === $formId){
110 110
                     // handles image upload
111 111
                     $uploadHandler->handleImageUpload($cv, $_FILES['image']);
112
-                }
113
-                elseif('attachments' === $formId){
112
+                } elseif('attachments' === $formId){
114 113
                     // handles attachment upload
115 114
                     $attachment = $uploadHandler->handleAttachmentUpload($cv, $_FILES['attachments']);
116 115
                     $content = $viewHelperManager->get('basepath')
@@ -119,8 +118,7 @@  discard block
 block discarded – undo
119 118
                         'valid' => true,
120 119
                         'content' => $content,
121 120
                     ]);
122
-                }
123
-                else{
121
+                } else{
124 122
                     if (!$form->isValid()) {
125 123
                         return new JsonModel([
126 124
                             'valid' => false,
Please login to merge, or discard this patch.