Issues (193)

src/Api/Endpoint/CarrierServiceEndpoint.php (4 issues)

Labels
Severity
1
<?php
2
namespace CodeCloud\Bundle\ShopifyBundle\Api\Endpoint;
3
4
use CodeCloud\Bundle\ShopifyBundle\Api\Request\DeleteParams;
5
use CodeCloud\Bundle\ShopifyBundle\Api\Request\GetJson;
6
use CodeCloud\Bundle\ShopifyBundle\Api\Request\PostJson;
7
use CodeCloud\Bundle\ShopifyBundle\Api\GenericResource;
8
9
class CarrierServiceEndpoint extends AbstractEndpoint
10
{
11
    /**
12
     * @return array|GenericResource[]
13
     */
14
    public function findAll()
15
    {
16
        $request = new GetJson('/admin/carrier_services.json');
17
        $response = $this->send($request);
18
        return $this->createCollection($response->get('carrier_services'));
0 ignored issues
show
It seems like $response->get('carrier_services') 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('carrier_services'));
Loading history...
19
    }
20
21
    /**
22
     * @param int $carrierServiceId
23
     * @return \CodeCloud\Bundle\ShopifyBundle\Api\GenericResource
24
     */
25
    public function findOne($carrierServiceId)
26
    {
27
        $request = new GetJson('/admin/carrier_services/' . $carrierServiceId . '.json');
28
        $response = $this->send($request);
29
        return $this->createEntity($response->get('carrier_service'));
0 ignored issues
show
It seems like $response->get('carrier_service') 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('carrier_service'));
Loading history...
30
    }
31
32
    /**
33
     * @param \CodeCloud\Bundle\ShopifyBundle\Api\GenericResource $carrierService
34
     * @return \CodeCloud\Bundle\ShopifyBundle\Api\GenericResource
35
     */
36
    public function create(GenericResource $carrierService)
37
    {
38
        $request = new PostJson('/admin/carrier_services.json', array('carrier_service' => $carrierService->toArray()));
39
        $response = $this->send($request);
40
        return $this->createEntity($response->get('carrier_service'));
0 ignored issues
show
It seems like $response->get('carrier_service') 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('carrier_service'));
Loading history...
41
    }
42
43
    /**
44
     * @param int $carrierServiceId
45
     * @param \CodeCloud\Bundle\ShopifyBundle\Api\GenericResource $carrierService
46
     * @return \CodeCloud\Bundle\ShopifyBundle\Api\GenericResource
47
     */
48
    public function update($carrierServiceId, GenericResource $carrierService)
49
    {
50
        $request = new PostJson('/admin/carrier_services/' . $carrierServiceId . '.json', array('carrier_service' => $carrierService->toArray()));
51
        $response = $this->send($request);
52
        return $this->createEntity($response->get('carrier_service'));
0 ignored issues
show
It seems like $response->get('carrier_service') 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

52
        return $this->createEntity(/** @scrutinizer ignore-type */ $response->get('carrier_service'));
Loading history...
53
    }
54
55
    /**
56
     * @param int $carrierServiceId
57
     */
58
    public function delete($carrierServiceId)
59
    {
60
        $request = new DeleteParams('/admin/carrier_services/' . $carrierServiceId . '.json');
61
        $this->send($request);
62
    }
63
}
64