Passed
Push — v5.x ( 0160d0 )
by Thierry
09:10
created

OverhangLibrary::success()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * OverhangLibrary.php
5
 *
6
 * Adapter for the Overhang library.
7
 *
8
 * @package jaxon-dialogs
9
 * @author Thierry Feuzeu <[email protected]>
10
 * @copyright 2016 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-dialogs
13
 */
14
15
namespace Jaxon\Dialogs\Overhang;
16
17
use Jaxon\App\Dialog\Library\DialogLibraryTrait;
18
use Jaxon\App\Dialog\Library\MessageTrait;
0 ignored issues
show
Bug introduced by
The type Jaxon\App\Dialog\Library\MessageTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use Jaxon\App\Dialog\Library\QuestionTrait;
0 ignored issues
show
Bug introduced by
The type Jaxon\App\Dialog\Library\QuestionTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
use Jaxon\App\Dialog\MessageInterface;
21
use Jaxon\App\Dialog\QuestionInterface;
22
23
class OverhangLibrary implements MessageInterface, QuestionInterface
24
{
25
    use DialogLibraryTrait;
26
    use MessageTrait;
27
    use QuestionTrait;
28
29
    /**
30
     * @const The library name
31
     */
32
    const NAME = 'overhang';
33
34
    /**
35
     * @inheritDoc
36
     */
37
    public function getName(): string
38
    {
39
        return self::NAME;
40
    }
41
42
    /**
43
     * @inheritDoc
44
     */
45
    public function getSubdir(): string
46
    {
47
        return 'overhang';
48
    }
49
50
    /**
51
     * @inheritDoc
52
     */
53
    public function getVersion(): string
54
    {
55
        return 'latest';
56
    }
57
58
    /**
59
     * @inheritDoc
60
     */
61
    public function getJs(): string
62
    {
63
        return $this->helper()->getJsCode('overhang.min.js');
64
    }
65
66
    /**
67
     * @inheritDoc
68
     */
69
    public function getCss(): string
70
    {
71
        return $this->helper()->getCssCode('overhang.min.css');
72
    }
73
74
    /**
75
     * @inheritDoc
76
     */
77
    public function getScript(): string
78
    {
79
        return $this->helper()->render('overhang/alert.js');
80
    }
81
82
    /**
83
     * @inheritDoc
84
     */
85
    public function getReadyScript(): string
86
    {
87
        return $this->helper()->render('overhang/ready.js.php');
88
    }
89
90
    /**
91
     * @inheritDoc
92
     */
93
    protected function alert(string $sMessage, string $sTitle, string $sStdType)
94
    {
95
        $aTypes = [
96
            'warning' => 'warn',
97
        ];
98
        $sType = $aTypes[$sStdType] ?? $sStdType;
99
        $this->addCommand('overhang.alert', ['message' => $sMessage, 'type' => $sType]);
0 ignored issues
show
Bug introduced by
'overhang.alert' of type string is incompatible with the type array expected by parameter $aAttributes of Jaxon\Dialogs\Overhang\O...ngLibrary::addCommand(). ( Ignorable by Annotation )

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

99
        $this->addCommand(/** @scrutinizer ignore-type */ 'overhang.alert', ['message' => $sMessage, 'type' => $sType]);
Loading history...
100
    }
101
}
102