@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Basster\ElasticaLoggable\Entity; |
| 5 | 5 | |
@@ -39,17 +39,17 @@ discard block |
||
| 39 | 39 | public function getData() |
| 40 | 40 | { |
| 41 | 41 | $changed = parent::getData(); |
| 42 | - $data = []; |
|
| 42 | + $data = [ ]; |
|
| 43 | 43 | |
| 44 | 44 | if ($changed) { // is null during deletions |
| 45 | 45 | foreach ($changed as $property => $value) { |
| 46 | - $data[$property] = [ |
|
| 46 | + $data[ $property ] = [ |
|
| 47 | 47 | 'from' => null, |
| 48 | 48 | 'to' => $value, |
| 49 | 49 | ]; |
| 50 | 50 | |
| 51 | 51 | if (array_key_exists($property, $this->changeSet)) { |
| 52 | - $data[$property]['from'] = $this->changeSet[$property][self::OLD_INDEX]; |
|
| 52 | + $data[ $property ][ 'from' ] = $this->changeSet[ $property ][ self::OLD_INDEX ]; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace Basster\ElasticaLoggable\Listener; |
| 5 | 5 | |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | parent::__construct(); |
| 34 | 34 | $this->type = $type; |
| 35 | - $this->activities = []; |
|
| 35 | + $this->activities = [ ]; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function getSubscribedEvents(): array |
| 39 | 39 | { |
| 40 | 40 | $subscribedEvents = parent::getSubscribedEvents(); |
| 41 | - $subscribedEvents[] = 'postFlush'; |
|
| 41 | + $subscribedEvents[ ] = 'postFlush'; |
|
| 42 | 42 | |
| 43 | 43 | return $subscribedEvents; |
| 44 | 44 | } |
@@ -73,26 +73,26 @@ discard block |
||
| 73 | 73 | $wrapped = AbstractWrapper::wrap($object, $om); |
| 74 | 74 | |
| 75 | 75 | /** @var Activity $logEntry */ |
| 76 | - $logEntry = $this->pendingLogEntryInserts[$oid]; |
|
| 76 | + $logEntry = $this->pendingLogEntryInserts[ $oid ]; |
|
| 77 | 77 | |
| 78 | 78 | $id = $wrapped->getIdentifier(); |
| 79 | 79 | $logEntry->setObjectId($id); |
| 80 | 80 | $ea->setOriginalObjectProperty($uow, spl_object_hash($logEntry), 'objectId', $id); |
| 81 | - unset($this->pendingLogEntryInserts[$oid]); |
|
| 81 | + unset($this->pendingLogEntryInserts[ $oid ]); |
|
| 82 | 82 | } |
| 83 | 83 | if ($this->pendingRelatedObjects && array_key_exists($oid, $this->pendingRelatedObjects)) { |
| 84 | 84 | $wrapped = AbstractWrapper::wrap($object, $om); |
| 85 | 85 | $identifiers = $wrapped->getIdentifier(false); |
| 86 | - foreach ($this->pendingRelatedObjects[$oid] as $props) { |
|
| 86 | + foreach ($this->pendingRelatedObjects[ $oid ] as $props) { |
|
| 87 | 87 | /** @var Activity $logEntry */ |
| 88 | - $logEntry = $props['log']; |
|
| 89 | - $data[$props['field']] = $identifiers; |
|
| 88 | + $logEntry = $props[ 'log' ]; |
|
| 89 | + $data[ $props[ 'field' ] ] = $identifiers; |
|
| 90 | 90 | |
| 91 | 91 | $logEntry->setData($data); |
| 92 | 92 | |
| 93 | 93 | $ea->setOriginalObjectProperty($uow, spl_object_hash($logEntry), 'data', $data); |
| 94 | 94 | } |
| 95 | - unset($this->pendingRelatedObjects[$oid]); |
|
| 95 | + unset($this->pendingRelatedObjects[ $oid ]); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
@@ -117,12 +117,12 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | // check for the availability of the primary key |
| 119 | 119 | if (self::ACTION_CREATE === $action && $ea->isPostInsertGenerator($meta)) { |
| 120 | - $this->pendingLogEntryInserts[spl_object_hash($object)] = $logEntry; |
|
| 120 | + $this->pendingLogEntryInserts[ spl_object_hash($object) ] = $logEntry; |
|
| 121 | 121 | } else { |
| 122 | 122 | $logEntry->setObjectId($wrapped->getIdentifier()); |
| 123 | 123 | } |
| 124 | - $newValues = []; |
|
| 125 | - if (self::ACTION_REMOVE !== $action && isset($config['versioned'])) { |
|
| 124 | + $newValues = [ ]; |
|
| 125 | + if (self::ACTION_REMOVE !== $action && isset($config[ 'versioned' ])) { |
|
| 126 | 126 | $logEntry->setChangeSet($ea->getObjectChangeSet($om->getUnitOfWork(), $object)); |
| 127 | 127 | $newValues = $this->getObjectChangeSetData($ea, $object, $logEntry); |
| 128 | 128 | $logEntry->setData($newValues); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | private function store(Activity $activity) |
| 146 | 146 | { |
| 147 | - $this->activities[] = $activity; |
|
| 147 | + $this->activities[ ] = $activity; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | private function persist(Activity $logEntry) |