From fc8fe965b78b2a690ffac3314ad2dc691c0fa07d Mon Sep 17 00:00:00 2001
From: Yannick Warnier
Date: Fri, 24 Mar 2017 18:37:56 -0500
Subject: [PATCH] Minor - Code style - Use "self" instead of classname within
the class and remove spaces around :: operator
---
main/attendance/index.php | 4 ++++
main/auth/cas/cas_var.inc.php | 2 +-
main/auth/cas/lib/CAS.php | 2 +-
main/exercise/export/exercise_import.php | 24 +++++++++----------
.../lib/gradebook_data_generator.class.php | 4 ++--
..._url_edit_courses_to_url_functions.lib.php | 2 +-
...many_session_to_category_functions.lib.php | 4 ++--
main/inc/lib/auth.lib.php | 4 ++--
main/inc/lib/certificate.lib.php | 2 +-
.../lib/formvalidator/Element/receivers.php | 2 +-
main/inc/lib/groupmanager.lib.php | 4 ++--
main/inc/lib/mp3player/is_autostart.as.php | 3 +--
main/inc/lib/zombie/zombie_report.class.php | 2 +-
main/lp/scorm.class.php | 6 ++---
main/session/session_import.php | 2 +-
main/survey/ch_dropdown.php | 2 +-
main/survey/ch_multiplechoice.php | 2 +-
main/survey/ch_multipleresponse.php | 2 +-
main/tracking/logins_details.php | 2 +-
.../cm_webservice_announcements.php | 2 +-
.../block_daily/block_daily.class.php | 2 +-
.../block_global_info.class.php | 4 ++--
.../block_student/block_student.class.php | 2 +-
.../Component/CourseCopy/CourseRestorer.php | 2 ++
src/Chamilo/ThemeBundle/Model/TaskModel.php | 4 ++--
25 files changed, 47 insertions(+), 44 deletions(-)
diff --git a/main/attendance/index.php b/main/attendance/index.php
index 51fa4f04f9..4ebde100c0 100755
--- a/main/attendance/index.php
+++ b/main/attendance/index.php
@@ -285,12 +285,16 @@ switch ($action) {
}
break;
case 'calendar_add':
+ //no break
case 'calendar_edit':
+ //no break
case 'calendar_all_delete':
+ //no break
case 'calendar_delete':
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed();
}
+ //no break
case 'calendar_list':
$attendanceController->attendance_calendar($action, $attendance_id, $calendar_id);
break;
diff --git a/main/auth/cas/cas_var.inc.php b/main/auth/cas/cas_var.inc.php
index 512a2d24ac..b4fbfb9ed5 100755
--- a/main/auth/cas/cas_var.inc.php
+++ b/main/auth/cas/cas_var.inc.php
@@ -20,7 +20,7 @@ switch (api_get_setting('cas_protocol')) {
case 'SAML':
$cas_auth_ver = SAML_VERSION_1_1;
break;
- default :
+ default:
$cas_auth_ver = CAS_VERSION_2_0;
break;
}
diff --git a/main/auth/cas/lib/CAS.php b/main/auth/cas/lib/CAS.php
index 3ef0065f4f..03954fa543 100755
--- a/main/auth/cas/lib/CAS.php
+++ b/main/auth/cas/lib/CAS.php
@@ -1013,7 +1013,7 @@ class phpCAS
self::trace('user is not authenticated, redirecting to the CAS server');
$PHPCAS_CLIENT->forceAuthentication();
} else {
- self::trace('no need to authenticate (user `' . phpCAS:: getUser() . '\' is already authenticated)');
+ self::trace('no need to authenticate (user `' . self::getUser() . '\' is already authenticated)');
}
self::traceEnd();
diff --git a/main/exercise/export/exercise_import.php b/main/exercise/export/exercise_import.php
index d931d740a0..da10f58f9b 100755
--- a/main/exercise/export/exercise_import.php
+++ b/main/exercise/export/exercise_import.php
@@ -34,20 +34,18 @@ $cmd = (isset($_REQUEST['cmd'])? $_REQUEST['cmd'] : 'show_import');
switch ($cmd) {
case 'show_import':
-
$display = ''
- . get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.') . ' '
- . '
'
- . '';
-
+ . get_lang('Imported exercises must consist of a zip or an XML file (IMS-QTI) and be compatible with your Claroline version.') . ' '
+ . '
'
+ . '';
break;
case 'import':
//include needed librabries for treatment
diff --git a/main/gradebook/lib/gradebook_data_generator.class.php b/main/gradebook/lib/gradebook_data_generator.class.php
index 85f9eb14f0..11a00977a5 100755
--- a/main/gradebook/lib/gradebook_data_generator.class.php
+++ b/main/gradebook/lib/gradebook_data_generator.class.php
@@ -213,7 +213,7 @@ class GradebookDataGenerator
api_get_session_id()
);
- $scoreDisplay = ScoreDisplay :: instance();
+ $scoreDisplay = ScoreDisplay::instance();
$display = $scoreDisplay->display_score($score, SCORE_DIV_PERCENT_WITH_CUSTOM, SCORE_BOTH, true);
$type = $item->get_item_type();
if ($type == 'L' && get_class($item) == 'ExerciseLink') {
@@ -234,7 +234,7 @@ class GradebookDataGenerator
private function buildAverageResultColumn(GradebookItem $item)
{
$score = $item->calc_score(null, 'average');
- $scoreDisplay = ScoreDisplay :: instance();
+ $scoreDisplay = ScoreDisplay::instance();
$display = $scoreDisplay->display_score($score, SCORE_DIV_PERCENT_WITH_CUSTOM, SCORE_BOTH, true);
$type = $item->get_item_type();
diff --git a/main/inc/lib/access_url_edit_courses_to_url_functions.lib.php b/main/inc/lib/access_url_edit_courses_to_url_functions.lib.php
index e90ec98397..1c5b943119 100755
--- a/main/inc/lib/access_url_edit_courses_to_url_functions.lib.php
+++ b/main/inc/lib/access_url_edit_courses_to_url_functions.lib.php
@@ -45,7 +45,7 @@ class Accessurleditcoursestourl
' LIMIT 11';
$rs = Database::query($sql);
$i=0;
- while ($course = Database :: fetch_array($rs)) {
+ while ($course = Database::fetch_array($rs)) {
$i++;
if ($i<=10) {
$return .= ''.$course['title'].' ('.$course['code'].') ';
diff --git a/main/inc/lib/add_many_session_to_category_functions.lib.php b/main/inc/lib/add_many_session_to_category_functions.lib.php
index 676d397f13..d6f631d417 100755
--- a/main/inc/lib/add_many_session_to_category_functions.lib.php
+++ b/main/inc/lib/add_many_session_to_category_functions.lib.php
@@ -24,7 +24,7 @@ class AddManySessionToCategoryFunctions
*/
function search_courses($needle,$type)
{
- $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
+ $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$xajax_response = new xajaxResponse();
$return = '';
if (!empty($needle) && !empty($type)) {
@@ -36,7 +36,7 @@ class AddManySessionToCategoryFunctions
$rs = Database::query($sql);
$course_list = array();
$return .= '';
- while ($course = Database :: fetch_array($rs)) {
+ while ($course = Database::fetch_array($rs)) {
$course_list[] = $course['id'];
$return .= ''.$course['name'].' ';
}
diff --git a/main/inc/lib/auth.lib.php b/main/inc/lib/auth.lib.php
index 08e06af904..cac78dbebe 100755
--- a/main/inc/lib/auth.lib.php
+++ b/main/inc/lib/auth.lib.php
@@ -409,8 +409,8 @@ class Auth
public function search_courses($search_term, $limit, $justVisible = false)
{
$courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
- $extraFieldTable = Database :: get_main_table(TABLE_EXTRA_FIELD);
- $extraFieldValuesTable = Database :: get_main_table(TABLE_EXTRA_FIELD_VALUES);
+ $extraFieldTable = Database::get_main_table(TABLE_EXTRA_FIELD);
+ $extraFieldValuesTable = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
$limitFilter = CourseCategory::getLimitFilterFromArray($limit);
diff --git a/main/inc/lib/certificate.lib.php b/main/inc/lib/certificate.lib.php
index d4a8190160..1962aa34cc 100755
--- a/main/inc/lib/certificate.lib.php
+++ b/main/inc/lib/certificate.lib.php
@@ -163,7 +163,7 @@ class Certificate extends Model
$params['hide_print_button'] = isset($params['hide_print_button']) ? true : false;
if (isset($this->certificate_data) && isset($this->certificate_data['cat_id'])) {
- $my_category = Category :: load($this->certificate_data['cat_id']);
+ $my_category = Category::load($this->certificate_data['cat_id']);
}
if (isset($my_category[0]) &&
diff --git a/main/inc/lib/formvalidator/Element/receivers.php b/main/inc/lib/formvalidator/Element/receivers.php
index 1161676d10..84e794b592 100755
--- a/main/inc/lib/formvalidator/Element/receivers.php
+++ b/main/inc/lib/formvalidator/Element/receivers.php
@@ -61,7 +61,7 @@ class HTML_QuickForm_receivers extends HTML_QuickForm_group
$renderer->setElementTemplate('{element}');
$select_boxes = $this->_elements[2];
$select_boxes->setElementTemplate(''.$select_boxes->_elementTemplate.'
');
- parent :: accept($renderer);
+ parent::accept($renderer);
$js = $this->getElementJS();
return $renderer->toHtml().$js;
}
diff --git a/main/inc/lib/groupmanager.lib.php b/main/inc/lib/groupmanager.lib.php
index bd83e32a85..4ca6d789e4 100755
--- a/main/inc/lib/groupmanager.lib.php
+++ b/main/inc/lib/groupmanager.lib.php
@@ -911,7 +911,7 @@ class GroupManager
if (!empty($groups)) {
foreach ($groups as $group) {
- GroupManager::set_group_properties(
+ self::set_group_properties(
$group['id'],
$group['name'],
$group['description'],
@@ -2143,7 +2143,7 @@ class GroupManager
$row[] = $this_group['id'];
}
- if (GroupManager::userHasAccessToBrowse($user_id, $this_group, $session_id)) {
+ if (self::userHasAccessToBrowse($user_id, $this_group, $session_id)) {
// Group name
$groupNameClass = null;
if ($this_group['status'] == 0) {
diff --git a/main/inc/lib/mp3player/is_autostart.as.php b/main/inc/lib/mp3player/is_autostart.as.php
index 6d69def74e..ec6221fe10 100755
--- a/main/inc/lib/mp3player/is_autostart.as.php
+++ b/main/inc/lib/mp3player/is_autostart.as.php
@@ -17,9 +17,8 @@ switch ($_SESSION['whereami']) {
case 'document/edit' :
$autostart = 'false';
break;
- default :
+ default:
$autostart = 'true';
}
echo utf8_encode('autostart='.$autostart);
-?>
diff --git a/main/inc/lib/zombie/zombie_report.class.php b/main/inc/lib/zombie/zombie_report.class.php
index 6062d4913c..6dffa5e3e3 100755
--- a/main/inc/lib/zombie/zombie_report.class.php
+++ b/main/inc/lib/zombie/zombie_report.class.php
@@ -304,7 +304,7 @@ class ZombieReport implements Countable
function format_email($email)
{
- return Display :: encrypted_mailto_link($email, $email);
+ return Display::encrypted_mailto_link($email, $email);
}
function display($return = false)
diff --git a/main/lp/scorm.class.php b/main/lp/scorm.class.php
index 6af8a04401..1d8bfcb704 100755
--- a/main/lp/scorm.class.php
+++ b/main/lp/scorm.class.php
@@ -548,7 +548,7 @@ class scorm extends learnpath
$courseInfo = empty($courseInfo) ? api_get_course_info() : $courseInfo;
- $maxFilledSpace = DocumentManager :: get_course_quota($courseInfo['code']);
+ $maxFilledSpace = DocumentManager::get_course_quota($courseInfo['code']);
$zip_file_path = $zip_file_info['tmp_name'];
$zip_file_name = $zip_file_info['name'];
@@ -888,8 +888,8 @@ class scorm extends learnpath
$zip_folder->create($scormfoldername.'/', PCLZIP_OPT_REMOVE_PATH, $scormfoldername.'/');
//This file sending implies removing the default mime-type from php.ini
- //DocumentManager :: file_send_for_download($zipfilename, true, $LPnamesafe.'.zip');
- DocumentManager :: file_send_for_download($zipfilename, true);
+ //DocumentManager::file_send_for_download($zipfilename, true, $LPnamesafe.'.zip');
+ DocumentManager::file_send_for_download($zipfilename, true);
// Delete the temporary zip file and directory in fileManage.lib.php
my_delete($zipfilename);
diff --git a/main/session/session_import.php b/main/session/session_import.php
index 740cb995f8..63255ddea2 100644
--- a/main/session/session_import.php
+++ b/main/session/session_import.php
@@ -79,7 +79,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
case 'teacher' :
$status = 1;
break;
- default :
+ default:
$status = 5;
$error_message .= get_lang('StudentStatusWasGivenTo').' : '.$username.' ';
}
diff --git a/main/survey/ch_dropdown.php b/main/survey/ch_dropdown.php
index a03b0f611b..71c59af0cf 100644
--- a/main/survey/ch_dropdown.php
+++ b/main/survey/ch_dropdown.php
@@ -22,7 +22,7 @@ class ch_dropdown extends survey_question
}
}
- parent :: addRemoveButtons($formData);
+ parent::addRemoveButtons($formData);
}
/**
diff --git a/main/survey/ch_multiplechoice.php b/main/survey/ch_multiplechoice.php
index 70bf6c33d6..b1a4a1f79a 100644
--- a/main/survey/ch_multiplechoice.php
+++ b/main/survey/ch_multiplechoice.php
@@ -45,7 +45,7 @@ class ch_multiplechoice extends survey_question
}
}
- parent :: addRemoveButtons($formData);
+ parent::addRemoveButtons($formData);
}
/**
diff --git a/main/survey/ch_multipleresponse.php b/main/survey/ch_multipleresponse.php
index b10e7b5ab3..9b462067ec 100644
--- a/main/survey/ch_multipleresponse.php
+++ b/main/survey/ch_multipleresponse.php
@@ -29,7 +29,7 @@ class ch_multipleresponse extends survey_question
}
}
- parent :: addRemoveButtons($formData);
+ parent::addRemoveButtons($formData);
}
/**
diff --git a/main/tracking/logins_details.php b/main/tracking/logins_details.php
index 907aafe583..eef7f875dc 100755
--- a/main/tracking/logins_details.php
+++ b/main/tracking/logins_details.php
@@ -124,7 +124,7 @@ $is_allowedToTrackEverybodyInCourse = $is_courseAdmin; // allowed to track all s
[" . get_lang('NextWeek') . " ]
";
break;
- default :
+ default:
$period = "month";
case "month" :
// previous and next date must be evaluated
diff --git a/main/webservices/cm_webservice_announcements.php b/main/webservices/cm_webservice_announcements.php
index 430558e064..bd10589797 100755
--- a/main/webservices/cm_webservice_announcements.php
+++ b/main/webservices/cm_webservice_announcements.php
@@ -63,7 +63,7 @@ class WSCMAnnouncements extends WSCM
$field_table = "content";
$announcements[0][$field_table] = nl2br_revert($announcements[0][$field_table]);
break;
- default :
+ default:
$field_table = "title";
}
diff --git a/plugin/dashboard/block_daily/block_daily.class.php b/plugin/dashboard/block_daily/block_daily.class.php
index 6aab591726..4413aec3b3 100755
--- a/plugin/dashboard/block_daily/block_daily.class.php
+++ b/plugin/dashboard/block_daily/block_daily.class.php
@@ -221,7 +221,7 @@ class BlockDaily extends Block
}
// Score
- $tbl_grade_categories = Database :: get_main_table(
+ $tbl_grade_categories = Database::get_main_table(
TABLE_MAIN_GRADEBOOK_CATEGORY
);
$sql = "SELECT id from " . $tbl_grade_categories . "
diff --git a/plugin/dashboard/block_global_info/block_global_info.class.php b/plugin/dashboard/block_global_info/block_global_info.class.php
index 95b41d6a1d..8306fe17e3 100755
--- a/plugin/dashboard/block_global_info/block_global_info.class.php
+++ b/plugin/dashboard/block_global_info/block_global_info.class.php
@@ -84,7 +84,7 @@ class BlockGlobalInfo extends Block
return $data;
}
- /**
+ /**
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* @return string content html
*/
@@ -95,7 +95,7 @@ class BlockGlobalInfo extends Block
$content = ''.get_lang('GlobalPlatformInformation').' ';
$data_table = null;
if (!empty($global_data)) {
- $data_table = '';
+ $data_table = '';
$i = 1;
foreach ($global_data as $data) {
if ($i%2 == 0) {
diff --git a/plugin/dashboard/block_student/block_student.class.php b/plugin/dashboard/block_student/block_student.class.php
index 19d6ddd9ff..dc61f38c36 100755
--- a/plugin/dashboard/block_student/block_student.class.php
+++ b/plugin/dashboard/block_student/block_student.class.php
@@ -122,7 +122,7 @@ class BlockStudent extends Block
$courseInfo = api_get_course_info($course_code);
$courseId = $courseInfo['real_id'];
$course_title = $course['title'];
- $time = api_time_to_hms(Tracking :: get_time_spent_on_the_course($student['user_id'], $courseId));
+ $time = api_time_to_hms(Tracking::get_time_spent_on_the_course($student['user_id'], $courseId));
$students_table .= '
'.$course_title.'
'.$time.'
diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php
index e051c53200..4c966f4f50 100644
--- a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php
+++ b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php
@@ -3236,12 +3236,14 @@ class CourseRestorer
if (!empty($workData)) {
continue;
}
+ break;
case FILE_OVERWRITE:
// Creating folder.
$workData = get_work_data_by_path(
$path,
$this->destination_course_info['real_id']
);
+ break;
case FILE_RENAME:
$obj->params['new_dir'] = $obj->params['title'];
diff --git a/src/Chamilo/ThemeBundle/Model/TaskModel.php b/src/Chamilo/ThemeBundle/Model/TaskModel.php
index d3a0ec757c..d783dda4c5 100644
--- a/src/Chamilo/ThemeBundle/Model/TaskModel.php
+++ b/src/Chamilo/ThemeBundle/Model/TaskModel.php
@@ -42,7 +42,7 @@ class TaskModel implements TaskInterface
/**
* @var string
*/
- protected $color = TaskModel::COLOR_AQUA;
+ protected $color = self::COLOR_AQUA;
/**
* @var null
@@ -54,7 +54,7 @@ class TaskModel implements TaskInterface
* @param int $progress
* @param string $color
*/
- function __construct($title = null, $progress = 0, $color = TaskModel::COLOR_AQUA)
+ function __construct($title = null, $progress = 0, $color = self::COLOR_AQUA)
{
$this->color = $color;
$this->progress = $progress;