Completed
Pull Request — master (#8)
by Woody
03:22 queued 01:11
created

OptionsRequiredTrait::checkRequired()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 9.4285
nc 2
cc 2
eloc 4
nop 2
crap 6
1
<?php
2
3
namespace Equip\Command;
4
5
/**
6
 * Provides required parameter functionality for options.
7
 */
8
trait OptionsRequiredTrait
9
{
10
    /**
11
     * Check that the given options contain all required keys.
12
     *
13
     * @param array $options
14
     * @param array $keys
15
     *
16
     * @return void
17
     *
18
     * @throws CommandException
19
     *  If any required options are missing.
20
     */
21
    private function checkRequired(array $options, array $keys)
1 ignored issue
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
22
    {
23
        $missing = array_diff_key(array_flip($keys), $options);
24
25
        if (!empty($missing)) {
26
            throw CommandException::missingOptions($missing);
27
        }
28
    }
29
}
30