Exclude   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 15
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A saveValue() 0 3 1
1
<?php
2
3
/**
4
 * Exclude.php
5
 *
6
 * Jaxon attribute.
7
 * Specifies if a class or method is excluded from js export.
8
 *
9
 * @package jaxon-attributes
10
 * @author Thierry Feuzeu <[email protected]>
11
 * @copyright 2024 Thierry Feuzeu <[email protected]>
12
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
13
 * @link https://github.com/jaxon-php/jaxon-core
14
 */
15
16
namespace Jaxon\Attributes\Attribute;
17
18
use Jaxon\App\Metadata\Metadata;
19
use Attribute;
20
21
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
22
class Exclude extends AbstractAttribute
23
{
24
    /**
25
     * @param bool $value
26
     */
27
    public function __construct(private bool $value = true)
28
    {}
29
30
    /**
31
     * @inheritDoc
32
     */
33
    public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void
34
    {
35
        $xMetadata->exclude($sMethod)->setValue($this->value);
36
    }
37
}
38