@@ -58,34 +58,34 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $data = null; |
| 60 | 60 | |
| 61 | - if (isset($eventData['data']) === true) { |
|
| 61 | + if (isset($eventData[ 'data' ]) === true) { |
|
| 62 | 62 | Assert::keyExists($eventData, 'datacontenttype'); |
| 63 | 63 | Assert::keyExists($eventData, 'datacontentencoding'); |
| 64 | 64 | |
| 65 | 65 | $data = JsonData::fromArray( |
| 66 | - $eventData['data'], |
|
| 67 | - new ContentEncoding($eventData['datacontentencoding']) |
|
| 66 | + $eventData[ 'data' ], |
|
| 67 | + new ContentEncoding($eventData[ 'datacontentencoding' ]) |
|
| 68 | 68 | ); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $extensions = null; |
| 72 | 72 | |
| 73 | - if (isset($eventData['DistributedTracingExtension']) === true) { |
|
| 73 | + if (isset($eventData[ 'DistributedTracingExtension' ]) === true) { |
|
| 74 | 74 | $extensions = new Extensions( |
| 75 | 75 | new DistributedTracing( |
| 76 | - $eventData['DistributedTracingExtension']['traceparent'], |
|
| 77 | - $eventData['DistributedTracingExtension']['tracestate'], |
|
| 76 | + $eventData[ 'DistributedTracingExtension' ][ 'traceparent' ], |
|
| 77 | + $eventData[ 'DistributedTracingExtension' ][ 'tracestate' ], |
|
| 78 | 78 | ) |
| 79 | 79 | ); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | return new self( |
| 83 | - new EventId($eventData['id']), |
|
| 84 | - new Source(Uri::createFromString($eventData['source'])), |
|
| 85 | - new EventType($eventData['type']), |
|
| 86 | - isset($eventData['schemaurl']) ? new SchemaUrl(Uri::createFromString($eventData['schemaurl'])) : null, |
|
| 87 | - isset($eventData['subject']) ? new Subject($eventData['subject']) : null, |
|
| 88 | - isset($eventData['time']) ? new EventTime(new DateTimeImmutable($eventData['time'])) : null, |
|
| 83 | + new EventId($eventData[ 'id' ]), |
|
| 84 | + new Source(Uri::createFromString($eventData[ 'source' ])), |
|
| 85 | + new EventType($eventData[ 'type' ]), |
|
| 86 | + isset($eventData[ 'schemaurl' ]) ? new SchemaUrl(Uri::createFromString($eventData[ 'schemaurl' ])) : null, |
|
| 87 | + isset($eventData[ 'subject' ]) ? new Subject($eventData[ 'subject' ]) : null, |
|
| 88 | + isset($eventData[ 'time' ]) ? new EventTime(new DateTimeImmutable($eventData[ 'time' ])) : null, |
|
| 89 | 89 | $extensions, |
| 90 | 90 | $data |
| 91 | 91 | ); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | public function toArray() : array |
| 140 | 140 | { |
| 141 | - $extensions = []; |
|
| 141 | + $extensions = [ ]; |
|
| 142 | 142 | |
| 143 | 143 | if ($this->extensions !== null) { |
| 144 | 144 | $extensions = $this->extensions->getKeyValuePairs(); |
@@ -146,15 +146,15 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | return array_merge( |
| 148 | 148 | [ |
| 149 | - 'specversion' => (string)$this->specVersion, |
|
| 150 | - 'type' => (string)$this->eventType, |
|
| 151 | - 'source' => (string)$this->source, |
|
| 152 | - 'subject' => $this->subject ? (string)$this->subject : null, |
|
| 153 | - 'id' => (string)$this->eventId, |
|
| 154 | - 'schemaurl' => $this->schemaUrl ? (string)$this->schemaUrl : null, |
|
| 155 | - 'time' => $this->data ? (string)$this->eventTime : null, |
|
| 156 | - 'datacontenttype' => $this->data ? (string)$this->data->getContentType() : null, |
|
| 157 | - 'datacontentencoding' => $this->data ? (string)$this->data->getContentEncoding() : null, |
|
| 149 | + 'specversion' => (string) $this->specVersion, |
|
| 150 | + 'type' => (string) $this->eventType, |
|
| 151 | + 'source' => (string) $this->source, |
|
| 152 | + 'subject' => $this->subject ? (string) $this->subject : null, |
|
| 153 | + 'id' => (string) $this->eventId, |
|
| 154 | + 'schemaurl' => $this->schemaUrl ? (string) $this->schemaUrl : null, |
|
| 155 | + 'time' => $this->data ? (string) $this->eventTime : null, |
|
| 156 | + 'datacontenttype' => $this->data ? (string) $this->data->getContentType() : null, |
|
| 157 | + 'datacontentencoding' => $this->data ? (string) $this->data->getContentEncoding() : null, |
|
| 158 | 158 | 'data' => $this->data ? $this->data->getData() : null, |
| 159 | 159 | ], |
| 160 | 160 | $extensions |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | { |
| 15 | 15 | Assert::notWhitespaceOnly($value); |
| 16 | 16 | |
| 17 | - $this->value = $value; |
|
| 17 | + $this->value = $value; |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | public function __toString() : string |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | { |
| 28 | 28 | return array_merge( |
| 29 | 29 | ...array_map( |
| 30 | - function (Extension $extension) : array { |
|
| 30 | + function(Extension $extension) : array { |
|
| 31 | 31 | return $extension->toArray(); |
| 32 | 32 | }, |
| 33 | 33 | $this->listOfExtensions |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | return json_encode( |
| 14 | 14 | array_filter( |
| 15 | 15 | $cloudEvent->toArray(), |
| 16 | - function ($value) { |
|
| 16 | + function($value) { |
|
| 17 | 17 | return null !== $value; |
| 18 | 18 | } |
| 19 | 19 | ), |