Skip to content

Commit ea6dac3

Browse files
rodrigoaguileraflavioheleno
authored andcommitted
Fix #16: Patches not applied in latest version.
1 parent 909c215 commit ea6dac3

File tree

2 files changed

+62
-23
lines changed

2 files changed

+62
-23
lines changed
Lines changed: 54 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,57 @@
1+
diff --git a/patches/NetworkSettingsNormalizer.patch b/patches/NetworkSettingsNormalizer.patch
2+
index 509cd29..e69de29 100644
3+
--- a/patches/NetworkSettingsNormalizer.patch
4+
+++ b/patches/NetworkSettingsNormalizer.patch
5+
@@ -1,26 +0,0 @@
6+
-diff --git a/src/Normalizer/NetworkSettingsNormalizer.php b/src/Normalizer/NetworkSettingsNormalizer.php
7+
-index dc48cc5..a3cb884 100644
8+
---- a/src/Normalizer/NetworkSettingsNormalizer.php
9+
-+++ b/src/Normalizer/NetworkSettingsNormalizer.php
10+
-@@ -79,6 +79,10 @@ class NetworkSettingsNormalizer implements DenormalizerInterface, NormalizerInte
11+
- if (\array_key_exists('Ports', $data) && $data['Ports'] !== null) {
12+
- $values = new \ArrayObject(array(), \ArrayObject::ARRAY_AS_PROPS);
13+
- foreach ($data['Ports'] as $key => $value) {
14+
-+ if ($value === null) {
15+
-+ $values[$key] = null;
16+
-+ continue;
17+
-+ }
18+
- $values_1 = array();
19+
- foreach ($value as $value_1) {
20+
- $values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context);
21+
-@@ -218,6 +222,10 @@ class NetworkSettingsNormalizer implements DenormalizerInterface, NormalizerInte
22+
- if ($object->isInitialized('ports') && null !== $object->getPorts()) {
23+
- $values = array();
24+
- foreach ($object->getPorts() as $key => $value) {
25+
-+ if ($value === null) {
26+
-+ $values[$key] = null;
27+
-+ continue;
28+
-+ }
29+
- $values_1 = array();
30+
- foreach ($value as $value_1) {
31+
- $values_1[] = $this->normalizer->normalize($value_1, 'json', $context);
132
diff --git a/src/Normalizer/NetworkSettingsNormalizer.php b/src/Normalizer/NetworkSettingsNormalizer.php
2-
index dc48cc5..a3cb884 100644
33+
index 0c73d7f..a3c893a 100644
334
--- a/src/Normalizer/NetworkSettingsNormalizer.php
435
+++ b/src/Normalizer/NetworkSettingsNormalizer.php
5-
@@ -79,6 +79,10 @@ class NetworkSettingsNormalizer implements DenormalizerInterface, NormalizerInte
6-
if (\array_key_exists('Ports', $data) && $data['Ports'] !== null) {
7-
$values = new \ArrayObject(array(), \ArrayObject::ARRAY_AS_PROPS);
8-
foreach ($data['Ports'] as $key => $value) {
9-
+ if ($value === null) {
10-
+ $values[$key] = null;
11-
+ continue;
12-
+ }
13-
$values_1 = array();
14-
foreach ($value as $value_1) {
15-
$values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context);
16-
@@ -218,6 +222,10 @@ class NetworkSettingsNormalizer implements DenormalizerInterface, NormalizerInte
17-
if ($object->isInitialized('ports') && null !== $object->getPorts()) {
18-
$values = array();
19-
foreach ($object->getPorts() as $key => $value) {
20-
+ if ($value === null) {
21-
+ $values[$key] = null;
22-
+ continue;
23-
+ }
24-
$values_1 = array();
25-
foreach ($value as $value_1) {
26-
$values_1[] = $this->normalizer->normalize($value_1, 'json', $context);
36+
@@ -78,6 +78,10 @@ if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR
37+
if (\array_key_exists('Ports', $data) && null !== $data['Ports']) {
38+
$values = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
39+
foreach ($data['Ports'] as $key => $value) {
40+
+ if ($value === null) {
41+
+ $values[$key] = null;
42+
+ continue;
43+
+ }
44+
$values_1 = [];
45+
foreach ($value as $value_1) {
46+
$values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context);
47+
@@ -203,6 +207,10 @@ if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR
48+
if ($object->isInitialized('ports') && null !== $object->getPorts()) {
49+
$values = [];
50+
foreach ($object->getPorts() as $key => $value) {
51+
+ if ($value === null) {
52+
+ $values[$key] = null;
53+
+ continue;
54+
+ }
55+
$values_1 = [];
56+
foreach ($value as $value_1) {
57+
$values_1[] = $this->normalizer->normalize($value_1, 'json', $context);

src/Normalizer/NetworkSettingsNormalizer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a
7878
if (\array_key_exists('Ports', $data) && null !== $data['Ports']) {
7979
$values = new \ArrayObject([], \ArrayObject::ARRAY_AS_PROPS);
8080
foreach ($data['Ports'] as $key => $value) {
81+
if ($value === null) {
82+
$values[$key] = null;
83+
continue;
84+
}
8185
$values_1 = [];
8286
foreach ($value as $value_1) {
8387
$values_1[] = $this->denormalizer->denormalize($value_1, 'Docker\\API\\Model\\PortBinding', 'json', $context);
@@ -203,6 +207,10 @@ public function normalize(mixed $object, ?string $format = null, array $context
203207
if ($object->isInitialized('ports') && null !== $object->getPorts()) {
204208
$values = [];
205209
foreach ($object->getPorts() as $key => $value) {
210+
if ($value === null) {
211+
$values[$key] = null;
212+
continue;
213+
}
206214
$values_1 = [];
207215
foreach ($value as $value_1) {
208216
$values_1[] = $this->normalizer->normalize($value_1, 'json', $context);

0 commit comments

Comments
 (0)