Completed
Pull Request — master (#12)
by Brian
01:12
created

HasUuidPrimaryKey   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 3
c 2
b 0
f 1
lcom 0
cbo 0
dl 0
loc 17
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getIdAttribute() 0 4 1
A getKeyName() 0 4 1
A getIncrementing() 0 4 1
1
<?php
2
3
namespace Spatie\BinaryUuid;
4
5
trait HasUuidPrimaryKey
6
{
7
    public function getIdAttribute()
8
    {
9
        return $this->uuid_text;
0 ignored issues
show
Bug introduced by
The property uuid_text 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...
10
    }
11
    
12
    public function getKeyName()
13
    {
14
        return 'uuid';
15
    }
16
17
    public function getIncrementing()
18
    {
19
        return false;
20
    }
21
}
22