PutJson   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 3
1
<?php
2
namespace CodeCloud\Bundle\ShopifyBundle\Api\Request;
3
4
use GuzzleHttp\Psr7\Request;
5
6
class PutJson extends Request
7
{
8
    /**
9
     * @param string $url
10
     * @param array|string $postData
11
     * @param array $headers
12
     */
13
    public function __construct($url, $postData = null, array $headers = array())
14
    {
15
        if ($postData !== null) {
16
            $postData = json_encode($postData, JSON_PRETTY_PRINT);
17
        }
18
19
        if (!empty($params)) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $params seems to never exist and therefore empty should always be true.
Loading history...
20
            $url .= '?'.http_build_query($params);
21
        }
22
23
        $headers = [
24
            'Content-Type' => 'application/json',
25
            'Accept' => 'application/json',
26
        ];
27
28
        parent::__construct('PUT', $url, $headers, $postData);
29
    }
30
}
31