Completed
Push — master ( 67ee93...84505b )
by Ivannis Suárez
07:55
created

PublishedPost   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A title() 0 4 1
A setTitle() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of the Cubiche package.
5
 *
6
 * Copyright (c) Cubiche
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Cubiche\Domain\EventSourcing\Tests\Fixtures\ReadModel;
13
14
use Cubiche\Core\Cqrs\ReadModelInterface;
15
use Cubiche\Domain\Model\AggregateRoot;
16
use Cubiche\Domain\Model\Tests\Fixtures\PostId;
17
18
/**
19
 * PublishedPost class.
20
 *
21
 * @author Ivannis Suárez Jerez <[email protected]>
22
 */
23
class PublishedPost extends AggregateRoot implements ReadModelInterface
24
{
25
    /**
26
     * Post constructor.
27
     *
28
     * @param PostId $id
29
     * @param string $title
30
     */
31
    public function __construct(PostId $id, $title)
32
    {
33
        parent::__construct($id);
34
35
        $this->title = $title;
0 ignored issues
show
Bug introduced by
The property title does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
36
    }
37
38
    /**
39
     * @return string
40
     */
41
    public function title()
42
    {
43
        return $this->title;
44
    }
45
46
    /**
47
     * @param string $title
48
     */
49
    public function setTitle($title)
50
    {
51
        $this->title = $title;
52
    }
53
}
54