@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $name = "\\$namespace\\Entity\\$entityName"; |
39 | 39 | } |
40 | 40 | |
41 | - $repository = $this->dm->getRepository($name); |
|
41 | + $repository = $this->dm->getRepository($name); |
|
42 | 42 | |
43 | 43 | if (!$repository instanceof AbstractRepository) { |
44 | 44 | $eventArgs = new DoctrineMongoODM\Event\EventArgs( |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function flush($entity = null, array $options = array()) |
68 | 68 | { |
69 | - if(!is_null($entity)){ |
|
69 | + if (!is_null($entity)) { |
|
70 | 70 | $this->dm->persist($entity); |
71 | 71 | $this->dm->flush(); |
72 | 72 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | && $events->dispatchEvent('postCommit', new EventArgs(array('document' => $entity, 'documentManager' => $this->dm))); |
76 | 76 | } |
77 | 77 | |
78 | - public function remove(EntityInterface $entity, $flush=false) |
|
78 | + public function remove(EntityInterface $entity, $flush = false) |
|
79 | 79 | { |
80 | 80 | $dm = $this->dm; |
81 | 81 | $events = $dm->getEventManager(); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->queryBuilder = $queryBuilder; |
38 | 38 | |
39 | 39 | // skip count during tests |
40 | - if(!is_null($filtered)){ |
|
40 | + if (!is_null($filtered)) { |
|
41 | 41 | $this->queryBuilder = $filtered; |
42 | 42 | $this->totalItem = (clone $filtered)->count()->getQuery()->execute(); |
43 | 43 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $qb = $this->queryBuilder; |
51 | 51 | $qb->skip($offset)->limit($itemCountPerPage); |
52 | 52 | return $qb->getQuery()->toArray(); |
53 | - }catch (\Exception $e){ |
|
53 | + } catch (\Exception $e) { |
|
54 | 54 | throw $e; |
55 | 55 | } |
56 | 56 | } |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | { |
82 | 82 | $repo = $this->getRepository($entityClass); |
83 | 83 | |
84 | - if(UserImage::class !== $entityClass && is_null($metadata->getUser())){ |
|
84 | + if (UserImage::class !== $entityClass && is_null($metadata->getUser())) { |
|
85 | 85 | $user = $this->auth->getUser(); |
86 | 86 | |
87 | - if($user instanceof AnonymousUser){ |
|
87 | + if ($user instanceof AnonymousUser) { |
|
88 | 88 | $metadata->getPermissions()->grant($user, PermissionsInterface::PERMISSION_ALL); |
89 | - }else{ |
|
89 | + } else { |
|
90 | 90 | $this->dm->getUnitOfWork()->registerManaged($user, $user->getId(), []); |
91 | 91 | |
92 | 92 | $metadata->setUser($user); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $events->hasListeners('postRemoveEntity') && |
127 | 127 | $events->dispatchEvent('postRemoveEntity', new LifecycleEventArgs($file, $dm)); |
128 | 128 | |
129 | - if($andFlush){ |
|
129 | + if ($andFlush) { |
|
130 | 130 | $dm->flush(); |
131 | 131 | } |
132 | 132 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | list($module, $entityName) = explode('.', $fileStoreName); |
76 | 76 | $response = $this->getResponse(); |
77 | 77 | $fileManager = $this->fileManager; |
78 | - $entityClass = $module . '\\Entity\\' . $entityName; |
|
78 | + $entityClass = $module.'\\Entity\\'.$entityName; |
|
79 | 79 | $fileId = $this->params('fileId', 0); |
80 | 80 | |
81 | 81 | if (preg_match('/^(.*)\..*$/', $fileId, $baseFileName)) { |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | $events = $this->coreFileEvents; |
150 | 150 | $event = $events->getEvent(FileEvent::EVENT_DELETE, $this, ['file' => $file]); |
151 | 151 | |
152 | - $results = $events->triggerEventUntil(function ($r) { |
|
152 | + $results = $events->triggerEventUntil(function($r) { |
|
153 | 153 | return true === $r; |
154 | 154 | }, $event); |
155 | 155 | |
156 | - if(true !== $results->last()){ |
|
156 | + if (true !== $results->last()) { |
|
157 | 157 | $this->fileManager->remove($file, true); |
158 | 158 | } |
159 | 159 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | protected function setUp(): void |
42 | 42 | { |
43 | 43 | $this->target = $this->getMockBuilder('\Core\Factory\EventManager\EventManagerAbstractFactory') |
44 | - ->setMethods([ 'attachListeners', 'getConfig' ]) |
|
44 | + ->setMethods(['attachListeners', 'getConfig']) |
|
45 | 45 | ->getMock(); |
46 | 46 | } |
47 | 47 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $config['listeners'] = []; |
55 | 55 | } |
56 | 56 | if (!isset($config['identifiers'])) { |
57 | - $config['identifiers'] = [ 'Test/Events/Manager' ]; |
|
57 | + $config['identifiers'] = ['Test/Events/Manager']; |
|
58 | 58 | } |
59 | 59 | if (!isset($config['event'])) { |
60 | 60 | $config['event'] = '\Laminas\EventManager\Event'; |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | $eventsService = 'Test/Events/Manager'; |
83 | 83 | } |
84 | 84 | |
85 | - $hasMap = [ [ $eventsService, true ] ]; |
|
86 | - $getMap = [ [ $eventsService, $events ] ]; |
|
87 | - $buildMap = [ [ $eventsService, null, $events ] ]; |
|
85 | + $hasMap = [[$eventsService, true]]; |
|
86 | + $getMap = [[$eventsService, $events]]; |
|
87 | + $buildMap = [[$eventsService, null, $events]]; |
|
88 | 88 | |
89 | 89 | foreach ($args as $serviceName => $serviceValue) { |
90 | 90 | if (false === $serviceValue) { |
91 | - $hasMap[] = [ $serviceName, true ]; |
|
91 | + $hasMap[] = [$serviceName, true]; |
|
92 | 92 | } else { |
93 | 93 | if (is_array($serviceValue)) { |
94 | 94 | $serviceOptions = $serviceValu1[1] ?? null; |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | } else { |
97 | 97 | $serviceOptions = null; |
98 | 98 | } |
99 | - $hasMap[] = [ $serviceName, true]; |
|
100 | - $getMap[] = [ $serviceName, $serviceValue ]; |
|
101 | - $buildMap[] = [ $serviceName, $serviceOptions, $serviceValue ]; |
|
99 | + $hasMap[] = [$serviceName, true]; |
|
100 | + $getMap[] = [$serviceName, $serviceValue]; |
|
101 | + $buildMap[] = [$serviceName, $serviceOptions, $serviceValue]; |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | $services->setFactory('Test/Events/Manager', $factory); |
139 | 139 | |
140 | - $this->setTargetConfig([ 'service' => 'Test/Events/Manager', 'configure' => false, 'listeners' => []]); |
|
140 | + $this->setTargetConfig(['service' => 'Test/Events/Manager', 'configure' => false, 'listeners' => []]); |
|
141 | 141 | |
142 | 142 | $this->target->expects($this->once())->method('attachListeners')->with($services, $events, []); |
143 | 143 | $this->target->createServiceWithName($services, 'irrelevant', 'Test/Events'); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | public function testInstatiatesEventManagerFromClassName() |
147 | 147 | { |
148 | - $this->setTargetConfig([ 'service' => '\Laminas\EventManager\EventManager', 'configure' => false, 'listeners' => []]); |
|
148 | + $this->setTargetConfig(['service' => '\Laminas\EventManager\EventManager', 'configure' => false, 'listeners' => []]); |
|
149 | 149 | |
150 | 150 | $services = new ServiceManager(); |
151 | 151 | $events = $this->target->createServiceWithName($services, 'irrelevant', 'irrelevant'); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $this->expectException(\UnexpectedValueException::class); |
159 | 159 | $this->expectExceptionMessage('Cannot create'); |
160 | 160 | |
161 | - $this->setTargetConfig(['service' => 'NonExistantClass' ]); |
|
161 | + $this->setTargetConfig(['service' => 'NonExistantClass']); |
|
162 | 162 | |
163 | 163 | $this->target->createServiceWithName(new ServiceManager(), 'irrelevant', 'irrelevant'); |
164 | 164 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | public function testSetsIdentifiersOnEventManagerInstance() |
175 | 175 | { |
176 | - $ids = [ 'testID', 'TestId2' ]; |
|
176 | + $ids = ['testID', 'TestId2']; |
|
177 | 177 | $events = new EventManager(); |
178 | 178 | $services = $this->getServiceManagerMock(['EventManager' => $events]); |
179 | 179 | $this->setTargetConfig(['configure' => true, 'identifiers' => $ids, 'service' => 'EventManager']); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | ->with($event) |
195 | 195 | ; |
196 | 196 | |
197 | - $services = $this->getServiceManagerMock(['EventManager' => $events], [ 'Event' => $event ]); |
|
197 | + $services = $this->getServiceManagerMock(['EventManager' => $events], ['Event' => $event]); |
|
198 | 198 | $this->setTargetConfig(['configure' => true, 'service' => 'EventManager', 'event' => 'Event']); |
199 | 199 | $this->target->createServiceWithName($services, 'irrelevant', 'Test/Events'); |
200 | 200 | } |