1 | <?php |
||
18 | class Settings extends Controller |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * Google Analytics Report Report model instance |
||
23 | * @var \gplcart\modules\ga_report\models\Report $report_model |
||
24 | */ |
||
25 | protected $report_model; |
||
26 | |||
27 | /** |
||
28 | * Settings constructor. |
||
29 | * @param Report $report_model |
||
30 | */ |
||
31 | public function __construct(Report $report_model) |
||
37 | |||
38 | /** |
||
39 | * Route page callback |
||
40 | * Displays the module settings page |
||
41 | */ |
||
42 | public function editSettings() |
||
55 | |||
56 | /** |
||
57 | * Returns an array of Google API credentials |
||
58 | * @return array |
||
59 | */ |
||
60 | protected function getCredentialSettings() |
||
66 | |||
67 | /** |
||
68 | * Set title on the module settings page |
||
69 | */ |
||
70 | protected function setTitleEditSettings() |
||
75 | |||
76 | /** |
||
77 | * Set breadcrumbs on the module settings page |
||
78 | */ |
||
79 | protected function setBreadcrumbEditSettings() |
||
95 | |||
96 | /** |
||
97 | * Saves the submitted settings |
||
98 | */ |
||
99 | protected function submitSettings() |
||
107 | |||
108 | /** |
||
109 | * Deletes all Google Analytics cached data |
||
110 | */ |
||
111 | protected function deleteCacheSettings() |
||
116 | |||
117 | /** |
||
118 | * Validate submitted module settings |
||
119 | */ |
||
120 | protected function validateSettings() |
||
132 | |||
133 | /** |
||
134 | * Validates Google Analytics profiles |
||
135 | */ |
||
136 | protected function validateGaProfileSettings() |
||
162 | |||
163 | /** |
||
164 | * Update module settings |
||
165 | */ |
||
166 | protected function updateSettings() |
||
173 | |||
174 | /** |
||
175 | * Render and output the module settings page |
||
176 | */ |
||
177 | protected function outputEditSettings() |
||
181 | |||
182 | } |
||
183 |
Let’s assume that you have a directory layout like this:
and let’s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: