ProductDeletedResponder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A success() 0 8 1
A process() 0 5 2
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * Api Class
6
 * @category    Ticaje
7
 * @author      Max Demian <[email protected]>
8
 */
9
10
namespace Ticaje\AeSdk\Api\Artifact\Responder\Delete;
11
12
use Ticaje\Contract\Patterns\Interfaces\Pool\WorkerInterface;
13
use Ticaje\Contract\Patterns\Interfaces\Decorator\Responder\ResponseInterface as ContractResponseInterface;
14
15
use Ticaje\AeSdk\Api\Interfaces\ApiResponderInterface;
16
use Ticaje\AeSdk\Api\Artifact\Responder\Responder;
17
18
/**
19
 * Class ProductDeletedResponder
20
 * @package Ticaje\AeSdk\Api\Artifact\Responder\Delete
21
 */
22
class ProductDeletedResponder implements ApiResponderInterface, WorkerInterface
23
{
24
    use Responder;
0 ignored issues
show
Bug introduced by
The trait Ticaje\AeSdk\Api\Artifact\Responder\Responder requires the property $msg which is not provided by Ticaje\AeSdk\Api\Artifac...ProductDeletedResponder.
Loading history...
25
26
    private $productIds;
0 ignored issues
show
introduced by
The private property $productIds is not used, and could be removed.
Loading history...
27
28
    /**
29
     * @inheritDoc
30
     */
31
    public function process(ContractResponseInterface $response): ApiResponderInterface
32
    {
33
        $content = json_decode($response->getContent());
34
        isset($content->error_response) ? $this->error($content->error_response) : $this->success($content->aliexpress_solution_batch_product_delete_response);
35
        return $this;
36
    }
37
38
    protected function success(\stdClass $response)
0 ignored issues
show
Unused Code introduced by
The parameter $response is not used and could be removed. ( Ignorable by Annotation )

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

38
    protected function success(/** @scrutinizer ignore-unused */ \stdClass $response)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
    {
40
        $message = 'Product(s) deleted successfully';
41
        $this
42
            ->setSuccess(1)
0 ignored issues
show
Bug introduced by
The method setSuccess() does not exist on Ticaje\AeSdk\Api\Artifac...ProductDeletedResponder. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

42
            ->/** @scrutinizer ignore-call */ 
43
              setSuccess(1)
Loading history...
43
            ->setCode(200)
0 ignored issues
show
Bug introduced by
The method setCode() does not exist on Ticaje\AeSdk\Api\Artifac...ProductDeletedResponder. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

43
            ->/** @scrutinizer ignore-call */ setCode(200)
Loading history...
44
            ->setProductIds(null)
0 ignored issues
show
Bug introduced by
The method setProductIds() does not exist on Ticaje\AeSdk\Api\Artifac...ProductDeletedResponder. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

44
            ->/** @scrutinizer ignore-call */ setProductIds(null)
Loading history...
45
            ->setMessage($message)
0 ignored issues
show
Bug introduced by
The method setMessage() does not exist on Ticaje\AeSdk\Api\Artifac...ProductDeletedResponder. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

45
            ->/** @scrutinizer ignore-call */ setMessage($message)
Loading history...
46
        ;
47
    }
48
}
49