1 | <?php |
||
13 | trait Files { |
||
14 | /** |
||
15 | * Include files necessary for module page rendering |
||
16 | * |
||
17 | * @param \cs\Request $Request |
||
18 | * |
||
19 | * @throws \cs\ExitException |
||
20 | */ |
||
21 | protected function files_router ($Request) { |
||
33 | /** |
||
34 | * Include files that corresponds for specific paths in URL |
||
35 | * |
||
36 | * @param \cs\Request $Request |
||
37 | * @param string $dir |
||
38 | * @param string $basename |
||
39 | * @param bool $required |
||
40 | * |
||
41 | * @throws \cs\ExitException |
||
42 | */ |
||
43 | protected function files_router_handler ($Request, $dir, $basename, $required = true) { |
||
46 | /** |
||
47 | * @param \cs\Request $Request |
||
48 | * @param string $dir |
||
49 | * @param string $basename |
||
50 | * @param bool $required |
||
51 | * |
||
52 | * @throws \cs\ExitException |
||
53 | */ |
||
54 | protected function files_router_handler_internal ($Request, $dir, $basename, $required) { |
||
70 | /** |
||
71 | * @param string $dir |
||
72 | * @param string $basename |
||
73 | * |
||
74 | * @return string[] |
||
75 | */ |
||
76 | protected function files_router_available_methods ($dir, $basename) { |
||
82 | } |
||
83 |
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.