/**
  * get all available commands and add to cli application.
  */
 private function grabAllAvailableCommands()
 {
     $Modules = new \System\Libraries\Modules($this->Silexapp);
     $Modules->registerAutoload();
     $modules_list = $Modules->getAllAvailableModules();
     unset($Modules);
     // system/Core/Console
     if (is_file(SYSTEM_PATH . DS . 'Core' . DS . 'Console' . DS . 'Commands.php')) {
         $SystemCommands = new \System\Core\Console\Commands();
         $SystemCommands->Silexapp = $this->Silexapp;
         if (method_exists($SystemCommands, 'register')) {
             $registered_commands = $SystemCommands->register();
             if (is_array($registered_commands) && !empty($registered_commands)) {
                 $this->CliApp->addCommands($registered_commands);
             }
             unset($registered_commands);
         }
         unset($SystemCommands);
     }
     // modules/module_name/Console
     if (is_array($modules_list) && array_key_exists('items', $modules_list) && is_array($modules_list['items'])) {
         foreach ($modules_list['items'] as $row) {
             if (is_file(MODULE_PATH . DS . 'Console' . DS . 'Commands.php')) {
                 $module_commands_class = '\\Modules\\' . $row->module_system_name . '\\Console\\Commands()';
                 $ModuleCommands = new $module_commands_class();
                 $ModuleCommands->Silexapp = $this->Silexapp;
                 if (method_exists($ModuleCommands, 'register')) {
                     $registered_commands = $ModuleCommands->register();
                     if (is_array($registered_commands) && !empty($registered_commands)) {
                         $this->CliApp->addCommands($registered_commands);
                     }
                     unset($registered_commands);
                 }
                 unset($ModuleCommands, $module_commands_class);
             }
         }
         // endforeach;
         unset($row);
     }
     unset($modules_list);
 }