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.

MessageRequest::build()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 9
nc 2
nop 0
1
<?php
2
namespace DexBarrett\ClockworkSms\Builders\Xml;
3
4
use SimpleXmlElement;
5
use DexBarrett\ClockworkSms\Builders\Request;
6
7
class MessageRequest extends Request
8
{
9
    private $messageNodes = [
10
        'to' => 'To',
11
        'message' => 'Content',
12
        'from' => 'From',
13
        'long' => 'Long',
14
        'truncate' => 'Truncate',
15
        'invalidCharAction' => 'InvalidCharAction'
16
    ];
17
18
    public function build()
19
    {
20
        $messages = $this->command->getData();
21
22
        $xml = new SimpleXmlElement('<?xml version="1.0" encoding="UTF-8"?><body></body>');
23
24
25
        foreach ($messages as $message) {
26
            $smsNode = $xml->addChild('SMS');
27
            array_walk($message, function ($value, $key) use ($smsNode) {
28
                if (array_key_exists($key, $this->messageNodes)) {
29
                    $smsNode->addChild($this->messageNodes[$key], $value);
30
                }
31
            });
32
        }
33
        
34
        return $xml->children();
35
    }
36
}
37