From abeffdd8e457b616d8ddd7476e09e49dd7a8a983 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 24 Mar 2017 19:01:06 -0500 Subject: [PATCH] Minor - Code style - Use "self" instead of classname within the class and remove spaces around :: operator --- main/admin/course_export.php | 1 + main/gradebook/gradebook_display_summary.php | 1 - main/gradebook/lib/be/dropboxlink.class.php | 2 +- main/gradebook/lib/be/linkfactory.class.php | 2 +- main/inc/lib/access_url_edit_users_to_url_functions.lib.php | 2 +- main/inc/lib/add_course.lib.inc.php | 2 +- main/inc/lib/exercise.lib.php | 2 +- main/inc/lib/legal.lib.php | 2 +- main/inc/lib/redirect.class.php | 2 +- main/install/ajax.php | 1 - main/survey/ch_dropdown.php | 1 + plugin/openmeetings/lib/openmeetings_rest_service.php | 2 +- src/Chamilo/CoreBundle/Component/Editor/Editor.php | 6 ++++++ src/Chamilo/CoreBundle/Entity/TrackStoredValuesStack.php | 2 +- src/Chamilo/ThemeBundle/Model/UserModel.php | 2 +- 15 files changed, 18 insertions(+), 12 deletions(-) diff --git a/main/admin/course_export.php b/main/admin/course_export.php index 6b9d67b5e9..be866533be 100755 --- a/main/admin/course_export.php +++ b/main/admin/course_export.php @@ -99,6 +99,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) { break; case 'csv': Export::arrayToCsv($listToExport, $archiveFile); + break; case 'xls': Export::arrayToXls($listToExport, $archiveFile); break; diff --git a/main/gradebook/gradebook_display_summary.php b/main/gradebook/gradebook_display_summary.php index 9fc8e08ab6..350ed82b1a 100644 --- a/main/gradebook/gradebook_display_summary.php +++ b/main/gradebook/gradebook_display_summary.php @@ -31,7 +31,6 @@ $userList = CourseManager::get_user_list_from_course_code( switch ($action) { case 'export_all': - $params = array(); $pdf = new PDF('A4', 'P', $params); diff --git a/main/gradebook/lib/be/dropboxlink.class.php b/main/gradebook/lib/be/dropboxlink.class.php index 71dcf0d1e8..6616618d4d 100755 --- a/main/gradebook/lib/be/dropboxlink.class.php +++ b/main/gradebook/lib/be/dropboxlink.class.php @@ -57,7 +57,7 @@ class DropboxLink extends EvalLink */ private function get_dropbox_table() { - $this->dropbox_table = Database :: get_course_table(TABLE_DROPBOX_FILE); + $this->dropbox_table = Database::get_course_table(TABLE_DROPBOX_FILE); return $this->dropbox_table; } diff --git a/main/gradebook/lib/be/linkfactory.class.php b/main/gradebook/lib/be/linkfactory.class.php index b7dcf6139d..050b71b858 100755 --- a/main/gradebook/lib/be/linkfactory.class.php +++ b/main/gradebook/lib/be/linkfactory.class.php @@ -44,7 +44,7 @@ class LinkFactory */ public function get_evaluation_link($eval_id) { - $links = AbstractLink :: load(null, null, $eval_id); + $links = AbstractLink::load(null, null, $eval_id); foreach ($links as $link) { if (is_a($link, 'EvalLink')) { return $link; diff --git a/main/inc/lib/access_url_edit_users_to_url_functions.lib.php b/main/inc/lib/access_url_edit_users_to_url_functions.lib.php index 69d67d19e7..b82994866e 100755 --- a/main/inc/lib/access_url_edit_users_to_url_functions.lib.php +++ b/main/inc/lib/access_url_edit_users_to_url_functions.lib.php @@ -49,7 +49,7 @@ class Accessurledituserstourl $rs = Database::query($sql); $i=0; - while ($user = Database :: fetch_array($rs)) { + while ($user = Database::fetch_array($rs)) { $i++; if ($i<=10) { $return .= ''.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')
'; diff --git a/main/inc/lib/add_course.lib.inc.php b/main/inc/lib/add_course.lib.inc.php index d86935c43d..b0f97955f3 100755 --- a/main/inc/lib/add_course.lib.inc.php +++ b/main/inc/lib/add_course.lib.inc.php @@ -26,7 +26,7 @@ class AddCourse $add_unique_prefix = false, $use_code_indepedent_keys = true ) { - $course_table = Database :: get_main_table(TABLE_MAIN_COURSE); + $course_table = Database::get_main_table(TABLE_MAIN_COURSE); $wanted_code = CourseManager::generate_course_code($wanted_code); $keys_course_code = $wanted_code; if (!$use_code_indepedent_keys) { diff --git a/main/inc/lib/exercise.lib.php b/main/inc/lib/exercise.lib.php index 29e9af1b9c..8098175fb0 100644 --- a/main/inc/lib/exercise.lib.php +++ b/main/inc/lib/exercise.lib.php @@ -1364,7 +1364,7 @@ HTML; $result = Database::query($sql); $row = Database::fetch_array($result, 'ASSOC'); if (!empty($row['expired_time'])) { - $current_expired_time_key = ExerciseLib::get_time_control_key( + $current_expired_time_key = self::get_time_control_key( $exercise_id, $lp_id, $lp_item_id diff --git a/main/inc/lib/legal.lib.php b/main/inc/lib/legal.lib.php index a8fa71f4a1..eff66ca1aa 100755 --- a/main/inc/lib/legal.lib.php +++ b/main/inc/lib/legal.lib.php @@ -31,7 +31,7 @@ class LegalManager $time = time(); if ($last['content'] != $content) { - $version = intval(LegalManager::get_last_condition_version($language)); + $version = intval(self::get_last_condition_version($language)); $version++; $params = [ 'language_id' => $language, diff --git a/main/inc/lib/redirect.class.php b/main/inc/lib/redirect.class.php index 58e947f093..fcc85833e8 100755 --- a/main/inc/lib/redirect.class.php +++ b/main/inc/lib/redirect.class.php @@ -24,7 +24,7 @@ class Redirect public static function go($url = '') { if (empty($url)) { - Redirect::session_request_uri(); + self::session_request_uri(); $www = self::www(); self::navigate($www); } diff --git a/main/install/ajax.php b/main/install/ajax.php index 68d1f80483..de922da3f1 100644 --- a/main/install/ajax.php +++ b/main/install/ajax.php @@ -62,7 +62,6 @@ switch ($action) { echo $countOfTables; break; case 'remove_crs_tables': - $statement = $manager ->getConnection() ->executeQuery("SHOW TABLES LIKE '$db_c_prefix$db_prefix%'"); diff --git a/main/survey/ch_dropdown.php b/main/survey/ch_dropdown.php index 71c59af0cf..cff139df9f 100644 --- a/main/survey/ch_dropdown.php +++ b/main/survey/ch_dropdown.php @@ -29,6 +29,7 @@ class ch_dropdown extends survey_question * @param FormValidator $form * @param array $questionData * @param array $answers + * @return void */ public function render(FormValidator $form, $questionData = array(), $answers = '') { diff --git a/plugin/openmeetings/lib/openmeetings_rest_service.php b/plugin/openmeetings/lib/openmeetings_rest_service.php index 57db66015f..09fe318308 100755 --- a/plugin/openmeetings/lib/openmeetings_rest_service.php +++ b/plugin/openmeetings/lib/openmeetings_rest_service.php @@ -90,7 +90,7 @@ class OpenMeetingsRestService The exact error is returned in the XML response.' ); return false; break; - default : + default: error_log( 'Your call to OpenMeetings Web Services '.$extra.' returned an unexpected HTTP status of: ' . $status_code [0] . " Request " . $request ); return false; } diff --git a/src/Chamilo/CoreBundle/Component/Editor/Editor.php b/src/Chamilo/CoreBundle/Component/Editor/Editor.php index 2d3e469bef..9c5d61cf8a 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/Editor.php +++ b/src/Chamilo/CoreBundle/Component/Editor/Editor.php @@ -128,15 +128,19 @@ class Editor case 'boolean': return $var ? 'true' : 'false'; // Lowercase necessary! case 'integer': + //no break case 'double': return (string)$var; + //no break case 'resource': + //no break case 'string': return '"'.str_replace( array("\r", "\n", "<", ">", "&"), array('\r', '\n', '\x3c', '\x3e', '\x26'), addslashes($var) ).'"'; + break; case 'array': // Arrays in JSON can't be associative. If the array is empty or if it // has sequential whole number keys starting with 0, it's not associative @@ -149,6 +153,7 @@ class Editor return '[ '.implode(', ', $output).' ]'; } + break; case 'object': // Otherwise, fall through to convert the array as an object. $output = array(); @@ -156,6 +161,7 @@ class Editor $output[] = $this->toJavascript(strval($k)).': '.$this->toJavascript($v); } return '{ '.implode(', ', $output).' }'; + break; default: return 'null'; } diff --git a/src/Chamilo/CoreBundle/Entity/TrackStoredValuesStack.php b/src/Chamilo/CoreBundle/Entity/TrackStoredValuesStack.php index 03c44eadad..0278d22ec3 100644 --- a/src/Chamilo/CoreBundle/Entity/TrackStoredValuesStack.php +++ b/src/Chamilo/CoreBundle/Entity/TrackStoredValuesStack.php @@ -20,7 +20,7 @@ use Doctrine\ORM\Mapping as ORM; * @ORM\Entity */ class TrackStoredValuesStack -{ +{ /** * @var integer * diff --git a/src/Chamilo/ThemeBundle/Model/UserModel.php b/src/Chamilo/ThemeBundle/Model/UserModel.php index d64d5ced13..e166576407 100644 --- a/src/Chamilo/ThemeBundle/Model/UserModel.php +++ b/src/Chamilo/ThemeBundle/Model/UserModel.php @@ -8,7 +8,7 @@ namespace Chamilo\ThemeBundle\Model; -class UserModel implements UserInterface +class UserModel implements UserInterface { /**