Minor - format code

pull/3064/head
Julio 5 years ago
parent 29e9e981eb
commit 2f6a4a7176
  1. 1
      ecs.yaml
  2. 4
      src/CoreBundle/Component/Editor/Editor.php
  3. 2
      src/CoreBundle/Component/Utils/ChamiloApi.php
  4. 2
      src/CoreBundle/Controller/CourseController.php
  5. 2
      src/CoreBundle/Controller/SessionController.php
  6. 2
      src/CoreBundle/Entity/Course.php
  7. 2
      src/CoreBundle/Entity/Session.php
  8. 2
      src/CoreBundle/Entity/SettingsCurrent.php
  9. 20
      src/CoreBundle/Migrations/Schema/V110/Version20151214170800.php
  10. 2
      src/CoreBundle/Repository/ExtraFieldRelTagRepository.php
  11. 4
      src/CoreBundle/Repository/ExtraFieldValuesRepository.php

@ -9,3 +9,4 @@ parameters:
sets: sets:
- 'clean-code' - 'clean-code'
- 'symfony' - 'symfony'
- 'symfony-risky'

@ -203,7 +203,7 @@ class Editor
// Arrays in JSON can't be associative. If the array is empty or if it // 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 // has sequential whole number keys starting with 0, it's not associative
// so we can go ahead and convert it as an array. // so we can go ahead and convert it as an array.
if (empty($var) || array_keys($var) === range(0, sizeof($var) - 1)) { if (empty($var) || array_keys($var) === range(0, count($var) - 1)) {
$output = []; $output = [];
foreach ($var as $v) { foreach ($var as $v) {
$output[] = $this->toJavascript($v); $output[] = $this->toJavascript($v);
@ -216,7 +216,7 @@ class Editor
// Otherwise, fall through to convert the array as an object. // Otherwise, fall through to convert the array as an object.
$output = []; $output = [];
foreach ($var as $k => $v) { foreach ($var as $k => $v) {
$output[] = $this->toJavascript(strval($k)).': '.$this->toJavascript($v); $output[] = $this->toJavascript((string) $k).': '.$this->toJavascript($v);
} }
return '{ '.implode(', ', $output).' }'; return '{ '.implode(', ', $output).' }';

@ -312,7 +312,7 @@ class ChamiloApi
foreach ($palette as $index => $color) { foreach ($palette as $index => $color) {
$components = preg_split('/,/', trim($color)); $components = preg_split('/,/', trim($color));
$components[3] = round($components[3] / 100, 1); $components[3] = round($components[3] / 100, 1);
$palette[$index] = join(',', $components); $palette[$index] = implode(',', $components);
} }
} }
if ($wrapInRGBA) { if ($wrapInRGBA) {

@ -99,7 +99,7 @@ class CourseController extends AbstractController
$courseTags = []; $courseTags = [];
if (!is_null($tagField)) { if (null !== $tagField) {
$courseTags = $fieldTagsRepo->getTags($tagField, $courseId); $courseTags = $fieldTagsRepo->getTags($tagField, $courseId);
} }

@ -67,7 +67,7 @@ class SessionController extends AbstractController
$sessionCourse = $sessionRelCourse->getCourse(); $sessionCourse = $sessionRelCourse->getCourse();
$courseTags = []; $courseTags = [];
if (!is_null($tagField)) { if (null !== $tagField) {
$courseTags = $fieldTagsRepo->getTags($tagField, $sessionCourse->getId()); $courseTags = $fieldTagsRepo->getTags($tagField, $sessionCourse->getId());
} }

@ -913,7 +913,7 @@ class Course extends AbstractResource implements ResourceInterface
*/ */
public function setDiskQuota($diskQuota) public function setDiskQuota($diskQuota)
{ {
$this->diskQuota = intval($diskQuota); $this->diskQuota = (int) $diskQuota;
return $this; return $this;
} }

@ -552,7 +552,7 @@ class Session
Criteria::expr()->eq('user', $user) Criteria::expr()->eq('user', $user)
); );
if (!is_null($status)) { if (null !== $status) {
$criteria->andWhere( $criteria->andWhere(
Criteria::expr()->eq('status', $status) Criteria::expr()->eq('status', $status)
); );

@ -374,7 +374,7 @@ class SettingsCurrent
*/ */
public function setAccessUrlLocked($accessUrlLocked) public function setAccessUrlLocked($accessUrlLocked)
{ {
$this->accessUrlLocked = intval($accessUrlLocked); $this->accessUrlLocked = (int) $accessUrlLocked;
return $this; return $this;
} }

@ -56,10 +56,10 @@ class Version20151214170800 extends AbstractMigrationChamilo
switch ($answer['hotspot_type']) { switch ($answer['hotspot_type']) {
case 'square': case 'square':
$oldCenter = explode(';', $oldPairedString[0]); $oldCenter = explode(';', $oldPairedString[0]);
$oldCenterX = intval($oldCenter[0]); $oldCenterX = (int) ($oldCenter[0]);
$oldCenterY = intval($oldCenter[1]); $oldCenterY = (int) ($oldCenter[1]);
$oldWidth = intval($oldPairedString[1]); $oldWidth = (int) ($oldPairedString[1]);
$oldHeight = intval($oldPairedString[2]); $oldHeight = (int) ($oldPairedString[2]);
$newX = floor(($oldCenterX - $oldWidth / 2) * $widthRatio) + ceil($widthRatio); $newX = floor(($oldCenterX - $oldWidth / 2) * $widthRatio) + ceil($widthRatio);
$newY = floor(($oldCenterY - $oldHeight / 2) * $heightRatio) + ceil($heightRatio); $newY = floor(($oldCenterY - $oldHeight / 2) * $heightRatio) + ceil($heightRatio);
@ -73,10 +73,10 @@ class Version20151214170800 extends AbstractMigrationChamilo
break; break;
case 'circle': case 'circle':
$oldCenter = explode(';', $oldPairedString[0]); $oldCenter = explode(';', $oldPairedString[0]);
$oldCenterX = intval($oldCenter[0]); $oldCenterX = (int) ($oldCenter[0]);
$oldCenterY = intval($oldCenter[1]); $oldCenterY = (int) ($oldCenter[1]);
$oldRadiusX = intval($oldPairedString[1]) / 2; $oldRadiusX = (int) ($oldPairedString[1]) / 2;
$oldRadiusY = intval($oldPairedString[2]) / 2; $oldRadiusY = (int) ($oldPairedString[2]) / 2;
$newCenterX = floor($oldCenterX * $widthRatio) + ceil($widthRatio); $newCenterX = floor($oldCenterX * $widthRatio) + ceil($widthRatio);
$newCenterY = floor($oldCenterY * $heightRatio) + ceil($heightRatio); $newCenterY = floor($oldCenterY * $heightRatio) + ceil($heightRatio);
@ -94,8 +94,8 @@ class Version20151214170800 extends AbstractMigrationChamilo
$paired = []; $paired = [];
foreach ($oldPairedString as $pairString) { foreach ($oldPairedString as $pairString) {
$pair = explode(';', $pairString); $pair = explode(';', $pairString);
$x = isset($pair[0]) ? intval($pair[0]) : 0; $x = isset($pair[0]) ? (int) ($pair[0]) : 0;
$y = isset($pair[1]) ? intval($pair[1]) : 0; $y = isset($pair[1]) ? (int) ($pair[1]) : 0;
$paired[] = [$x, $y]; $paired[] = [$x, $y];
} }

@ -47,7 +47,7 @@ class ExtraFieldRelTagRepository extends ServiceEntityRepository
) )
->where( ->where(
$queryBuilder->expr()->andX( $queryBuilder->expr()->andX(
$queryBuilder->expr()->eq('ft.itemId', intval($itemId)), $queryBuilder->expr()->eq('ft.itemId', (int) $itemId),
$queryBuilder->expr()->eq('ft.fieldId', $extraField->getId()) $queryBuilder->expr()->eq('ft.fieldId', $extraField->getId())
) )
); );

@ -46,8 +46,8 @@ class ExtraFieldValuesRepository extends ServiceEntityRepository
) )
->where( ->where(
$queryBuilder->expr()->andX( $queryBuilder->expr()->andX(
$queryBuilder->expr()->eq('f.extraFieldType', intval($extraFieldType)), $queryBuilder->expr()->eq('f.extraFieldType', (int) $extraFieldType),
$queryBuilder->expr()->eq('fv.itemId', intval($itemId)), $queryBuilder->expr()->eq('fv.itemId', (int) $itemId),
$queryBuilder->expr()->eq('f.visibleToSelf', true) $queryBuilder->expr()->eq('f.visibleToSelf', true)
) )
) )

Loading…
Cancel
Save