ArrayAccessTrait::offsetExists()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Nip\Router\RouteCollections\Traits;
5
6
use Nip\Router\Route\Route;
7
8
/**
9
 * Trait ArrayAccessTrait
10
 * @package Nip\Router\RouteCollections\Traits
11
 */
12
trait ArrayAccessTrait
13
{
14
    /**
15
     * @param mixed $offset
16
     * @return bool
17
     */
18
    public function offsetExists($offset): bool
19
    {
20
        return $this->has($offset);
0 ignored issues
show
Bug introduced by
It seems like has() 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

20
        return $this->/** @scrutinizer ignore-call */ has($offset);
Loading history...
21
    }
22
23
    /**
24
     * @param mixed $offset
25
     * @return Route|null
26 1
     */
27
    public function offsetGet($offset): mixed
28 1
    {
29
        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

29
        return $this->/** @scrutinizer ignore-call */ get($offset);
Loading history...
30
    }
31
32
    /**
33
     * @param mixed $offset
34
     * @param mixed $value
35
     */
36
    public function offsetSet($offset, $value): void
37
    {
38
        $this->add($offset, $value);
0 ignored issues
show
Bug introduced by
It seems like add() 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

38
        $this->/** @scrutinizer ignore-call */ 
39
               add($offset, $value);
Loading history...
39
    }
40
41
    /**
42
     * @param mixed $offset
43
     */
44
    public function offsetUnset($offset): void
45
    {
46
        $this->remove($offset);
0 ignored issues
show
Bug introduced by
It seems like remove() 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

46
        $this->/** @scrutinizer ignore-call */ 
47
               remove($offset);
Loading history...
47
    }
48
}
49