Optimized   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Crossjoin\Browscap\Formatter;
5
6
use Crossjoin\Browscap\PropertyFilter\Disallowed;
7
8
/**
9
 * Class Optimized
10
 *
11
 * @package Crossjoin\Browscap\Formatter
12
 * @author Christoph Ziegenberg <[email protected]>
13
 * @link https://github.com/crossjoin/browscap
14
 */
15
class Optimized extends Formatter
16
{
17
    /**
18
     * Optimized constructor.
19
     *
20
     * @param bool $returnArray
21
     */
22
    public function __construct(bool $returnArray = false)
23
    {
24
        $options = self::VALUE_TYPED | self::VALUE_UNKNOWN_TO_NULL;
25
        if ($returnArray) {
26
            $options |= self::RETURN_ARRAY;
27
        } else {
28
            $options |= self::RETURN_OBJECT;
29
        }
30
        parent::__construct($options);
31
32
        // Disallow useless properties
33
        $propertyFilter = new Disallowed();
34
        $propertyFilter->addProperty('AolVersion');
35
        $this->setPropertyFilter($propertyFilter);
36
    }
37
}
38