From 38b1463a0f8cbc9c133e0763d9264f60fba22b8e Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Thu, 11 Jan 2018 08:48:50 +0100 Subject: [PATCH] Dev Scrutinizer Auto-Fixes (#933) This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- .../controllers/RegisterController.php | 6 ++-- application/controllers/admin/surveyadmin.php | 16 +++++----- application/helpers/admin/import_helper.php | 32 +++++++++---------- application/helpers/admin/label_helper.php | 12 +++---- .../helpers/update/updatedb_helper.php | 6 ++-- application/models/LabelSet.php | 14 ++++---- 6 files changed, 43 insertions(+), 43 deletions(-) diff --git a/application/controllers/RegisterController.php b/application/controllers/RegisterController.php index 04686d16a1a..d7607090695 100644 --- a/application/controllers/RegisterController.php +++ b/application/controllers/RegisterController.php @@ -191,7 +191,7 @@ public function getRegisterErrors($iSurveyId) * * @return Array The rendereable array */ - public function getRegisterSuccess($iSurveyId, $iTokenId){ + public function getRegisterSuccess($iSurveyId, $iTokenId) { $oSurvey = Survey::model()->findByPk($iSurveyId); $oToken = Token::model($iSurveyId)->findByPk($iTokenId); @@ -489,7 +489,7 @@ public function getStartDate($iSurveyId) * Display needed public page * @param $iSurveyId */ - private function display($iSurveyId, $iTokenId=null, $registerContent) + private function display($iSurveyId, $iTokenId = null, $registerContent) { $sLanguage = Yii::app()->language; $this->aGlobalData['surveyid'] = $surveyid = $iSurveyId; @@ -501,7 +501,7 @@ private function display($iSurveyId, $iTokenId=null, $registerContent) $oTemplate = Template::model()->getInstance('', $iSurveyId); - if($iTokenId!==null){ + if ($iTokenId !== null) { $aData['aSurveyInfo'] = self::getRegisterSuccess($iSurveyId, $iTokenId); $aData['registerSuccess'] = true; } else { diff --git a/application/controllers/admin/surveyadmin.php b/application/controllers/admin/surveyadmin.php index 363c40de5ae..b9fbd1ececf 100644 --- a/application/controllers/admin/surveyadmin.php +++ b/application/controllers/admin/surveyadmin.php @@ -1818,15 +1818,15 @@ private function _createSampleGroup($iSurveyID) { // Now create a new dummy group $sLanguage = Survey::model()->findByPk($iSurveyID)->language; - $oGroup=new QuestionGroup(); - $oGroup->sid=$iSurveyID; - $oGroup->group_order=1; - $oGroup->grelevance='1'; + $oGroup = new QuestionGroup(); + $oGroup->sid = $iSurveyID; + $oGroup->group_order = 1; + $oGroup->grelevance = '1'; $oGroup->save(); - $oGroupL10ns=new QuestionGroupL10ns(); - $oGroupL10ns->gid=$oGroup->gid; - $oGroupL10ns->group_name=gt('My first question group', 'html', $sLanguage); - $oGroupL10ns->language=$sLanguage; + $oGroupL10ns = new QuestionGroupL10ns(); + $oGroupL10ns->gid = $oGroup->gid; + $oGroupL10ns->group_name = gt('My first question group', 'html', $sLanguage); + $oGroupL10ns->language = $sLanguage; $oGroupL10ns->save(); return $oGroup->gid; } diff --git a/application/helpers/admin/import_helper.php b/application/helpers/admin/import_helper.php index dc06b5965ae..ea6d9eb80ea 100644 --- a/application/helpers/admin/import_helper.php +++ b/application/helpers/admin/import_helper.php @@ -141,7 +141,7 @@ function XMLImportGroup($sFullFilePath, $iNewSID) $iOldSID = $insertdata['sid']; $insertdata['sid'] = $iNewSID; $insertdata['gid'] = $aGIDReplacements[$insertdata['gid']]; - $oldqid = $insertdata['qid']; // save the old qid + $oldqid = $insertdata['qid']; // save the old qid unset($insertdata['qid']); if ($insertdata) { @@ -580,7 +580,7 @@ function XMLImportQuestion($sFullFilePath, $iNewSID, $newgid, $options = array(' $insertdata['sid'] = $iNewSID; $insertdata['gid'] = $newgid; $insertdata['question_order'] = $newquestionorder; - $iOldQID = $insertdata['qid']; // save the old qid + $iOldQID = $insertdata['qid']; // save the old qid unset($insertdata['qid']); // now translate any links @@ -929,7 +929,7 @@ function XMLImportLabelsets($sFullFilePath, $options) $results['labelsets'] = 0; $results['labels'] = 0; $results['warnings'] = array(); - $aImportedLabelSetIDs= array(); + $aImportedLabelSetIDs = array(); // Import label sets table =================================================================================== foreach ($xml->labelsets->rows->row as $row) { @@ -941,12 +941,12 @@ function XMLImportLabelsets($sFullFilePath, $options) unset($insertdata['lid']); // save the old qid // Insert the new question - $arLabelset= new LabelSet(); + $arLabelset = new LabelSet(); $arLabelset->setAttributes($insertdata); $arLabelset->save(); $aLSIDReplacements[$iOldLabelSetID] = $arLabelset->lid; // add old and new lsid to the mapping array $results['labelsets']++; - $aImportedLabelSetIDs[]=$arLabelset->lid; + $aImportedLabelSetIDs[] = $arLabelset->lid; } // Import labels table =================================================================================== @@ -959,22 +959,22 @@ function XMLImportLabelsets($sFullFilePath, $options) } $insertdata['lid'] = $aLSIDReplacements[$insertdata['lid']]; if ($iDBVersion < 350) { - $insertdataLS['title'] =$insertdata['title']; - $insertdataLS['language'] =$insertdata['language']; + $insertdataLS['title'] = $insertdata['title']; + $insertdataLS['language'] = $insertdata['language']; unset ($insertdata['title']); unset ($insertdata['language']); } else { - $iOldLabelID=$insertdata['id']; + $iOldLabelID = $insertdata['id']; } unset ($insertdata['id']); if ($iDBVersion < 350) { $findLabel = Label::model()->findByAttributes($insertdata); if (empty($findLabel)) { - $arLabel= new Label(); + $arLabel = new Label(); $arLabel->setAttributes($insertdata); $arLabel->save(); - $insertdataLS['label_id']=$arLabel->id; + $insertdataLS['label_id'] = $arLabel->id; } else { $insertdataLS['label_id'] = $findLabel->id; } @@ -982,10 +982,10 @@ function XMLImportLabelsets($sFullFilePath, $options) $arLabelL10n->setAttributes($insertdataLS); $arLabelL10n->save(); } else { - $arLabel= new Label(); + $arLabel = new Label(); $arLabel->setAttributes($insertdata); $arLabel->save(); - $aLIDReplacements[$iOldLabelID]=$arLabel->id; + $aLIDReplacements[$iOldLabelID] = $arLabel->id; } $results['labels']++; @@ -1015,10 +1015,10 @@ function XMLImportLabelsets($sFullFilePath, $options) $aCounts=array_count_values($aLabelSetCheckSums); foreach ($aImportedLabelSetIDs as $iLabelSetID) { - if ($aCounts[$aLabelSetCheckSums[$iLabelSetID]]>1) - { - LabelSet::model()->deleteLabelSet($iLabelSetID); - } + if ($aCounts[$aLabelSetCheckSums[$iLabelSetID]]>1) + { + LabelSet::model()->deleteLabelSet($iLabelSetID); + } } //END CHECK FOR DUPLICATES diff --git a/application/helpers/admin/label_helper.php b/application/helpers/admin/label_helper.php index 053bd40f65f..1f41a7a0dee 100644 --- a/application/helpers/admin/label_helper.php +++ b/application/helpers/admin/label_helper.php @@ -70,9 +70,9 @@ function updateset($lid) } $criteria->mergeWith($langcriteria); debugbreak(); - $aLabels=Label::model()->with('labelL10ns')->together()->findAll($criteria); + $aLabels = Label::model()->with('labelL10ns')->together()->findAll($criteria); foreach ($aLabels as $aLabel) { - foreach ($aLabel->labelL10ns as $aLabelL10ns){ + foreach ($aLabel->labelL10ns as $aLabelL10ns) { $aLabelL10ns->delete(); } } @@ -123,9 +123,9 @@ function modlabelsetanswers($lid) $sPostData = Yii::app()->getRequest()->getPost('dataToSend'); $sPostData = str_replace("\t", '', $sPostData); if (get_magic_quotes_gpc()) { - $data = json_decode(stripslashes($sPostData),true); + $data = json_decode(stripslashes($sPostData), true); } else { - $data = json_decode($sPostData,true); + $data = json_decode($sPostData, true); } if ($ajax) { @@ -135,8 +135,8 @@ function modlabelsetanswers($lid) if (count(array_unique($data['codelist'])) == count($data['codelist'])) { // First delete all labels without corresponding code - $aLabels=Label::model()->findAllByAttributes(['lid'=>$lid]); - foreach($aLabels as $aLabel) + $aLabels = Label::model()->findAllByAttributes(['lid'=>$lid]); + foreach ($aLabels as $aLabel) { // if {} } diff --git a/application/helpers/update/updatedb_helper.php b/application/helpers/update/updatedb_helper.php index 2ed1dce47c2..bc19f4aa0db 100644 --- a/application/helpers/update/updatedb_helper.php +++ b/application/helpers/update/updatedb_helper.php @@ -1025,11 +1025,11 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false) $oDB->createCommand()->dropColumn('{{labels}}', 'language'); - // Extend language field on labelsets - alterColumn('{{labelsets}}', 'languages', "string(255)", false); + // Extend language field on labelsets + alterColumn('{{labelsets}}', 'languages', "string(255)", false); // Extend question type field length - alterColumn('{{questions}}','type','string(30)',false,'T'); + alterColumn('{{questions}}', 'type', 'string(30)', false, 'T'); // Drop autoincrement on timings table primary key upgradeSurveyTimings350(); diff --git a/application/models/LabelSet.php b/application/models/LabelSet.php index 120f2b6dc26..21ab591f439 100644 --- a/application/models/LabelSet.php +++ b/application/models/LabelSet.php @@ -94,19 +94,19 @@ public function getLID() } /** - * Recursively deletes a label set including labels and localizations - * - * @param integer $id The label set ID - */ + * Recursively deletes a label set including labels and localizations + * + * @param integer $id The label set ID + */ public function deleteLabelSet($id) { - $arLabelSet=$this->findByPk($id); + $arLabelSet = $this->findByPk($id); if (empty($arLabelSet)) { return false; } - foreach($arLabelSet->labels as $arLabel) + foreach ($arLabelSet->labels as $arLabel) { - foreach($arLabel->labelL10ns as $arLabelL10n) + foreach ($arLabel->labelL10ns as $arLabelL10n) { $arLabelL10n->delete(); }