AllowedCommandsContainer::hasCommand()   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
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Tkotosz\CommandScheduler\Model;
4
5
use Tkotosz\CommandScheduler\Model\CommandProvider;
6
7
class AllowedCommandsContainer
8
{
9
    /**
10
     * @var array
11
     */
12
    private $allowedCommands;
13
    
14
    /**
15
     * @param array $allowedCommands
16
     */
17
    public function __construct(array $allowedCommands = [])
18
    {
19
        $this->allowedCommands = $allowedCommands;
20
    }
21
    
22
    public function getAllowedCommands(): array
23
    {
24
        return $this->allowedCommands;
25
    }
26
27
    public function hasCommand(string $commandName): bool
28
    {
29
        return array_search($commandName, $this->allowedCommands) !== false;
30
    }
31
}
32