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.
Completed
Push — master ( 486f11...b55f68 )
by t
07:38 queued 01:58
created

ImageProcessing   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setOptions() 0 3 1
A qualityEnchance() 0 13 1
1
<?php
2
/**
3
 * Class ImageProcessing
4
 *
5
 * @link https://www.icy2003.com/
6
 * @author icy2003 <[email protected]>
7
 * @copyright Copyright (c) 2017, icy2003
8
 */
9
namespace icy2003\php\iapis\baidu;
10
11
use icy2003\php\I;
12
use icy2003\php\ihelpers\Arrays;
13
use icy2003\php\ihelpers\Http;
14
use icy2003\php\ihelpers\Json;
15
16
/**
17
 * 图像处理
18
 */
19
class ImageProcessing extends Base
20
{
21
    /**
22
     * 选项列表
23
     *
24
     * @var array
25
     */
26
    protected $_options = [
27
        'image' => null,
28
    ];
29
30
    /**
31
     * 设置选项
32
     *
33
     * @param array $options
34
     * - image:Base64编码字符串,以图片文件形式请求时必填。(支持图片格式:jpg,bmp,png,jpeg),图片大小不超过4M。长宽乘积不超过800p x 800px。注意:图片的base64编码是不包含图片头的,如(data:image/jpg;base64,)
35
     *
36
     * @return static
37
     */
38
    public function setOptions($options)
39
    {
40
        return parent::setOptions($options);
41
    }
42
43
    /**
44
     * 图像无损放大
45
     *
46
     * - 输入一张图片,可以在尽量保持图像质量的条件下,将图像在长宽方向各放大两倍
47
     *
48
     * @return static
49
     */
50
    public function qualityEnchance()
51
    {
52
        $this->requestToken();
53
        $this->_result = Json::decode(Http::post('https://aip.baidubce.com/rest/2.0/image-process/v1/image_quality_enhance', Arrays::some($this->_options, [
54
            'image',
55
        ]), [
56
            'access_token' => $this->_token,
57
        ]));
58
        $this->_toArrayCall = function ($result) {
59
            return I::get($result, 'image');
60
        };
61
62
        return $this;
63
    }
64
}
65