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

Filter::isAllowed()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
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
}