1 | <?php |
||
26 | trait Config |
||
27 | { |
||
28 | /** |
||
29 | * Set the default options of all components of the library |
||
30 | * |
||
31 | * @return void |
||
32 | */ |
||
33 | private function setDefaultOptions() |
||
64 | |||
65 | /** |
||
66 | * Read and set Jaxon options from a PHP config file |
||
67 | * |
||
68 | * @param string $sConfigFile The full path to the config file |
||
69 | * @param string $sLibKey The key of the library options in the file |
||
70 | * @param string|null $sAppKey The key of the application options in the file |
||
71 | * |
||
72 | * @return array |
||
73 | */ |
||
74 | public function readPhpConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
||
78 | |||
79 | /** |
||
80 | * Read and set Jaxon options from a YAML config file |
||
81 | * |
||
82 | * @param string $sConfigFile The full path to the config file |
||
83 | * @param string $sLibKey The key of the library options in the file |
||
84 | * @param string|null $sAppKey The key of the application options in the file |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | public function readYamlConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
||
92 | |||
93 | /** |
||
94 | * Read and set Jaxon options from a JSON config file |
||
95 | * |
||
96 | * @param string $sConfigFile The full path to the config file |
||
97 | * @param string $sLibKey The key of the library options in the file |
||
98 | * @param string|null $sAppKey The key of the application options in the file |
||
99 | * |
||
100 | * @return array |
||
101 | */ |
||
102 | public function readJsonConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
||
106 | |||
107 | /** |
||
108 | * Read and set Jaxon options from a config file |
||
109 | * |
||
110 | * @param string $sConfigFile The full path to the config file |
||
111 | * @param string $sLibKey The key of the library options in the file |
||
112 | * @param string|null $sAppKey The key of the application options in the file |
||
113 | * |
||
114 | * @return array |
||
115 | */ |
||
116 | public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
||
133 | } |
||
134 |
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.