Issues (8)

src/FortySixElksMMS.php (2 issues)

1
<?php
2
3
namespace NotificationChannels\FortySixElks;
4
5
use NotificationChannels\FortySixElks\Exceptions\CouldNotSendNotification;
6
7
class FortySixElksMMS extends FortySixElksMedia implements FortySixElksMediaInterface
8
{
9
    const ENDPOINT = 'https://api.46elks.com/a1/mms';
10
    public $type = 'MMS';
11
12
    public function __construct()
13
    {
14
        return parent::__construct();
0 ignored issues
show
Are you sure the usage of parent::__construct() targeting NotificationChannels\For...lksMedia::__construct() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
15
    }
16
17
    public function image($url)
18
    {
19
        $this->payload['image'] = $url;
20
21
        return $this;
22
    }
23
24
    /**
25
     * @return $this
26
     */
27
    public function send()
28
    {
29
        try {
30
            $response = $this->client->request('POST', self::ENDPOINT, [
0 ignored issues
show
The assignment to $response is dead and can be removed.
Loading history...
31
                'form_params' => [
32
                    'from'     => $this->from,
33
                    'message'  => $this->getContent(),
34
                    'to'       => $this->phone_number,
35
                    'image'    => isset($this->payload['image']) ? $this->payload['image'] : null,
36
                ],
37
38
            ]);
39
        } catch (\GuzzleHttp\Exception\BadResponseException $e) {
40
            $response = $e->getResponse();
41
42
            throw CouldNotSendNotification::serviceRespondedWithAnError($response->getBody()->getContents(), $response->getStatusCode());
43
        }
44
45
        return $this;
46
    }
47
}
48