VGOps   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A has() 0 3 1
1
<?php
2
/**
3
 * VGetter operates
4
 * User: moyo
5
 * Date: 2018/6/7
6
 * Time: 1:56 PM
7
 */
8
9
namespace Carno\Web\Chips\Controller;
10
11
trait VGOps
12
{
13
    /**
14
     * @param string $name
15
     * @return bool
16
     */
17
    public function has(string $name) : bool
18
    {
19
        return $this->offsetExists($name);
0 ignored issues
show
Bug introduced by
It seems like offsetExists() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
        return $this->/** @scrutinizer ignore-call */ offsetExists($name);
Loading history...
20
    }
21
22
    /**
23
     * @param string $name
24
     * @param mixed $default
25
     * @return mixed
26
     */
27
    public function get(string $name, $default = null)
28
    {
29
        return $this->$name ?? $default;
30
    }
31
}
32