Completed
Push — master ( 38ffd4...ed5eea )
by Evan
03:02
created

TypeMeta   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A meta() 0 10 2
1
<?php
2
3
namespace Silk\Meta;
4
5
trait TypeMeta
6
{
7
    /**
8
     * Meta API for this type
9
     *
10
     * @param  string $key  Meta key to retreive or empty to retreive all.
11
     *
12
     * @return object
13
     */
14
    public function meta($key = '')
15
    {
16
        $meta = new ObjectMeta(static::OBJECT_TYPE, $this->id);
0 ignored issues
show
Bug introduced by
The property id 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
        if ($key) {
19
            return $meta->get($key);
20
        }
21
22
        return $meta;
23
    }
24
}
25