Issues (193)

src/Api/Endpoint/ApplicationChargeEndpoint.php (3 issues)

Labels
Severity
1
<?php
2
namespace CodeCloud\Bundle\ShopifyBundle\Api\Endpoint;
3
4
use CodeCloud\Bundle\ShopifyBundle\Api\Request\GetJson;
5
use CodeCloud\Bundle\ShopifyBundle\Api\Request\PostJson;
6
use CodeCloud\Bundle\ShopifyBundle\Api\GenericResource;
7
8
class ApplicationChargeEndpoint extends AbstractEndpoint
9
{
10
    /**
11
     * @param array $query
12
     * @return GenericResource[]
13
     */
14
    public function findAll(array $query = array())
15
    {
16
        $request = new GetJson('/admin/application_charges.json', $query);
17
        $response = $this->send($request);
18
        return $this->createCollection($response->get('application_charges'));
0 ignored issues
show
It seems like $response->get('application_charges') can also be of type string; however, parameter $items of CodeCloud\Bundle\Shopify...int::createCollection() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

18
        return $this->createCollection(/** @scrutinizer ignore-type */ $response->get('application_charges'));
Loading history...
19
    }
20
21
    /**
22
     * @param int $applicationChargeId
23
     * @return GenericResource
24
     */
25
    public function findOne($applicationChargeId)
26
    {
27
        $request = new GetJson('/admin/application_charges/' . $applicationChargeId . '.json');
28
        $response = $this->send($request);
29
        return $this->createEntity($response->get('application_charge'));
0 ignored issues
show
It seems like $response->get('application_charge') can also be of type string; however, parameter $data of CodeCloud\Bundle\Shopify...ndpoint::createEntity() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

29
        return $this->createEntity(/** @scrutinizer ignore-type */ $response->get('application_charge'));
Loading history...
30
    }
31
32
    /**
33
     * @param GenericResource $applicationCharge
34
     * @return GenericResource
35
     */
36
    public function create(GenericResource $applicationCharge)
37
    {
38
        $request = new PostJson('/admin/application_charges.json', array('application_charge' => $applicationCharge->toArray()));
39
        $response = $this->send($request);
40
        return $this->createEntity($response->get('application_charge'));
0 ignored issues
show
It seems like $response->get('application_charge') can also be of type string; however, parameter $data of CodeCloud\Bundle\Shopify...ndpoint::createEntity() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

40
        return $this->createEntity(/** @scrutinizer ignore-type */ $response->get('application_charge'));
Loading history...
41
    }
42
43
    /**
44
     * @param int $applicationChargeId
45
     */
46
    public function activate($applicationChargeId)
47
    {
48
        $request = new PostJson('/admin/application_charges/' . $applicationChargeId . '/activate.json', null);
49
        $this->send($request);
50
    }
51
}
52