After   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A saveValue() 0 3 1
A __construct() 0 2 1
1
<?php
2
3
/**
4
 * After.php
5
 *
6
 * Jaxon attribute.
7
 * Specifies a method to be called after the one targeted by a Jaxon request.
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 | Attribute::IS_REPEATABLE)]
22
class After extends AbstractAttribute
23
{
24
    /**
25
     * @param string $call The method to call
26
     * @param array $with The call parameters
27
     */
28
    public function __construct(protected string $call, protected array $with = [])
29
    {}
30
31
    /**
32
     * @inheritDoc
33
     */
34
    public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void
35
    {
36
        $xMetadata->after($sMethod)->addCall($this->call, $this->with);
37
    }
38
}
39