Completed
Push — develop ( 0bfa91...da5abe )
by
unknown
17:13 queued 09:01
created

AtsMode::setOneClickApplyProfiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2016 Cross Solution <http://cross-solution.de>
8
 */
9
  
10
/** */
11
namespace Jobs\Entity;
12
13
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
14
use Core\Entity\AbstractEntity;
15
16
/**
17
 * Application tracking setting of a job entity.
18
 *
19
 * @ODM\EmbeddedDocument
20
 * @since 0.19
21
 * @author Mathias Gelhausen <[email protected]>
22
 */
23
class AtsMode extends AbstractEntity implements AtsModeInterface
24
{
25
    /**
26
     * The ATS mode.
27
     *
28
     * @var string
29
     * @ODM\Field(type="string")
30
     */
31
    protected $mode;
32
33
    /**
34
     * The uri to be used in MODE_URI.
35
     *
36
     * @var string
37
     * @ODM\Field(type="string")
38
     */
39
    protected $uri;
40
41
    /**
42
     * The email to be used in MODE_EMAIL
43
     *
44
     * @var string
45
     * @ODM\Field(type="string")
46
     */
47
    protected $email;
48
49
    /**
50
     * One click apply flag
51
     *
52
     * @var bool
53
     * @ODM\Field(type="bool")
54
     */
55
    protected $oneClickApply = false;
56
    
57
    /**
58
     * One click apply profiles
59
     *
60
     * @var array
61
     * @ODM\Hash
62
     */
63
    protected $oneClickApplyProfiles = [];
64
65
    /**
66
     * Creates a new instance.
67
     *
68
     * @param string $mode The ATS mode.
69
     * @param null   $uriOrEmail Provide the URI for MODE_URI or the email address for MODE_EMAIL.
70
     *                           Is not used for MODE_INTERN and MODE_NONE.
71
     *
72
     * @uses setMode()
73
     * @uses setUri()
74
     * @uses setEmail()
75
     * @throws \InvalidArgumentException if invalid mode is passed.
76
     */
77
    public function __construct($mode = self::MODE_INTERN, $uriOrEmail = null)
78
    {
79
        $this->setMode($mode);
80
81
        if (null !== $uriOrEmail) {
82
            if (self::MODE_URI == $mode) {
83
                $this->setUri($uriOrEmail);
84
            } elseif (self::MODE_EMAIL == $mode) {
85
                $this->setEmail($uriOrEmail);
86
            }
87
        }
88
    }
89
90
    /**
91
     * Sets the ATS mode.
92
     *
93
     * @throws \InvalidArgumentException
94
     */
95
    public function setMode($mode)
96
    {
97
        $validModes = array(
98
            self::MODE_INTERN,
99
            self::MODE_URI,
100
            self::MODE_EMAIL,
101
            self::MODE_NONE,
102
        );
103
104
        if (!in_array($mode, $validModes)) {
105
            throw new \InvalidArgumentException('Unknown value for ats mode.');
106
        }
107
108
        $this->mode = $mode;
109
110
        return $this;
111
    }
112
113
    public function isMode($mode)
114
    {
115
        return $mode == $this->mode;
116
    }
117
118
    public function getMode()
119
    {
120
        return $this->mode;
121
    }
122
123
    public function isIntern()
124
    {
125
        return $this->isMode(self::MODE_INTERN);
126
    }
127
128
    public function isUri()
129
    {
130
        return $this->isMode(self::MODE_URI);
131
    }
132
133
    public function isEmail()
134
    {
135
        return $this->isMode(self::MODE_EMAIL);
136
    }
137
138
    public function isEnabled()
139
    {
140
        return !$this->isDisabled();
141
    }
142
143
    public function isDisabled()
144
    {
145
        return $this->isMode(self::MODE_NONE);
146
    }
147
148
    public function setUri($uri)
149
    {
150
        $this->uri = $uri;
151
152
        return $this;
153
    }
154
155
    public function getUri()
156
    {
157
        return $this->uri;
158
    }
159
160
    public function setEmail($email)
161
    {
162
        $this->email = $email;
163
164
        return $this;
165
    }
166
167
    public function getEmail()
168
    {
169
        return $this->email;
170
    }
171
	/**
172
	 * @return bool
173
	 */
174
	public function getOneClickApply()
0 ignored issues
show
Coding Style introduced by
function getOneClickApply() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
175
	{
176
		return $this->oneClickApply;
177
	}
178
179
	/**
180
	 * @param bool $oneClickApply
181
	 * @return AtsMode
182
	 */
183
	public function setOneClickApply($oneClickApply)
184
	{
185
		$this->oneClickApply = (bool)$oneClickApply;
186
		
187
		return $this;
188
	}
189
190
	/**
191
	 * @return array
192
	 */
193
	public function getOneClickApplyProfiles()
194
	{
195
		return $this->oneClickApplyProfiles;
196
	}
197
198
	/**
199
	 * @param array $oneClickApplyProfiles
200
	 * @return AtsMode
201
	 */
202
	public function setOneClickApplyProfiles(array $oneClickApplyProfiles)
203
	{
204
		$this->oneClickApplyProfiles = $oneClickApplyProfiles;
205
		
206
		return $this;
207
	}
208
}
209