Code Duplication    Length = 7-9 lines in 3 locations

src/RequestLocation/JsonLocation.php 1 location

@@ 70-76 (lines=7) @@
67
68
        // Add additional parameters to the JSON document
69
        $additional = $operation->getAdditionalParameters();
70
        if ($additional && ($additional->getLocation() === $this->locationName)) {
71
            foreach ($command->toArray() as $key => $value) {
72
                if (!$operation->hasParam($key)) {
73
                    $data[$key] = $this->prepareValue($value, $additional);
74
                }
75
            }
76
        }
77
78
        // Don't overwrite the Content-Type if one is set
79
        if ($this->jsonContentType && !$request->hasHeader('Content-Type')) {

src/RequestLocation/XmlLocation.php 1 location

@@ 83-91 (lines=9) @@
80
        $this->buffered = [];
81
82
        $additional = $operation->getAdditionalParameters();
83
        if ($additional && $additional->getLocation() == $this->locationName) {
84
            foreach ($command->toArray() as $key => $value) {
85
                if (!$operation->hasParam($key)) {
86
                    $additional->setName($key);
87
                    $this->visitWithValue($value, $additional, $operation);
88
                }
89
            }
90
            $additional->setName(null);
91
        }
92
93
        // If data was found that needs to be serialized, then do so
94
        $xml = '';

src/RequestLocation/HeaderLocation.php 1 location

@@ 57-63 (lines=7) @@
54
    ) {
55
        /** @var Parameter $additional */
56
        $additional = $operation->getAdditionalParameters();
57
        if ($additional && ($additional->getLocation() === $this->locationName)) {
58
            foreach ($command->toArray() as $key => $value) {
59
                if (!$operation->hasParam($key)) {
60
                    $request = $request->withHeader($key, $additional->filter($value));
61
                }
62
            }
63
        }
64
65
        return $request;
66
    }