Conditions | 1 |
Paths | 1 |
Total Lines | 47 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
9 | protected function addHotKeyScript() |
||
10 | { |
||
11 | $filterID = $this->getFilter()->getFilterID(); |
||
|
|||
12 | |||
13 | $refreshMessage = __('admin.refresh_succeeded'); |
||
14 | |||
15 | $script = <<<SCRIPT |
||
16 | |||
17 | $(document).off('keydown').keydown(function(e) { |
||
18 | var tag = e.target.tagName.toLowerCase(); |
||
19 | |||
20 | if (tag == 'input' || tag == 'textarea') { |
||
21 | return; |
||
22 | } |
||
23 | |||
24 | var \$box = $("#{$this->tableID}").closest('.box'); |
||
25 | var \$current_page = \$box.find('.pagination .page-item.active'); |
||
26 | |||
27 | switch(e.which) { |
||
28 | case 82: // `r` for reload |
||
29 | $.admin.reload(); |
||
30 | $.admin.toastr.success('{$refreshMessage}', '', {positionClass:"toast-top-center"}); |
||
31 | break; |
||
32 | case 83: // `s` for search |
||
33 | \$box.find('input.grid-quick-search').trigger('focus'); |
||
34 | break; |
||
35 | case 70: // `f` for open filter |
||
36 | \$box.find('#{$filterID}').toggleClass('hide'); |
||
37 | break; |
||
38 | case 67: // `c` go to create page |
||
39 | \$box.find('.grid-create-btn>a').trigger('click'); |
||
40 | break; |
||
41 | case 37: // `left` for go to prev page |
||
42 | \$current_page.prev().find('a').trigger('click'); |
||
43 | break; |
||
44 | case 39: // `right` for go to next page |
||
45 | \$current_page.next().find('a').trigger('click'); |
||
46 | break; |
||
47 | default: return; |
||
48 | } |
||
49 | e.preventDefault(); |
||
50 | }); |
||
51 | |||
52 | SCRIPT; |
||
53 | |||
54 | Admin::script($script); |
||
55 | } |
||
56 | |||
63 | } |
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
Idable
provides a methodequalsId
that 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.