Passed
Push — master ( 818b3e...c1bcf5 )
by Thierry
02:23
created

ExcludeAnnotation::initAnnotation()   A

Complexity

Conditions 5
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
rs 9.6111
cc 5
nc 2
nop 1
1
<?php
2
3
/**
4
 * AfterAnnotation.php
5
 *
6
 * Jaxon annotation for callbacks.
7
 *
8
 * @package jaxon-core
0 ignored issues
show
Coding Style introduced by
Package name "jaxon-core" is not valid; consider "Jaxoncore" instead
Loading history...
9
 * @copyright 2022 Thierry Feuzeu <[email protected]>
10
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
11
 * @link https://github.com/jaxon-php/jaxon-core
12
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
13
14
namespace Jaxon\Annotations\Annotation;
15
16
use mindplay\annotations\AnnotationException;
17
18
use function count;
19
use function is_bool;
20
21
/**
22
 * Specifies a method to be called after the one targeted by a Jaxon request.
23
 *
24
 * @usage('class' => true, 'method'=>true)
25
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
26
class ExcludeAnnotation extends AbstractAnnotation
27
{
28
    /**
29
     * The name of the upload field
30
     *
31
     * @var bool
0 ignored issues
show
Bug introduced by
Expected "boolean" but found "bool" for @var tag in member variable comment
Loading history...
32
     */
33
    protected $bValue;
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
34
35
    /**
0 ignored issues
show
Coding Style introduced by
Parameter $properties should have a doc-comment as per coding-style.
Loading history...
36
     * @inheritDoc
37
     * @throws AnnotationException
38
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
39
    public function initAnnotation(array $properties)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
40
    {
41
        if(count($properties) !== 0 &&
42
            (count($properties) !== 1 || !isset($properties[0]) || !is_bool($properties[0])))
43
        {
44
            throw new AnnotationException('the @exclude annotation requires a boolean or no property');
45
        }
46
        $this->bValue = $properties[0] ?? true;
47
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
48
49
    /**
50
     * @inheritDoc
51
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
52
    public function getName(): string
53
    {
54
        return 'protected';
55
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
56
57
    /**
58
     * @inheritDoc
59
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
60
    public function getValue()
61
    {
62
        return $this->bValue;
63
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
64
}
65