Test Failed
Push — master ( 894c40...e5d2d2 )
by Julien
11:34
created

Security::setSecurityBehavior()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
/**
4
 * This file is part of the Zemit Framework.
5
 *
6
 * (c) Zemit Team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE.txt
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zemit\Mvc\Model;
13
14
use Zemit\Mvc\Model\AbstractTrait\AbstractBehavior;
15
use Zemit\Mvc\Model\AbstractTrait\AbstractInjectable;
16
use Zemit\Mvc\Model\Behavior\Security as SecurityBehavior;
17
18
trait Security
19
{
20
    use AbstractInjectable;
21
    use AbstractBehavior;
22
    use Options;
23
    
24
    public SecurityBehavior $securityBehavior;
25
    
26
    /**
27
     * Initializing Security
28
     */
29
    public function initializeSecurity(?array $options = null): void
30
    {
31
        $options ??= $this->getOptionsManager()->get('security') ?? [];
32
        $this->addBehavior(new SecurityBehavior($options));
33
    }
34
    
35
    /**
36
     * Set Security Behavior
37
     */
38
    public function setSecurityBehavior(SecurityBehavior $securityBehavior): void
39
    {
40
        $this->securityBehavior = $securityBehavior;
41
        $this->addBehavior($this->securityBehavior);
42
    }
43
    
44
    /**
45
     * Get Security Behavior
46
     */
47
    public function getSecurityBehavior(): SecurityBehavior
48
    {
49
        return $this->securityBehavior;
50
    }
51
}
52