Completed
Push — master ( 653f76...6d6cf1 )
by Choraimy
09:46 queued 05:29
created

UnknownDeviceException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 8
ccs 6
cts 6
cp 1
crap 1
rs 10
1
<?php
2
3
namespace NotificationChannels\Pushwoosh\Exceptions;
4
5
use Illuminate\Support\Arr;
6
use Throwable;
7
8
class UnknownDeviceException extends PushwooshException
9
{
10
    protected $devices;
11
12
    /**
13
     * Create a new unknown device exception.
14
     *
15
     * @param mixed $devices
16
     * @param int $code
17
     * @param \Throwable|null $previous
18
     * @return void
19
     */
20 15
    public function __construct($devices, $code = 0, Throwable $previous = null)
21
    {
22 15
        $this->devices = (array)$devices;
23
24 15
        parent::__construct(
25 15
            sprintf('Unknown device(s) referenced: %s', implode(', ', Arr::flatten($this->devices))),
26 10
            $code,
27 10
            $previous
28
        );
29 15
    }
30
31
    /**
32
     * Get the unknown devices per message.
33
     *
34
     * @return string[][]
35
     */
36
    public function getDevices()
37
    {
38
        return $this->devices;
39
    }
40
}
41