Passed
Push — master ( b34d93...aea763 )
by Thierry
03:02 queued 24s
created

DialogLibraryTrait   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 9
c 0
b 0
f 0
dl 0
loc 63
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setResponse() 0 3 1
A response() 0 3 1
A setReturnCode() 0 4 1
A returnCode() 0 3 1
1
<?php
2
3
/**
4
 * DialogLibraryTrait.php
5
 *
6
 * @package jaxon-core
0 ignored issues
show
Coding Style introduced by
Package name "jaxon-core" is not valid; consider "Jaxoncore" instead
Loading history...
7
 * @author Thierry Feuzeu <[email protected]>
8
 * @copyright 2016 Thierry Feuzeu <[email protected]>
9
 * @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
10
 * @link https://github.com/jaxon-php/jaxon-core
11
 */
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...
12
13
namespace Jaxon\Ui\Dialog\Library;
14
15
use Jaxon\Response\Response;
16
use Jaxon\Ui\Dialog\MessageInterface;
17
18
trait DialogLibraryTrait
0 ignored issues
show
Coding Style introduced by
Missing doc comment for trait DialogLibraryTrait
Loading history...
19
{
20
    /**
21
     * The dialog library helper
22
     *
23
     * @var DialogLibraryHelper
24
     */
25
    protected $xHelper;
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
26
27
    /**
28
     * @var Response
29
     */
30
    protected $xResponse = null;
31
32
    /**
33
     * For MessageInterface, tells if the calls to the functions shall
34
     * add commands to the response or return the js code. By default, they add commands.
35
     *
36
     * @var bool
0 ignored issues
show
Bug introduced by
Expected "boolean" but found "bool" for @var tag in member variable comment
Loading history...
37
     */
38
    protected $bReturnCode = false;
39
40
    /**
41
     * Set the response to attach the messages to.
42
     *
43
     * @param Response $xResponse    Whether to return the code
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
44
     *
45
     * @return void
46
     */
47
    final public function setResponse(Response $xResponse)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
48
    {
49
        $this->xResponse = $xResponse;
50
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
51
52
    /**
53
     * Get the <Jaxon\Response\Response> object
54
     *
55
     * @return Response
56
     */
57
    final protected function response(): Response
58
    {
59
        return $this->xResponse;
60
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
61
62
    /**
63
     * @param bool $bReturnCode
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
64
     *
65
     * @return MessageInterface
66
     */
67
    final public function setReturnCode(bool $bReturnCode): MessageInterface
68
    {
69
        $this->bReturnCode = $bReturnCode;
70
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type Jaxon\Ui\Dialog\Library\DialogLibraryTrait which is incompatible with the type-hinted return Jaxon\Ui\Dialog\MessageInterface.
Loading history...
71
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
72
73
    /**
74
     * Check if the library should return the js code or run it in the browser.
75
     *
76
     * @return bool
77
     */
78
    final protected function returnCode(): bool
79
    {
80
        return $this->bReturnCode;
81
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
82
}
83