Completed
Push — master ( a8d831...91ca73 )
by Nate
01:42
created

Settings::setCORS()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/restful/license
6
 * @link       https://www.flipboxfactory.com/software/restful/
7
 */
8
9
namespace flipbox\craft\restful\models;
10
11
use craft\base\Model;
12
13
/**
14
 * @author Flipbox Factory <[email protected]>
15
 * @since 1.0.0
16
 */
17
class Settings extends Model
18
{
19
    /**
20
     * @var string
21
     */
22
    public $pageSizeParam = 'limit';
23
24
    /**
25
     * @var string
26
     */
27
    public $pageParam = 'page';
28
29
    /**
30
     * @var array
31
     */
32
    public $pageSizeLimit = [0, 1, 50, 100, 200, 500, 1000];
33
34
    /**
35
     * @var int
36
     */
37
    public $defaultPageSize = 50;
38
39
    /**
40
     * @var array
41
     */
42
    private $authMethods = [];
43
44
    /**
45
     * @var array
46
     */
47
    private $cors = [];
48
49
    /**
50
     * @param array $cors
51
     * @return $this
52
     */
53
    public function setCORS(array $cors = [])
54
    {
55
        $this->cors = $cors;
56
        return $this;
57
    }
58
59
    /**
60
     * @return array
61
     */
62
    public function getCORS(): array
63
    {
64
        return $this->cors;
65
    }
66
67
    /**
68
     * @return array
69
     */
70
    public function getAuthMethods(): array
71
    {
72
        return $this->authMethods;
73
    }
74
75
    /**
76
     * @param array $authMethods
77
     * @return $this
78
     */
79
    public function setAuthMethods(array $authMethods = [])
80
    {
81
        $this->authMethods = $authMethods;
82
        return $this;
83
    }
84
85
    /**
86
     * @inheritdoc
87
     */
88
    public function attributes()
89
    {
90
        return array_merge(
91
            parent::attributes(),
92
            [
93
                'authMethods',
94
                'cors'
95
            ]
96
        );
97
    }
98
}
99