@@ -32,6 +32,6 @@ |
||
32 | 32 | */ |
33 | 33 | public function getUri(): string |
34 | 34 | { |
35 | - return "/file/Cv.ContactImage/" . $this->id . "/" .urlencode($this->name); |
|
35 | + return "/file/Cv.ContactImage/".$this->id."/".urlencode($this->name); |
|
36 | 36 | } |
37 | 37 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | $this->addFilter( |
24 | 24 | 'ignoreInternalProperties', |
25 | - function ($property) { |
|
25 | + function($property) { |
|
26 | 26 | return "_" != $property[0]; |
27 | 27 | } |
28 | 28 | ); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | if (!$this->filterComposite->filter($propertyName)) { |
43 | 43 | continue; |
44 | 44 | } |
45 | - $getter = 'get' . ucfirst($propertyName); |
|
45 | + $getter = 'get'.ucfirst($propertyName); |
|
46 | 46 | $value = method_exists($object, $getter) |
47 | 47 | ? $object->$getter() |
48 | 48 | : $property->getValue($object); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | foreach ($data as $key => $value) { |
65 | 65 | if (isset($reflProperties[$key])) { |
66 | 66 | $value = $this->hydrateValue($key, $value); |
67 | - $setter = 'set' . ucfirst($key); |
|
67 | + $setter = 'set'.ucfirst($key); |
|
68 | 68 | if (method_exists($object, $setter)) { |
69 | 69 | $object->$setter($value); |
70 | 70 | } else { |
@@ -21,7 +21,7 @@ |
||
21 | 21 | $ob = $handler->findOrCreate(new TestMigrator(), false); |
22 | 22 | $dm = $this->getDoctrine(); |
23 | 23 | |
24 | - if(!is_null($ob)){ |
|
24 | + if (!is_null($ob)) { |
|
25 | 25 | $dm->remove($ob); |
26 | 26 | $dm->flush(); |
27 | 27 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | |
58 | 58 | $bucket = $this->getBucket('test'); |
59 | 59 | $cursor = $bucket->find(); |
60 | - foreach($cursor as $current){ |
|
60 | + foreach ($cursor as $current) { |
|
61 | 61 | $this->assertFileMigrated($current); |
62 | 62 | } |
63 | 63 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | ], |
20 | 20 | ], |
21 | 21 | 'annotation' => [ |
22 | - 'paths' => [ __DIR__ . '/../src/Entity'], |
|
22 | + 'paths' => [__DIR__.'/../src/Entity'], |
|
23 | 23 | ], |
24 | 24 | ] |
25 | 25 | ], |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | 'factories' => [ |
33 | 33 | Migrator36::class => [Migrator36::class, 'factory'], |
34 | 34 | MigrationHandler::class => [MigrationHandler::class, 'factory'], |
35 | - OutputInterface::class => function(){ |
|
35 | + OutputInterface::class => function() { |
|
36 | 36 | return new ConsoleOutput(); |
37 | 37 | } |
38 | 38 | ] |
@@ -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){ |