@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function findOrCreate(MigratorInterface $migrator, bool $create = false) |
41 | 41 | { |
42 | - $ob = $this->repo->findOneBy([ |
|
42 | + $ob = $this->repo->findOneBy([ |
|
43 | 43 | 'class' => get_class($migrator) |
44 | 44 | ]); |
45 | 45 | |
46 | - if(is_null($ob) && $create){ |
|
46 | + if (is_null($ob) && $create) { |
|
47 | 47 | $ob = $this->create($migrator); |
48 | 48 | } |
49 | 49 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function migrated(MigratorInterface $migrator): Migration |
69 | 69 | { |
70 | 70 | $migration = $this->findOrCreate($migrator); |
71 | - if(!is_null($migration)){ |
|
71 | + if (!is_null($migration)) { |
|
72 | 72 | $dm = $this->dm; |
73 | 73 | $migration->setMigrated(true); |
74 | 74 | $migration->setMigratedAt(new \DateTime()); |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | $progressBar->start(); |
44 | 44 | |
45 | 45 | $status = true; |
46 | - foreach($col->find() as $current){ |
|
46 | + foreach ($col->find() as $current) { |
|
47 | 47 | $progressBar->advance(); |
48 | 48 | $val = $this->getNamespacedValue('images.images', $current); |
49 | - if(!is_null($val)){ |
|
49 | + if (!is_null($val)) { |
|
50 | 50 | $col->updateOne( |
51 | 51 | ['_id' => $current['_id']], |
52 | 52 | [ |
@@ -65,20 +65,20 @@ discard block |
||
65 | 65 | private function processImages(array $images) |
66 | 66 | { |
67 | 67 | $newImages = []; |
68 | - foreach($images as $image){ |
|
69 | - if(!isset($image['$ref'])){ |
|
68 | + foreach ($images as $image) { |
|
69 | + if (!isset($image['$ref'])) { |
|
70 | 70 | $oid = null; |
71 | - if(is_string($image)){ |
|
71 | + if (is_string($image)) { |
|
72 | 72 | $oid = new ObjectId($image); |
73 | 73 | } |
74 | - if(!is_null($oid)){ |
|
74 | + if (!is_null($oid)) { |
|
75 | 75 | $newImages[] = [ |
76 | 76 | '$ref' => 'organizations.images.files', |
77 | 77 | '$id' => $oid, |
78 | 78 | '_entity' => OrganizationImage::class |
79 | 79 | ]; |
80 | 80 | } |
81 | - }else{ |
|
81 | + } else { |
|
82 | 82 | $image['$ref'] = 'organizations.images.files'; |
83 | 83 | $image['_entity'] = OrganizationImage::class; |
84 | 84 | $newImages[] = $image; |
@@ -78,7 +78,7 @@ |
||
78 | 78 | '_entity' => OrganizationImage::class |
79 | 79 | ]; |
80 | 80 | } |
81 | - }else{ |
|
81 | + } else{ |
|
82 | 82 | $image['$ref'] = 'organizations.images.files'; |
83 | 83 | $image['_entity'] = OrganizationImage::class; |
84 | 84 | $newImages[] = $image; |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | ); |
71 | 71 | |
72 | 72 | $cursor = $bucket->find(); |
73 | - foreach($cursor as $current){ |
|
73 | + foreach ($cursor as $current) { |
|
74 | 74 | $progressBar->advance(); |
75 | - try{ |
|
75 | + try { |
|
76 | 76 | $this->processFile($current['_id']); |
77 | - }catch (\Exception $exception){ |
|
77 | + } catch (\Exception $exception) { |
|
78 | 78 | $progressBar->finish(); |
79 | 79 | throw new MigrationException($exception->getMessage()); |
80 | 80 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | $fcol = $database->selectCollection($bucketName.'.files'); |
95 | 95 | $oldMeta = $fcol->findOne(['_id'=>$fileId]); |
96 | - if(is_null($oldMeta)){ |
|
96 | + if (is_null($oldMeta)) { |
|
97 | 97 | return; |
98 | 98 | } |
99 | 99 | |
@@ -111,17 +111,17 @@ discard block |
||
111 | 111 | $set = []; |
112 | 112 | $unset = []; |
113 | 113 | |
114 | - foreach($metaMap as $from => $to){ |
|
114 | + foreach ($metaMap as $from => $to) { |
|
115 | 115 | $exp = explode('.', $from); |
116 | 116 | $fromKey = $exp[0]; |
117 | 117 | $value = $this->getNamespacedValue($from, $oldMeta); |
118 | - if(isset($oldMeta[$from])){ |
|
118 | + if (isset($oldMeta[$from])) { |
|
119 | 119 | $set[$to] = $value; |
120 | 120 | $unset[$fromKey] = true; |
121 | 121 | } |
122 | 122 | } |
123 | 123 | |
124 | - if(!is_null($oldMeta['name'])){ |
|
124 | + if (!is_null($oldMeta['name'])) { |
|
125 | 125 | $set['metadata.name'] = $oldMeta['name']; |
126 | 126 | } |
127 | 127 | |
@@ -133,20 +133,20 @@ discard block |
||
133 | 133 | 'dateuploaded', |
134 | 134 | 'dateUploaded' |
135 | 135 | ]; |
136 | - foreach($dateMap as $key){ |
|
137 | - if(!is_null($date = $oldMeta[$key])){ |
|
136 | + foreach ($dateMap as $key) { |
|
137 | + if (!is_null($date = $oldMeta[$key])) { |
|
138 | 138 | $set['uploadDate'] = $date; |
139 | 139 | $unset[$key] = true; |
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | - if(!empty($set)){ |
|
143 | + if (!empty($set)) { |
|
144 | 144 | $options['$set'] = $set; |
145 | 145 | } |
146 | - if(!empty($unset)){ |
|
146 | + if (!empty($unset)) { |
|
147 | 147 | $options['$unset'] = $unset; |
148 | 148 | } |
149 | - if(!empty($options)){ |
|
149 | + if (!empty($options)) { |
|
150 | 150 | $fcol->updateOne( |
151 | 151 | ['_id' => $fileId], |
152 | 152 | $options |
@@ -74,7 +74,7 @@ |
||
74 | 74 | $progressBar->advance(); |
75 | 75 | try{ |
76 | 76 | $this->processFile($current['_id']); |
77 | - }catch (\Exception $exception){ |
|
77 | + } catch (\Exception $exception){ |
|
78 | 78 | $progressBar->finish(); |
79 | 79 | throw new MigrationException($exception->getMessage()); |
80 | 80 | } |
@@ -112,13 +112,13 @@ |
||
112 | 112 | public function migrate(): bool |
113 | 113 | { |
114 | 114 | $status = true; |
115 | - foreach($this->processors as $processor){ |
|
116 | - try{ |
|
115 | + foreach ($this->processors as $processor) { |
|
116 | + try { |
|
117 | 117 | $cStat = $processor->process(); |
118 | - }catch (\Exception $exception){ |
|
118 | + } catch (\Exception $exception) { |
|
119 | 119 | $cStat = false; |
120 | 120 | } |
121 | - if(false === $cStat){ |
|
121 | + if (false === $cStat) { |
|
122 | 122 | $status = false; |
123 | 123 | } |
124 | 124 | } |
@@ -115,7 +115,7 @@ |
||
115 | 115 | foreach($this->processors as $processor){ |
116 | 116 | try{ |
117 | 117 | $cStat = $processor->process(); |
118 | - }catch (\Exception $exception){ |
|
118 | + } catch (\Exception $exception){ |
|
119 | 119 | $cStat = false; |
120 | 120 | } |
121 | 121 | if(false === $cStat){ |
@@ -49,11 +49,11 @@ |
||
49 | 49 | public function migrateAction() |
50 | 50 | { |
51 | 51 | $handler = $this->handler; |
52 | - foreach($this->migrators as $migrator){ |
|
52 | + foreach ($this->migrators as $migrator) { |
|
53 | 53 | $status = $handler->findOrCreate($migrator, true); |
54 | - if(!$status->isMigrated()){ |
|
54 | + if (!$status->isMigrated()) { |
|
55 | 55 | $success = $migrator->migrate(); |
56 | - if($success){ |
|
56 | + if ($success) { |
|
57 | 57 | $handler->migrated($migrator); |
58 | 58 | } |
59 | 59 | } |
@@ -20,8 +20,8 @@ |
||
20 | 20 | |
21 | 21 | $value = null; |
22 | 22 | $cSubject = $subject; |
23 | - foreach($exp as $name){ |
|
24 | - if(array_key_exists($name, $cSubject)){ |
|
23 | + foreach ($exp as $name) { |
|
24 | + if (array_key_exists($name, $cSubject)) { |
|
25 | 25 | $value = $cSubject[$name]; |
26 | 26 | $cSubject = $cSubject[$name]; |
27 | 27 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ->willReturn($jobRepo); |
42 | 42 | $event->expects($this->exactly(2)) |
43 | 43 | ->method('getParam') |
44 | - ->withConsecutive(['days',80],['limit', 0]) |
|
44 | + ->withConsecutive(['days', 80], ['limit', 0]) |
|
45 | 45 | ->willReturnOnConsecutiveCalls(30, 10) |
46 | 46 | ; |
47 | 47 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | { |
67 | 67 | $title = 'Test Expired Job'; |
68 | 68 | $job = $repo->findOneBy(['title' => $title]); |
69 | - if(!$job instanceof JobEntity){ |
|
70 | - $job = $repo->create(['title' => $title],true); |
|
69 | + if (!$job instanceof JobEntity) { |
|
70 | + $job = $repo->create(['title' => $title], true); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $job; |
@@ -67,7 +67,7 @@ |
||
67 | 67 | foreach ($this->repository->getUserJobs($user->getId(), $limit) as $job) |
68 | 68 | { |
69 | 69 | $title = $job->getTitle() ?: $view->translate('untitled'); |
70 | - $title .= ' ('. $view->dateFormat($job->getDateCreated(), 'short', 'none') . ')'; |
|
70 | + $title .= ' ('.$view->dateFormat($job->getDateCreated(), 'short', 'none').')'; |
|
71 | 71 | $url = $view->url('lang/jobs/manage', ['action' => 'edit'], [ |
72 | 72 | 'query' => [ |
73 | 73 | 'id' => $job->getId() |
@@ -203,7 +203,7 @@ |
||
203 | 203 | * |
204 | 204 | * @return UserInterface|null $user |
205 | 205 | */ |
206 | - public function getUser() ; |
|
206 | + public function getUser(); |
|
207 | 207 | |
208 | 208 | /** |
209 | 209 | * Gets the link to the application form |