AsArrayTrait::offsetExists()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Damax\Common\Application;
6
7
use BadMethodCallException;
8
use Doctrine\Common\Inflector\Inflector;
9
10
trait AsArrayTrait
11
{
12
    public function offsetExists($offset): bool
13
    {
14
        $prop = Inflector::camelize($offset);
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\Common\Inflector\Inflector::camelize() has been deprecated. ( Ignorable by Annotation )

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

14
        $prop = /** @scrutinizer ignore-deprecated */ Inflector::camelize($offset);
Loading history...
15
16
        return isset($this->$prop);
17
    }
18
19
    public function offsetGet($offset)
20
    {
21
        $prop = Inflector::camelize($offset);
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\Common\Inflector\Inflector::camelize() has been deprecated. ( Ignorable by Annotation )

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

21
        $prop = /** @scrutinizer ignore-deprecated */ Inflector::camelize($offset);
Loading history...
22
23
        return $this->$prop;
24
    }
25
26
    /**
27
     * @throws BadMethodCallException
28
     */
29
    public function offsetSet($offset, $value)
0 ignored issues
show
Unused Code introduced by
The parameter $offset is not used and could be removed. ( Ignorable by Annotation )

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

29
    public function offsetSet(/** @scrutinizer ignore-unused */ $offset, $value)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $value is not used and could be removed. ( Ignorable by Annotation )

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

29
    public function offsetSet($offset, /** @scrutinizer ignore-unused */ $value)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    {
31
        throw new BadMethodCallException(sprintf('Method "%s" not implemented.', __METHOD__));
32
    }
33
34
    /**
35
     * @throws BadMethodCallException
36
     */
37
    public function offsetUnset($offset)
0 ignored issues
show
Unused Code introduced by
The parameter $offset is not used and could be removed. ( Ignorable by Annotation )

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

37
    public function offsetUnset(/** @scrutinizer ignore-unused */ $offset)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        throw new BadMethodCallException(sprintf('Method "%s" not implemented.', __METHOD__));
40
    }
41
}
42