BeforeAnnotation::getType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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