Auth::setData()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 2
dl 10
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright © 2017 Toan Nguyen. All rights reserved.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Gojira\Framework\App\Configuration;
10
11
use Gojira\Framework\Data\DataObject;
12
13
/**
14
 * Base class to work with auth config items
15
 *
16
 * @package Gojira\Framework\App\Configuration
17
 * @author  Toan Nguyen <[email protected]>
18
 */
19
class Auth extends DataObject implements AuthInterface
20
{
21
    /**
22
     * Overwrite data in the object.
23
     *
24
     * The $key parameter can be string or array.
25
     * If $key is string, the attribute value will be overwritten by $value
26
     *
27
     * If $key is an array, it will overwrite all the data in the object.
28
     *
29
     * @param string|array $key
30
     * @param mixed        $value
31
     *
32
     * @return $this
33
     */
34 View Code Duplication
    public function setData($key, $value = null)
35
    {
36
        if ($key === (array)$key) {
37
            $this->_data = $key;
38
        } else {
39
            $this->_data[$key] = $value;
40
        }
41
42
        return $this;
43
    }
44
}
45