Passed
Push — master ( 7c83a0...cd350b )
by Thierry
02:08
created

RequestPlugin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 60
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTarget() 0 3 1
A register() 0 3 1
1
<?php
2
3
/**
4
 * RequestPlugin.php - Jaxon Request interface
5
 *
6
 * Interface for Jaxon Request plugins.
7
 *
8
 * Request plugins handle the registration, client script generation and processing of jaxon enabled requests.
9
 * Each plugin should have a unique signature for both the registration and processing of requests.
10
 * During registration, the user will specify a type which will allow the plugin to detect and handle it.
11
 * During client script generation, the plugin will generate a <jaxon.request> stub with the prescribed call options and request signature.
12
 * During request processing, the plugin will detect the signature generated previously and process the request accordingly.
13
 *
14
 * @package jaxon-core
0 ignored issues
show
Coding Style introduced by
Package name "jaxon-core" is not valid; consider "Jaxoncore" instead
Loading history...
15
 * @author Jared White
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
16
 * @author J. Max Wilson
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
17
 * @author Joseph Woolley
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
18
 * @author Steffen Konerow
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
19
 * @author Thierry Feuzeu <[email protected]>
20
 * @copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
0 ignored issues
show
Coding Style introduced by
@copyright tag must contain a year and the name of the copyright holder
Loading history...
21
 * @copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White  & J. Max Wilson
0 ignored issues
show
Coding Style introduced by
@copyright tag must contain a year and the name of the copyright holder
Loading history...
22
 * @copyright 2016 Thierry Feuzeu <[email protected]>
23
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
24
 * @link https://github.com/jaxon-php/jaxon-core
25
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
26
27
namespace Jaxon\Plugin;
28
29
use Jaxon\Request\Target;
30
31
abstract class RequestPlugin extends Plugin
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class RequestPlugin
Loading history...
32
{
33
    /**
34
     * Check if the provided options are correct, and convert them into an array.
35
     *
36
     * @param string $sCallable
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
37
     * @param mixed $xOptions
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
38
     *
39
     * @return array
40
     */
41
    abstract public function checkOptions(string $sCallable, $xOptions): array;
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
42
43
    /**
44
     * Register a function, an event or an object.
45
     *
46
     * Called by the <Jaxon\Plugin\PluginManager> when a user script
47
     * when a function or callable object is to be registered.
48
     * Additional plugins may support other registration types.
49
     *
50
     * @param string $sType    The type of request handler being registered
0 ignored issues
show
Coding Style introduced by
Expected 5 spaces after parameter name; 4 found
Loading history...
51
     * @param string $sCallable    The callable entity being registered
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
52
     * @param array $aOptions    The associated options
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter name; 4 found
Loading history...
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
53
     *
54
     * @return bool
55
     */
56
    public function register(string $sType, string $sCallable, array $aOptions): bool
0 ignored issues
show
Unused Code introduced by
The parameter $sType is not used and could be removed. ( Ignorable by Annotation )

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

56
    public function register(/** @scrutinizer ignore-unused */ string $sType, string $sCallable, array $aOptions): bool

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $aOptions is not used and could be removed. ( Ignorable by Annotation )

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

56
    public function register(string $sType, string $sCallable, /** @scrutinizer ignore-unused */ array $aOptions): bool

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $sCallable is not used and could be removed. ( Ignorable by Annotation )

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

56
    public function register(string $sType, /** @scrutinizer ignore-unused */ string $sCallable, array $aOptions): bool

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
57
    {
58
        return false;
59
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
60
61
    /**
62
     * Get the target function or class and method
63
     *
64
     * @return Target|null
65
     */
66
    public function getTarget(): ?Target
67
    {
68
        return null;
69
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
70
71
    /**
72
     * Check if this plugin can process the current request
73
     *
74
     * Called by the <Jaxon\Plugin\PluginManager> when a request has been received to determine
75
     * if the request is destinated to this request plugin.
76
     *
77
     * @return bool
78
     */
79
    abstract public function canProcessRequest(): bool;
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
80
81
    /**
82
     * Process the current request
83
     *
84
     * Called by the <Jaxon\Plugin\PluginManager> when a request is being processed.
85
     * This will only occur when <Jaxon> has determined that the current request
86
     * is a valid (registered) jaxon enabled function via <jaxon->canProcessRequest>.
87
     *
88
     * @return bool
89
     */
90
    abstract public function processRequest(): bool;
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
91
}
92