RefundEndpoint   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 14
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A findOne() 0 6 2
1
<?php
2
namespace CodeCloud\Bundle\ShopifyBundle\Api\Endpoint;
3
4
use CodeCloud\Bundle\ShopifyBundle\Api\Request\GetJson;
5
6
class RefundEndpoint extends AbstractEndpoint
7
{
8
    /**
9
     * @param int $orderId
10
     * @param int $refundId
11
     * @param array $fields
12
     * @return GenericEntity
0 ignored issues
show
Bug introduced by
The type CodeCloud\Bundle\Shopify...\Endpoint\GenericEntity was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
     */
14
    public function findOne($orderId, $refundId, array $fields = array())
15
    {
16
        $params = $fields ? array('fields' => implode(',', $fields)) : array();
17
        $request = new GetJson('/admin/orders/' . $orderId . '/refunds/' . $refundId . '.json', $params);
18
        $response = $this->send($request);
19
        return $this->createEntity($response->get('refund'));
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->createEnti...esponse->get('refund')) returns the type CodeCloud\Bundle\ShopifyBundle\Api\GenericResource which is incompatible with the documented return type CodeCloud\Bundle\Shopify...\Endpoint\GenericEntity.
Loading history...
Bug introduced by
It seems like $response->get('refund') 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

19
        return $this->createEntity(/** @scrutinizer ignore-type */ $response->get('refund'));
Loading history...
20
    }
21
}
22