| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public function registerJsHook(string $reqHeaderParamName): void |
||
| 11 | { |
||
| 12 | $id = $this->getId(); |
||
|
|
|||
| 13 | $headerName = Action::EXPECTED_AJAX_RESPONSE_HEADER_NAME; |
||
| 14 | $this->view->registerJs("$.ajax({ |
||
| 15 | type: 'GET', |
||
| 16 | url: document.URL, |
||
| 17 | beforeSend: xhr => { |
||
| 18 | xhr.setRequestHeader('{$headerName}', '{$reqHeaderParamName}'); |
||
| 19 | }, |
||
| 20 | success: html => { |
||
| 21 | $('#{$id}').html(html); |
||
| 22 | } |
||
| 23 | });", View::POS_LOAD); |
||
| 24 | } |
||
| 25 | } |
||
| 26 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.