Code Duplication    Length = 7-18 lines in 6 locations

Connector/SalesForceClient.php 6 locations

@@ 120-126 (lines=7) @@
117
        return json_decode($response->getBody(), true);
118
    }
119
120
    public function getBasicInformation(string $objectName)
121
    {
122
        $url      = sprintf('%s%s/%s', $this->getBaseUrl(), static::BASE_API_URL, $objectName);
123
        $response = $this->request(HttpWords::GET, $url, $this->getHeaderWithAuthorization());
124
125
        return json_decode($response->getBody(), true);
126
    }
127
128
    public function getDescribedObject(string $objectName)
129
    {
@@ 128-139 (lines=12) @@
125
        return json_decode($response->getBody(), true);
126
    }
127
128
    public function getDescribedObject(string $objectName)
129
    {
130
        $url      = sprintf(
131
            '%s%s/%s/describe',
132
            $this->getBaseUrl(),
133
            static::BASE_API_URL,
134
            $objectName
135
        );
136
        $response = $this->request(HttpWords::GET, $url, $this->getHeaderWithAuthorization());
137
138
        return json_decode($response->getBody(), true);
139
    }
140
141
    public function findById($objectName, $objectId, array $fields = [])
142
    {
@@ 141-154 (lines=14) @@
138
        return json_decode($response->getBody(), true);
139
    }
140
141
    public function findById($objectName, $objectId, array $fields = [])
142
    {
143
        $url      = sprintf(
144
            '%s%s/%s/%s?fields=%s',
145
            $this->getBaseUrl(),
146
            static::BASE_API_URL,
147
            $objectName,
148
            $objectId,
149
            implode(',', $fields)
150
        );
151
        $response = $this->request(HttpWords::GET, $url, $this->getHeaderWithAuthorization());
152
153
        return json_decode($response->getBody(), true);
154
    }
155
156
    public function insert($objectName, array $data = [])
157
    {
@@ 156-162 (lines=7) @@
153
        return json_decode($response->getBody(), true);
154
    }
155
156
    public function insert($objectName, array $data = [])
157
    {
158
        $url      = sprintf('%s%s/%s/', $this->getBaseUrl(), static::BASE_API_URL, $objectName);
159
        $response = $this->request(HttpWords::POST, $url, $this->getHeaderWithAuthorizationAndData($data));
160
161
        return json_decode($response->getBody(), true);
162
    }
163
164
    public function upsertByExternalId(
165
        string $objectName,
@@ 164-181 (lines=18) @@
161
        return json_decode($response->getBody(), true);
162
    }
163
164
    public function upsertByExternalId(
165
        string $objectName,
166
        string $externalIdName,
167
        string $externalIdValue,
168
        array $data = []
169
    ) {
170
        $url      = sprintf(
171
            '%s%s/%s/%s/%s',
172
            $this->getBaseUrl(),
173
            static::BASE_API_URL,
174
            $objectName,
175
            $externalIdName,
176
            $externalIdValue
177
        );
178
        $response = $this->request(HttpWords::PATCH, $url, $this->getHeaderWithAuthorizationAndData($data));
179
180
        return json_decode($response->getBody(), true);
181
    }
182
183
    public function update($objectName, $objectId, $data = [])
184
    {
@@ 183-195 (lines=13) @@
180
        return json_decode($response->getBody(), true);
181
    }
182
183
    public function update($objectName, $objectId, $data = [])
184
    {
185
        $url      = sprintf(
186
            '%s%s/%s/%s',
187
            $this->getBaseUrl(),
188
            static::BASE_API_URL,
189
            $objectName,
190
            $objectId
191
        );
192
        $response = $this->request(HttpWords::PATCH, $url, $this->getHeaderWithAuthorizationAndData($data));
193
194
        return json_decode($response->getBody(), true);
195
    }
196
197
    public function delete($objectName, $objectId)
198
    {