Completed
Push — master ( d77c75...b705fb )
by Neomerx
02:26
created

Settings::isLogsEnabled()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 2
eloc 3
nc 2
nop 0
crap 2
1
<?php namespace Neomerx\CorsIlluminate\Settings;
2
3
/**
4
 * Copyright 2015 [email protected] (www.neomerx.com)
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 * http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
use \Neomerx\Cors\Strategies\Settings as CorsSettings;
20
21
/**
22
 * @package Neomerx\CorsIlluminate
23
 *
24
 * @SuppressWarnings(PHPMD.TooManyMethods)
25
 */
26
class Settings extends CorsSettings
27
{
28
    /**
29
     * If CORS handling should be logged (true/false, by default is turned off).
30
     */
31
    const KEY_LOGS_ENABLED = 21;
32
33
    /**
34
     * @return bool
35
     */
36 1
    public function isLogsEnabled()
37
    {
38 1
        return array_key_exists(self::KEY_LOGS_ENABLED, $this->settings) === true ?
39 1
            $this->settings[self::KEY_LOGS_ENABLED] : false;
40
    }
41
42
    /**
43
     * @param bool $enabled
44
     *
45
     * @return $this
46
     */
47 1
    public function setLogsEnabled($enabled)
48
    {
49 1
        $this->settings[self::KEY_LOGS_ENABLED] = $enabled;
50
51 1
        return $this;
52
    }
53
}
54