Passed
Push — master ( feec22...d030f3 )
by Milan
01:50
created

Filter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isAllowed() 0 7 2
1
<?php
2
3
namespace h4kuna\Upload\Upload;
4
5
class Filter
6
{
7
8
	/** @var array */
9
	private $filter;
10
11
12
	public function __construct(...$values)
13
	{
14
		$this->filter = array_flip($values);
15
	}
16
17
18
	public function isAllowed($value)
19
	{
20
		if ($this->filter === []) {
21
			return true;
22
		}
23
		return isset($this->filter[strtolower($value)]);
24
	}
25
26
}