Passed
Push — v5.x ( 57c2ac...73bdb8 )
by Thierry
16:58 queued 05:55
created

ModalTrait::show()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 8
rs 10
cc 1
nc 1
nop 4
1
<?php
2
3
/**
4
 * ModalTrait.php - Show and hide dialogs.
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 2024 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\App\Dialog\Library;
14
15
trait ModalTrait
0 ignored issues
show
Coding Style introduced by
Missing doc comment for trait ModalTrait
Loading history...
16
{
17
    /**
18
     * Show a modal dialog.
19
     *
20
     * @param string $sTitle The title of the dialog
0 ignored issues
show
Coding Style introduced by
Expected 3 spaces after parameter name; 1 found
Loading history...
21
     * @param string $sContent The content of the dialog
22
     * @param array $aButtons The buttons of the dialog
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
23
     * @param array $aOptions The options of the dialog
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
24
     *
25
     * Each button is an array with the following entries:
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 24 spaces but found 1
Loading history...
26
     * - title: the text to be printed in the button
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 24 spaces but found 1
Loading history...
27
     * - class: the CSS class of the button
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 24 spaces but found 1
Loading history...
28
     * - click: the javascript function to be called when the button is clicked
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 24 spaces but found 1
Loading history...
29
     * If the click value is set to "close", then the button closes the dialog.
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 24 spaces but found 1
Loading history...
30
     *
31
     * The content of the $aOptions depends on the javascript library in use.
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 24 spaces but found 1
Loading history...
32
     * Check their specific documentation for more information.
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 24 spaces but found 1
Loading history...
33
     *
34
     * @return array
35
     */
36
    public function show(string $sTitle, string $sContent, array $aButtons, array $aOptions = []): array
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
37
    {
38
        return [
39
            'dialog' => [
40
                'title' => $sTitle,
41
                'content' => $sContent,
42
                'buttons' => $aButtons,
43
                'options' => $aOptions,
44
            ],
45
        ];
46
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
47
48
    /**
49
     * Hide the modal dialog.
50
     *
51
     * @return array
52
     */
53
    public function hide(): array
54
    {
55
        return [];
56
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
57
}
58