DialogTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A alert() 0 3 1
A modal() 0 3 1
1
<?php
2
3
namespace Jaxon\App\Dialog;
4
5
use Jaxon\Response\AjaxResponse;
6
7
trait DialogTrait
8
{
9
    /**
10
     * @return AjaxResponse
11
     */
12
    abstract protected function _response(): AjaxResponse;
13
14
    /**
15
     * @return AlertInterface
16
     */
17
    protected function alert(): AlertInterface
18
    {
19
        return $this->_response()->dialog;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->_response()->dialog returns the type Jaxon\Plugin\AbstractResponsePlugin|null which is incompatible with the type-hinted return Jaxon\App\Dialog\AlertInterface.
Loading history...
Bug Best Practice introduced by
The property dialog does not exist on Jaxon\Response\AjaxResponse. Since you implemented __get, consider adding a @property annotation.
Loading history...
20
    }
21
22
    /**
23
     * @return ModalInterface
24
     */
25
    protected function modal(): ModalInterface
26
    {
27
        return $this->_response()->dialog;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->_response()->dialog returns the type Jaxon\Plugin\AbstractResponsePlugin|null which is incompatible with the type-hinted return Jaxon\App\Dialog\ModalInterface.
Loading history...
Bug Best Practice introduced by
The property dialog does not exist on Jaxon\Response\AjaxResponse. Since you implemented __get, consider adding a @property annotation.
Loading history...
28
    }
29
}
30