Required::isRequired()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 1
c 1
b 1
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of Wszetko Sitemap.
7
 *
8
 * (c) Paweł Kłopotek-Główczewski <[email protected]>
9
 *
10
 * This source file is subject to the MIT license that is bundled
11
 * with this source code in the file LICENSE.
12
 */
13
14
namespace Wszetko\Sitemap\Traits;
15
16
/**
17
 * Trait Required.
18
 *
19
 * @package Wszetko\Sitemap\Traits
20
 */
21
trait Required
22
{
23
    /**
24
     * @var bool
25
     */
26
    private $required = false;
27
28
    /**
29
     * Check if field is required.
30
     *
31
     * @return bool
32
     */
33 146
    public function isRequired(): bool
34
    {
35 146
        return $this->required;
36
    }
37
38
    /**
39
     * Set if field is required.
40
     *
41
     * @param bool $required
42
     *
43
     * @return static
44
     */
45 506
    public function setRequired(bool $required): self
46
    {
47 506
        $this->required = $required;
48
49 506
        return $this;
50
    }
51
}
52