Passed
Push — sudav3 ( ac6dc6...d2f44f )
by 世昌
02:12
created

MagicAccessTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A offsetUnset() 0 3 1
A offsetGet() 0 3 1
A offsetSet() 0 3 1
A offsetExists() 0 3 1
1
<?php
2
namespace suda\orm\struct;
3
4
trait MagicAccessTrait
5
{
6
    public function offsetSet($offset, $value)
7
    {
8
        $this->__set($offset, $value);
0 ignored issues
show
Bug introduced by
It seems like __set() 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

8
        $this->/** @scrutinizer ignore-call */ 
9
               __set($offset, $value);
Loading history...
9
    }
10
11
    public function offsetExists($offset)
12
    {
13
        return $this->__isset($offset);
0 ignored issues
show
Bug introduced by
It seems like __isset() 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

13
        return $this->/** @scrutinizer ignore-call */ __isset($offset);
Loading history...
14
    }
15
16
    public function offsetUnset($offset)
17
    {
18
        $this->__unset($offset);
0 ignored issues
show
Bug introduced by
It seems like __unset() 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

18
        $this->/** @scrutinizer ignore-call */ 
19
               __unset($offset);
Loading history...
19
    }
20
21
    public function offsetGet($offset)
22
    {
23
        return $this->__get($offset);
0 ignored issues
show
Bug introduced by
It seems like __get() 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

23
        return $this->/** @scrutinizer ignore-call */ __get($offset);
Loading history...
24
    }
25
}
26