Improved checks where substr_compare is used, replaced more substr + comapre cases with substr_compare

This commit is contained in:
Alexander Makarov
2014-07-30 02:15:08 +04:00
parent ca9d4867f4
commit 1c414caace
15 changed files with 49 additions and 37 deletions

View File

@@ -156,7 +156,7 @@ class HelpController extends Controller
if (is_dir($controllerPath)) {
$files = scandir($controllerPath);
foreach ($files as $file) {
if (strcmp(substr($file, -14), 'Controller.php') === 0) {
if (!empty($file) && substr_compare($file, 'Controller.php', -14) === 0) {
$controllerClass = $module->controllerNamespace . '\\' . substr(basename($file), 0, -4);
if ($this->validateControllerClass($controllerClass)) {
$commands[] = $prefix . Inflector::camel2id(substr(basename($file), 0, -14));