Completed
Pull Request — master (#1596)
by Thomas
03:09
created

CheckPlatformData   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 10
lcom 0
cbo 0
dl 0
loc 28
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B check() 0 15 10
1
<?php
2
/**
3
 * This file is part of the browscap package.
4
 *
5
 * Copyright (c) 1998-2017, Browser Capabilities Project
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
declare(strict_types = 1);
12
namespace Browscap\Data\Helper;
13
14
/**
15
 * Class DataCollection
16
 *
17
 * @category   Browscap
18
 *
19
 * @author     James Titcumb <[email protected]>
20
 */
21
class CheckPlatformData
22
{
23
    /**
24
     * checks if platform properties are set inside a properties array
25
     *
26
     * @param array  $properties
27
     * @param string $message
28
     *
29
     * @throws \LogicException
30
     *
31
     * @return void
32
     */
33 8
    public function check(array $properties, string $message) : void
34
    {
35 8
        if (array_key_exists('Platform', $properties)
36 7
            || array_key_exists('Platform_Description', $properties)
37 7
            || array_key_exists('Platform_Maker', $properties)
38 7
            || array_key_exists('Platform_Bits', $properties)
39 7
            || array_key_exists('Platform_Version', $properties)
40 7
            || array_key_exists('Win16', $properties)
41 7
            || array_key_exists('Win32', $properties)
42 7
            || array_key_exists('Win64', $properties)
43 7
            || array_key_exists('Browser_Bits', $properties)
44
        ) {
45 1
            throw new \LogicException($message);
46
        }
47 7
    }
48
}
49