GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (14)

ImageSearch/V20180120/Traits/DeleteItemTrait.php (2 issues)

Labels
Severity
1
<?php
2
3
namespace AlibabaCloud\ImageSearch\V20180120\Traits;
4
5
/**
6
 * Trait DeleteItemTrait
7
 *
8
 * @package AlibabaCloud\ImageSearch\V20180120\Traits
9
 */
10
trait DeleteItemTrait
11
{
12
    /**
13
     * @var string
14
     */
15
    private $itemId;
16
17
    /**
18
     * @var array
19
     */
20
    private $picList = [];
21
22
    /**
23
     * @param $deletePictureName
24
     *
25
     * @return $this
26
     */
27 1
    public function addPicture($deletePictureName)
28
    {
29 1
        $this->picList[] = $deletePictureName;
30 1
        $this->buildPostContent();
31
32 1
        return $this;
33
    }
34
35
    /**
36
     * @param mixed $itemId
37
     *
38
     * @return $this
39
     */
40 1
    public function withItemId($itemId)
41
    {
42 1
        $this->itemId = $itemId;
43 1
        $this->buildPostContent();
44
45 1
        return $this;
46
    }
47
48
    /**
49
     * @return bool
50
     */
51 1
    private function buildPostContent()
52
    {
53 1
        if ($this->itemId === null || $this->itemId === '') {
54
            return false;
55
        }
56
57 1
        $map            = [];
58 1
        $map['item_id'] = $this->itemId;
59
60 1
        $picListStr = '';
61 1
        foreach ($this->picList as $key => $value) {
62 1
            if ($picListStr !== null && $picListStr !== '') {
63
                $picListStr .= ',';
64
            }
65 1
            $picListStr .= base64_encode($value);
66 1
        }
67 1
        $map['pic_list'] = $picListStr;
68
69 1
        $content = $this->buildContent($map);
70
71 1
        $this->body($content);
0 ignored issues
show
It seems like body() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

71
        $this->/** @scrutinizer ignore-call */ 
72
               body($content);
Loading history...
72 1
        $this->format('JSON');
0 ignored issues
show
It seems like format() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

72
        $this->/** @scrutinizer ignore-call */ 
73
               format('JSON');
Loading history...
73
74 1
        return true;
75
    }
76
77
    /**
78
     * @param $map
79
     *
80
     * @return string
81
     */
82 1
    private function buildContent($map)
83
    {
84 1
        $meta  = '';
85 1
        $body  = '';
86 1
        $start = 0;
87
88 1
        foreach ($map as $key => $value) {
89 1
            if ($meta !== '') {
90 1
                $meta .= '#';
91 1
            }
92 1
            $meta  .= $key . ',' . $start . ',' . ($start + strlen($value));
93 1
            $body  .= $value;
94 1
            $start += strlen($value);
95 1
        }
96
97 1
        return $meta . '^' . $body;
98
    }
99
}
100