BeforeAnnotation   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
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getType() 0 3 1
A saveValue() 0 3 1
1
<?php
2
3
/**
4
 * BeforeAnnotation.php
5
 *
6
 * Jaxon annotation for server side callbacks.
7
 *
8
 * @package jaxon-annotations
9
 * @author Thierry Feuzeu <[email protected]>
10
 * @copyright 2022 Thierry Feuzeu <[email protected]>
11
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
12
 * @link https://github.com/jaxon-php/jaxon-annotations
13
 */
14
15
namespace Jaxon\Annotations\Annotation;
16
17
use Jaxon\App\Metadata\Metadata;
18
19
/**
20
 * Specifies a method to be called before the one targeted by a Jaxon request.
21
 *
22
 * @usage('class' => true, 'method' => true, 'multiple' => true, 'inherited' => true)
23
 */
24
class BeforeAnnotation extends HookAnnotation
25
{
26
    /**
27
     * @inheritDoc
28
     */
29
    protected static function getType(): string
30
    {
31
        return 'before';
32
    }
33
34
    /**
35
     * @inheritDoc
36
     */
37
    public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void
38
    {
39
        $xMetadata->before($sMethod)->addCall($this->sMethod, $this->aParams);
40
    }
41
}
42