Completed
Pull Request — master (#105)
by
unknown
22:36
created

HandlesStoredEvent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 4 1
A tags() 0 11 2
1
<?php
2
3
4
namespace Spatie\EventProjector;
5
6
7
/**
8
 * Trait HandlesStoredEvent
9
 *
10
 * @package Spatie\EventProjector
11
 */
12
trait HandlesStoredEvent
13
{
14
15
    /**
16
     * @param \Spatie\EventProjector\Projectionist $projectionist
17
     */
18
    public function handle(Projectionist $projectionist)
19
    {
20
        $projectionist->handle($this->storedEvent);
0 ignored issues
show
Bug introduced by
The property storedEvent 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...
21
    }
22
23
    /**
24
     * @return array
25
     */
26
    public function tags(): array
27
    {
28
        if (empty($this->tags))
0 ignored issues
show
Bug introduced by
The property tags 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...
29
        {
30
            return [
31
                $this->storedEvent['event_class'],
32
            ];
33
        }
34
35
        return $this->tags;
36
    }
37
}