HasHashables::getHashables()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Auth\Traits;
6
7
trait HasHashables
8
{
9
    /**
10
     * Get the current hashables for the model.
11
     *
12
     * @return array|null
13
     */
14
    public function getHashables(): ?array
15
    {
16
        return $this->hashables ?? null;
0 ignored issues
show
Bug introduced by
The property hashables 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...
17
    }
18
19
    /**
20
     * Set the hashables associated with the model.
21
     *
22
     * @param array $hashables
23
     *
24
     * @return $this
25
     */
26
    public function setHashables(array $hashables)
27
    {
28
        $this->hashables = $hashables;
29
30
        return $this;
31
    }
32
}
33