@@ -106,11 +106,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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)]); |
@@ -29,7 +29,7 @@ |
||
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 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @see \Core\Repository\AbstractRepository::create() |
103 | 103 | * @return UserInterface |
104 | 104 | */ |
105 | - public function create(array $data = null, $persist=false) |
|
105 | + public function create(array $data = null, $persist = false) |
|
106 | 106 | { |
107 | 107 | $entity = parent::create($data); |
108 | 108 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function findByProfileIdentifier($identifier, $provider, array $options = []) |
126 | 126 | { |
127 | - return $this->findOneBy(array('profiles.' . $provider . '.auth.identifier' => $identifier), $options) ?: $this->findOneBy(array('profile.identifier' => $identifier), $options); |
|
127 | + return $this->findOneBy(array('profiles.'.$provider.'.auth.identifier' => $identifier), $options) ?: $this->findOneBy(array('profile.identifier' => $identifier), $options); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $qb->field('_id')->notEqual($curentUserId) |
142 | 142 | ->addAnd( |
143 | 143 | $qb->expr() |
144 | - ->addOr($qb->expr()->field('profiles.' . $provider . '.auth.identifier' )->equals($identifier)) |
|
144 | + ->addOr($qb->expr()->field('profiles.'.$provider.'.auth.identifier')->equals($identifier)) |
|
145 | 145 | ->addOr($qb->expr()->field('profile.identifier')->equals($identifier)) |
146 | 146 | ); |
147 | 147 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | return $this->findOneBy( |
198 | 198 | array( |
199 | 199 | '$or' => array( |
200 | - array('login' => $identity . $suffix), |
|
200 | + array('login' => $identity.$suffix), |
|
201 | 201 | array('info.email' => $identity) |
202 | 202 | ) |
203 | 203 | ) |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | public function findByQuery($query) |
247 | 247 | { |
248 | 248 | $qb = $this->createQueryBuilder(); |
249 | - $parts = explode(' ', trim($query)); |
|
249 | + $parts = explode(' ', trim($query)); |
|
250 | 250 | |
251 | 251 | foreach ($parts as $q) { |
252 | - $regex = new Regex('/^' . $query . '/i'); |
|
252 | + $regex = new Regex('/^'.$query.'/i'); |
|
253 | 253 | $qb->addOr($qb->expr()->field('info.firstName')->equals($regex)); |
254 | 254 | $qb->addOr($qb->expr()->field('info.lastName')->equals($regex)); |
255 | 255 | $qb->addOr($qb->expr()->field('info.email')->equals($regex)); |
@@ -51,9 +51,9 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -29,17 +29,17 @@ |
||
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 | } |
@@ -43,10 +43,10 @@ |
||
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() |
@@ -43,12 +43,12 @@ |
||
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 | /* |
@@ -39,7 +39,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -165,7 +165,7 @@ |
||
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(); |