OptionChecker::checkOptionsInt()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 0
cts 8
cp 0
rs 9.2
c 0
b 0
f 0
cc 4
eloc 4
nc 3
nop 2
crap 20
1
<?php
2
namespace Disque\Command\Argument;
3
4
use Disque\Command\Argument\InvalidOptionException;
5
6
trait OptionChecker
7
{
8
    /**
9
     * Checks an array so that their keys are ints
10
     *
11
     * @param array $options Options
12
     * @param array $keys Keys to check
13
     * @throw InvalidOptionException
14
     */
15 View Code Duplication
    protected function checkOptionsInt(array $options, array $keys)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
    {
17
        foreach ($keys as $intOption) {
18
            if (isset($options[$intOption]) && !is_int($options[$intOption])) {
19
                throw new InvalidOptionException($this, $options);
20
            }
21
        }
22
    }
23
24
    /**
25
     * Checks an array so that their keys are strings
26
     *
27
     * @param array $options Options
28
     * @param array $keys Keys to check
29
     * @throw InvalidOptionException
30
     */
31 View Code Duplication
    protected function checkOptionsString(array $options, array $keys)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
    {
33
        foreach ($keys as $intOption) {
34
            if (isset($options[$intOption]) && !is_string($options[$intOption])) {
35
                throw new InvalidOptionException($this, $options);
36
            }
37
        }
38
    }
39
40
    /**
41
     * Checks an array so that their keys are arrays
42
     *
43
     * @param array $options Options
44
     * @param array $keys Keys to check
45
     * @throw InvalidOptionException
46
     */
47 View Code Duplication
    protected function checkOptionsArray(array $options, array $keys)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
48
    {
49
        foreach ($keys as $intOption) {
50
            if (isset($options[$intOption]) && !is_array($options[$intOption])) {
51
                throw new InvalidOptionException($this, $options);
52
            }
53
        }
54
    }
55
}