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

OptionsRequiredTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 22
ccs 0
cts 7
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkRequired() 0 8 2
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