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 ( 6ee68c...e3718d )
by Lester
01:17
created

SendHttpApiParams::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace LBHurtado\EngageSpark\Classes;
4
5
use Illuminate\Support\Arr;
6
use LBHurtado\EngageSpark\EngageSpark;
7
use LBHurtado\Common\Contracts\HttpApiParams;
8
9
class SendHttpApiParams implements HttpApiParams
10
{
11
    /**
12
     * @var EngageSpark
13
     */
14
    protected $service;
15
16
    /**
17
     * @var string
18
     */
19
    protected $mobile;
20
21
    /**
22
     * @var string
23
     */
24
    protected $message;
25
26
    /**
27
     * @var string
28
     */
29
    protected $senderId;
30
31
    /**
32
     * @var string
33
     */
34
    protected $recipientType = 'mobile_number';
35
36
    /**
37
     * SendParams constructor.
38
     * @param $service
39
     * @param $mobile
40
     * @param $message
41
     */
42
    public function __construct(EngageSpark $service, string $mobile, string $message, string $senderId = null)
43
    {
44
        $this->service = $service;
45
        $this->mobile = $mobile;
46
        $this->message = $message;
47
        $this->setSenderId($service, $senderId);
48
    }
49
50
    public function toArray(): array
51
    {
52
        return [
53
            'organization_id' => $this->service->getOrgId(),
54
            'mobile_numbers' => Arr::wrap($this->mobile),
55
            'message' => $this->message,
56
            'sender_id' => $this->senderId,
57
            'recipient_type' => $this->recipientType,
58
        ];
59
    }
60
61
    protected function setSenderId(EngageSpark $service, string $senderId = null)
62
    {
63
        $this->senderId = $senderId ?? $service->getSenderId();
64
65
        return $this;
66
    }
67
}
68