Test Failed
Pull Request — master (#70)
by Rafael
05:38
created

UsersPushNotifications::assemble()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 8
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Gewaer\Notifications\PushNotifications;
4
5
use Namshi\Notificator\Notification;
6
use Gewaer\Contracts\PushNotificationsContract;
7
use Gewaer\Models\Users;
8
use Gewaer\Models\Notifications;
9
use Gewaer\Notifications\PushNotifications\PushNotifications as PushNotifications;
10
use Gewaer\Traits\NotificationsTrait;
11
12
class UsersPushNotifications extends PushNotifications implements PushNotificationsContract
13
{
14
    /**
15
     * Notifications Trait
16
     */
17
    use NotificationsTrait;
18
19
    /**
20
     * Constructor
21
     */
22
    public function __construct(array $user, string $content, string $systemModule)
23
    {
24
        $this->user = $user;
1 ignored issue
show
Documentation Bug introduced by
It seems like $user of type array is incompatible with the declared type Gewaer\Models\Users of property $user.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
25
        $this->content  = $content;
26
        $this->systemModule = $systemModule;
27
    }
28
29
    /**
30
     * Assemble an Apps Push Notification
31
     * @todo Create specific assembler for apps push notifications
32
     */
33
    public function assemble()
34
    {
35
        /**
36
         * Create a new database record
37
         */
38
        self::create($this->user, $this->content, Notifications::USERS, $this->systemModule);
1 ignored issue
show
Bug introduced by
$this->user of type Gewaer\Models\Users is incompatible with the type array expected by parameter $user of Gewaer\Notifications\Pus...Notifications::create(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

38
        self::create(/** @scrutinizer ignore-type */ $this->user, $this->content, Notifications::USERS, $this->systemModule);
Loading history...
39
40
        return $this->content . " From Users";
41
    }
42
}
43