Completed
Pull Request — master (#366)
by Beñat
05:52 queued 01:06
created

Notification   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 35
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Kreta\Notifier\Infrastructure\Projection\ReadModel\Inbox\Elasticsearch\Document;
16
17
use Kreta\Notifier\Domain\Model\Inbox\NotificationStatus;
18
use ONGR\ElasticsearchBundle\Annotation as Elasticsearch;
19
20
/**
21
 * @Elasticsearch\Object()
22
 */
23
class Notification
24
{
25
    /**
26
     * @Elasticsearch\Property(type="string")
27
     */
28
    public $id;
29
30
    /**
31
     * @Elasticsearch\Property(type="text")
32
     */
33
    public $body;
34
35
    /**
36
     * @Elasticsearch\Property(type="integer")
37
     */
38
    public $publishedOn;
39
40
    /**
41
     * @Elasticsearch\Property(type="integer")
42
     */
43
    public $readOn;
44
45
    /**
46
     * @Elasticsearch\Property(type="string")
47
     */
48
    public $status;
49
50
    public function __construct(string $id = null, string $body = null, int $publishedOn = null)
51
    {
52
        $this->id = $id;
53
        $this->body = $body;
54
        $this->publishedOn = $publishedOn;
55
        $this->status = (NotificationStatus::unread())->status();
56
    }
57
}
58