Passed
Push — main ( f5b6ef...c06968 )
by Thierry
16:33 queued 05:42
created

Exclude::validateArguments()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 2
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 5
rs 10
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);
0 ignored issues
show
Bug introduced by
The method exclude() does not exist on Jaxon\App\Metadata\Metadata. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
        $xMetadata->/** @scrutinizer ignore-call */ 
36
                    exclude($sMethod)->setValue($this->value);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
36
    }
37
}
38