BinnDecode::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Knik\Binn\Decoder;
4
5
use Knik\Binn\Contracts\BinnValueDecoder;
6
7
class BinnDecode
8
{
9
    /** @var DecoderCollection */
10
    private $decoders;
11
12
    public function __construct(DecoderCollection $decoders)
13
    {
14
        $this->decoders = $decoders;
15
    }
16
17
    public function decode($value, $format, $context = [])
0 ignored issues
show
Unused Code introduced by
The parameter $format 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

17
    public function decode($value, /** @scrutinizer ignore-unused */ $format, $context = [])

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 $context 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

17
    public function decode($value, $format, /** @scrutinizer ignore-unused */ $context = [])

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...
18
    {
19
        /** @var BinnValueDecoder $decoder */
20
        foreach ($this->decoders->getAll() as $decoder) {
21
            if ($decoder->supportsDecoding($value)) {
22
                return $decoder->decode($value);
23
            }
24
        }
25
26
        return null;
27
    }
28
}
29