Fix arguments type hint

pull/3844/head
Julio Montoya 5 years ago
parent 67e16cafe5
commit b486e64043
  1. 2
      src/CoreBundle/Component/Resource/Template.php
  2. 68
      src/CoreBundle/Component/Utils/ChamiloApi.php
  3. 14
      src/CoreBundle/Composer/ScriptHandler.php
  4. 4
      src/CoreBundle/Controller/Admin/AdminController.php
  5. 8
      src/CoreBundle/Controller/Admin/SettingsController.php
  6. 2
      src/CoreBundle/Controller/CourseController.php
  7. 30
      src/CoreBundle/Controller/CourseHomeController.php
  8. 4
      src/CoreBundle/Controller/EditorController.php
  9. 4
      src/CoreBundle/Controller/NewsController.php
  10. 4
      src/CoreBundle/Controller/OnlineController.php
  11. 4
      src/CoreBundle/Controller/ResetPasswordController.php
  12. 6
      src/CoreBundle/Controller/ResourceController.php
  13. 3
      src/CoreBundle/Controller/ResourceUploadController.php
  14. 2
      src/CoreBundle/Controller/SessionController.php
  15. 4
      src/CoreBundle/Controller/UserController.php
  16. 2
      src/CoreBundle/DataProvider/Extension/CDocumentExtension.php
  17. 2
      src/CoreBundle/DependencyInjection/Compiler/DoctrineEntityListenerPass.php
  18. 2
      src/CoreBundle/DependencyInjection/Compiler/ToolCompilerClass.php

@ -60,7 +60,7 @@ class Template
return $this->{$action}; return $this->{$action};
} }
throw new InvalidArgumentException("No template found for action: {$action}"); throw new InvalidArgumentException(sprintf('No template found for action: %s', $action));
} }
public function setIndex(string $index): self public function setIndex(string $index): self

@ -36,11 +36,9 @@ class ChamiloApi
} }
/** /**
* @param string $variable
*
* @return bool|string * @return bool|string
*/ */
public static function getConfigurationValue($variable) public static function getConfigurationValue(string $variable)
{ {
$configuration = self::getConfigurationArray(); $configuration = self::getConfigurationArray();
if (array_key_exists($variable, $configuration)) { if (array_key_exists($variable, $configuration)) {
@ -74,13 +72,9 @@ class ChamiloApi
/** /**
* Get the platform logo path. * Get the platform logo path.
* *
* @param string $theme
* @param bool $getSysPath
* @param bool $forcedGetter
*
* @return null|string * @return null|string
*/ */
public static function getPlatformLogoPath($theme = '', $getSysPath = false, $forcedGetter = false) public static function getPlatformLogoPath(string $theme = '', bool $getSysPath = false, bool $forcedGetter = false)
{ {
static $logoPath; static $logoPath;
@ -99,22 +93,22 @@ class ChamiloApi
} }
} }
$themeDir = Template::getThemeDir($theme); $themeDir = Template::getThemeDir($theme);
$customLogoPath = $themeDir."images/header-logo-custom{$accessUrlId}.png"; $customLogoPath = $themeDir.sprintf('images/header-logo-custom%s.png', $accessUrlId);
$svgIcons = api_get_setting('icons_mode_svg'); $svgIcons = api_get_setting('icons_mode_svg');
if ('true' === $svgIcons) { if ('true' === $svgIcons) {
$customLogoPathSVG = substr($customLogoPath, 0, -3).'svg'; $customLogoPathSVG = substr($customLogoPath, 0, -3).'svg';
if (file_exists(api_get_path(SYS_PUBLIC_PATH)."css/{$customLogoPathSVG}")) { if (file_exists(api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPathSVG))) {
if ($getSysPath) { if ($getSysPath) {
return api_get_path(SYS_PUBLIC_PATH)."css/{$customLogoPathSVG}"; return api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPathSVG);
} }
return api_get_path(WEB_CSS_PATH).$customLogoPathSVG; return api_get_path(WEB_CSS_PATH).$customLogoPathSVG;
} }
} }
if (file_exists(api_get_path(SYS_PUBLIC_PATH)."css/{$customLogoPath}")) { if (file_exists(api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPath))) {
if ($getSysPath) { if ($getSysPath) {
return api_get_path(SYS_PUBLIC_PATH)."css/{$customLogoPath}"; return api_get_path(SYS_PUBLIC_PATH).sprintf('css/%s', $customLogoPath);
} }
return api_get_path(WEB_CSS_PATH).$customLogoPath; return api_get_path(WEB_CSS_PATH).$customLogoPath;
@ -147,20 +141,16 @@ class ChamiloApi
/** /**
* Get the platform logo. * Get the platform logo.
* Return a <img> if the logo image exists. Otherwise return a <h2> with the institution name. * Return a <img> if the logo image exists.
* * Otherwise return a <h2> with the institution name.
* @param string $theme
* @param array $imageAttributes optional
* @param bool $getSysPath
* @param bool $forcedGetter
* *
* @return string * @return string
*/ */
public static function getPlatformLogo( public static function getPlatformLogo(
$theme = '', string $theme = '',
$imageAttributes = [], array $imageAttributes = [],
$getSysPath = false, bool $getSysPath = false,
$forcedGetter = false bool $forcedGetter = false
) { ) {
$logoPath = self::getPlatformLogoPath($theme, $getSysPath, $forcedGetter); $logoPath = self::getPlatformLogoPath($theme, $getSysPath, $forcedGetter);
$institution = api_get_setting('Institution'); $institution = api_get_setting('Institution');
@ -204,12 +194,11 @@ class ChamiloApi
/** /**
* Like strip_tags(), but leaves an additional space and removes only the given tags. * Like strip_tags(), but leaves an additional space and removes only the given tags.
* *
* @param string $string
* @param array $tags Tags to be removed * @param array $tags Tags to be removed
* *
* @return string The original string without the given tags * @return string The original string without the given tags
*/ */
public static function stripGivenTags($string, $tags) public static function stripGivenTags(string $string, array $tags)
{ {
foreach ($tags as $tag) { foreach ($tags as $tag) {
$string2 = preg_replace('#</\b'.$tag.'\b[^>]*>#i', ' ', $string); $string2 = preg_replace('#</\b'.$tag.'\b[^>]*>#i', ' ', $string);
@ -230,10 +219,12 @@ class ChamiloApi
* *
* @return string * @return string
*/ */
public static function addOrSubTimeToDateTime($time, $datetime = 'now', $operation = true) public static function addOrSubTimeToDateTime(string $time, string $datetime = 'now', bool $operation = true)
{ {
$date = new DateTime($datetime); $date = new DateTime($datetime);
$hours = $minutes = $seconds = 0; $hours = 0;
$minutes = 0;
$seconds = 0;
sscanf($time, '%d:%d:%d', $hours, $minutes, $seconds); sscanf($time, '%d:%d:%d', $hours, $minutes, $seconds);
$timeSeconds = isset($seconds) ? $hours * 3600 + $minutes * 60 + $seconds : $hours * 60 + $minutes; $timeSeconds = isset($seconds) ? $hours * 3600 + $minutes * 60 + $seconds : $hours * 60 + $minutes;
if ($operation) { if ($operation) {
@ -252,7 +243,7 @@ class ChamiloApi
* *
* @return int * @return int
*/ */
public static function getCourseIdByDirectory($directory = null) public static function getCourseIdByDirectory(string $directory = null)
{ {
if (!empty($directory)) { if (!empty($directory)) {
$directory = Database::escape_string($directory); $directory = Database::escape_string($directory);
@ -292,12 +283,9 @@ class ChamiloApi
/** /**
* Get a variable name for language file from a text. * Get a variable name for language file from a text.
* *
* @param string $text
* @param string $prefix
*
* @return string * @return string
*/ */
public static function getLanguageVar($text, $prefix = '') public static function getLanguageVar(string $text, string $prefix = '')
{ {
$text = api_replace_dangerous_char($text); $text = api_replace_dangerous_char($text);
$text = str_replace(['-', ' ', '.'], '_', $text); $text = str_replace(['-', ' ', '.'], '_', $text);
@ -317,10 +305,10 @@ class ChamiloApi
{ {
$visualTheme = api_get_visual_theme(); $visualTheme = api_get_visual_theme();
$cssFile = api_get_path(SYS_CSS_PATH)."themes/{$visualTheme}/document.css"; $cssFile = api_get_path(SYS_CSS_PATH).sprintf('themes/%s/document.css', $visualTheme);
if (is_file($cssFile)) { if (is_file($cssFile)) {
return api_get_path(WEB_CSS_PATH)."themes/{$visualTheme}/document.css"; return api_get_path(WEB_CSS_PATH).sprintf('themes/%s/document.css', $visualTheme);
} }
return api_get_path(WEB_CSS_PATH).'document.css'; return api_get_path(WEB_CSS_PATH).'document.css';
@ -335,10 +323,10 @@ class ChamiloApi
{ {
$visualTheme = api_get_visual_theme(); $visualTheme = api_get_visual_theme();
$cssFile = api_get_path(SYS_CSS_PATH)."themes/{$visualTheme}/editor_content.css"; $cssFile = api_get_path(SYS_CSS_PATH).sprintf('themes/%s/editor_content.css', $visualTheme);
if (is_file($cssFile)) { if (is_file($cssFile)) {
return api_get_path(WEB_CSS_PATH)."themes/{$visualTheme}/editor_content.css"; return api_get_path(WEB_CSS_PATH).sprintf('themes/%s/editor_content.css', $visualTheme);
} }
return api_get_path(WEB_CSS_PATH).'editor_content.css'; return api_get_path(WEB_CSS_PATH).'editor_content.css';
@ -355,9 +343,9 @@ class ChamiloApi
* @return array An array of string colors * @return array An array of string colors
*/ */
public static function getColorPalette( public static function getColorPalette(
$decimalOpacity = false, bool $decimalOpacity = false,
$wrapInRGBA = false, bool $wrapInRGBA = false,
$fillUpTo = null int $fillUpTo = null
) { ) {
// Get the common colors from the palette used for pchart // Get the common colors from the palette used for pchart
$paletteFile = api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color'; $paletteFile = api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color';
@ -399,7 +387,7 @@ class ChamiloApi
* *
* @return DateTime * @return DateTime
*/ */
public static function getServerMidnightTime($utcTime = null) public static function getServerMidnightTime(?string $utcTime = null)
{ {
$localTime = api_get_local_time($utcTime); $localTime = api_get_local_time($utcTime);
$localTimeZone = api_get_timezone(); $localTimeZone = api_get_timezone();

@ -261,13 +261,9 @@ class ScriptHandler
/** /**
* Copied from chamilo rmdirr function. * Copied from chamilo rmdirr function.
* *
* @param string $dirname
* @param bool|false $delete_only_content_in_folder
* @param bool|false $strict
*
* @return bool * @return bool
*/ */
private static function rmdirr($dirname, $delete_only_content_in_folder = false, $strict = false) private static function rmdirr(string $dirname, bool $delete_only_content_in_folder = false, bool $strict = false)
{ {
$res = true; $res = true;
@ -293,14 +289,14 @@ class ScriptHandler
// Recurse. // Recurse.
if ($strict) { if ($strict) {
$result = self::rmdirr("{$dirname}/{$entry}"); $result = self::rmdirr(sprintf('%s/%s', $dirname, $entry));
if (false === $result) { if (!$result) {
$res = false; $res = false;
break; break;
} }
} else { } else {
self::rmdirr("{$dirname}/{$entry}"); self::rmdirr(sprintf('%s/%s', $dirname, $entry));
} }
} }
} }
@ -310,7 +306,7 @@ class ScriptHandler
$dir->close(); $dir->close();
} }
if (false === $delete_only_content_in_folder) { if (!$delete_only_content_in_folder) {
$res = rmdir($dirname); $res = rmdir($dirname);
} }

@ -39,11 +39,9 @@ class AdminController extends BaseController
} }
/** /**
* @param string $url
*
* @return FormValidator * @return FormValidator
*/ */
private function getSearchForm($url) private function getSearchForm(string $url)
{ {
$form = new FormValidator( $form = new FormValidator(
'search-form', 'search-form',

@ -111,10 +111,8 @@ class SettingsController extends BaseController
* @IsGranted("ROLE_ADMIN") * @IsGranted("ROLE_ADMIN")
* *
* @Route("/settings/{namespace}", name="chamilo_platform_settings") * @Route("/settings/{namespace}", name="chamilo_platform_settings")
*
* @param string $namespace
*/ */
public function updateSettingAction(Request $request, $namespace): Response public function updateSettingAction(Request $request, string $namespace): Response
{ {
$manager = $this->getSettingsManager(); $manager = $this->getSettingsManager();
// @todo improve get the current url entity // @todo improve get the current url entity
@ -169,9 +167,9 @@ class SettingsController extends BaseController
try { try {
$manager->save($form->getData()); $manager->save($form->getData());
$message = $this->trans('Settings have been successfully updated'); $message = $this->trans('Settings have been successfully updated');
} catch (ValidatorException $exception) { } catch (ValidatorException $validatorException) {
//$message = $this->trans($exception->getMessage(), [], 'validators'); //$message = $this->trans($exception->getMessage(), [], 'validators');
$message = $this->trans($exception->getMessage()); $message = $this->trans($validatorException->getMessage());
$messageType = 'error'; $messageType = 'error';
} }

@ -87,7 +87,7 @@ class CourseController extends AbstractController
$courseValues = new ExtraFieldValue('course'); $courseValues = new ExtraFieldValue('course');
$urlCourse = api_get_path(WEB_PATH)."course/{$courseId}/about"; $urlCourse = api_get_path(WEB_PATH).sprintf('course/%s/about', $courseId);
$courseTeachers = $course->getTeachers(); $courseTeachers = $course->getTeachers();
$teachersData = []; $teachersData = [];

@ -56,7 +56,7 @@ class CourseHomeController extends ToolBaseController
$userId = 0; $userId = 0;
$user = $this->getUser(); $user = $this->getUser();
if ($user) { if (null !== $user) {
$userId = $this->getUser()->getId(); $userId = $this->getUser()->getId();
} }
@ -80,11 +80,9 @@ class CourseHomeController extends ToolBaseController
$isSpecialCourse = CourseManager::isSpecialCourse($courseId); $isSpecialCourse = CourseManager::isSpecialCourse($courseId);
if ($user && $isSpecialCourse && (isset($_GET['autoreg']) && 1 === (int) $_GET['autoreg'])) { if ($user && $isSpecialCourse && (isset($_GET['autoreg']) && 1 === (int) $_GET['autoreg']) && CourseManager::subscribeUser($userId, $courseCode, STUDENT)) {
if (CourseManager::subscribeUser($userId, $courseCode, STUDENT)) {
$session->set('is_allowed_in_course', true); $session->set('is_allowed_in_course', true);
} }
}
$action = empty($_GET['action']) ? '' : Security::remove_XSS($_GET['action']); $action = empty($_GET['action']) ? '' : Security::remove_XSS($_GET['action']);
if ('subscribe' === $action && Security::check_token('get')) { if ('subscribe' === $action && Security::check_token('get')) {
@ -116,6 +114,7 @@ class CourseHomeController extends ToolBaseController
$qb = $toolRepository->getResourcesByCourse($course, $this->getSession()); $qb = $toolRepository->getResourcesByCourse($course, $this->getSession());
$qb->addSelect('tool'); $qb->addSelect('tool');
$qb->innerJoin('resource.tool', 'tool'); $qb->innerJoin('resource.tool', 'tool');
$result = $qb->getQuery()->getResult(); $result = $qb->getQuery()->getResult();
$tools = []; $tools = [];
/** @var CTool $item */ /** @var CTool $item */
@ -187,7 +186,7 @@ class CourseHomeController extends ToolBaseController
Exercise::cleanSessionVariables(); Exercise::cleanSessionVariables();
$shortcuts = []; $shortcuts = [];
if ($user) { if (null !== $user) {
$shortcutQuery = $shortcutRepository->getResources($user, $course->getResourceNode(), $course); $shortcutQuery = $shortcutRepository->getResources($user, $course->getResourceNode(), $course);
$shortcuts = $shortcutQuery->getQuery()->getResult(); $shortcuts = $shortcutQuery->getQuery()->getResult();
} }
@ -235,14 +234,13 @@ class CourseHomeController extends ToolBaseController
/** /**
* Edit configuration with given namespace. * Edit configuration with given namespace.
* *
* @param string $namespace
* @Route("/{cid}/settings/{namespace}", name="chamilo_core_course_settings") * @Route("/{cid}/settings/{namespace}", name="chamilo_core_course_settings")
* *
* @Entity("course", expr="repository.find(cid)") * @Entity("course", expr="repository.find(cid)")
* *
* @return Response * @return Response
*/ */
public function updateSettingsAction(Request $request, Course $course, $namespace, SettingsCourseManager $manager, SettingsFormFactory $formFactory) public function updateSettingsAction(Request $request, Course $course, string $namespace, SettingsCourseManager $manager, SettingsFormFactory $formFactory)
{ {
$schemaAlias = $manager->convertNameSpaceToService($namespace); $schemaAlias = $manager->convertNameSpaceToService($namespace);
$settings = $manager->load($namespace); $settings = $manager->load($namespace);
@ -259,8 +257,8 @@ class CourseHomeController extends ToolBaseController
$manager->setCourse($course); $manager->setCourse($course);
$manager->save($form->getData()); $manager->save($form->getData());
$message = $this->trans('Update'); $message = $this->trans('Update');
} catch (ValidatorException $exception) { } catch (ValidatorException $validatorException) {
$message = $this->trans($exception->getMessage()); $message = $this->trans($validatorException->getMessage());
$messageType = 'error'; $messageType = 'error';
} }
$this->addFlash($messageType, $message); $this->addFlash($messageType, $message);
@ -304,7 +302,7 @@ class CourseHomeController extends ToolBaseController
// Redirecting to the LP // Redirecting to the LP
$url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq(); $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq();
$_SESSION[$session_key] = true; $_SESSION[$session_key] = true;
header("Location: {$url}"); header(sprintf('Location: %s', $url));
exit; exit;
} }
} }
@ -340,7 +338,7 @@ class CourseHomeController extends ToolBaseController
'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['iid']; 'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['iid'];
$_SESSION[$session_key] = true; $_SESSION[$session_key] = true;
header("Location: {$url}"); header(sprintf('Location: %s', $url));
exit; exit;
} }
} }
@ -360,12 +358,12 @@ class CourseHomeController extends ToolBaseController
if ($allowAutoLaunchForCourseAdmins) { if ($allowAutoLaunchForCourseAdmins) {
if (empty($autoLaunchWarning)) { if (empty($autoLaunchWarning)) {
$autoLaunchWarning = get_lang( $autoLaunchWarning = get_lang(
'The forum\'s auto-launch setting is on. Students will be redirected to the forum tool when entering this course.' "The forum's auto-launch setting is on. Students will be redirected to the forum tool when entering this course."
); );
} }
} else { } else {
$url = api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq(); $url = api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq();
header("Location: {$url}"); header(sprintf('Location: %s', $url));
exit; exit;
} }
} }
@ -382,7 +380,7 @@ class CourseHomeController extends ToolBaseController
} else { } else {
// Redirecting to the document // Redirecting to the document
$url = api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq(); $url = api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq();
header("Location: {$url}"); header(sprintf('Location: %s', $url));
exit; exit;
} }
} elseif (1 === $exerciseAutoLaunch) { } elseif (1 === $exerciseAutoLaunch) {
@ -417,7 +415,7 @@ class CourseHomeController extends ToolBaseController
$exerciseId = $row['iid']; $exerciseId = $row['iid'];
$url = api_get_path(WEB_CODE_PATH). $url = api_get_path(WEB_CODE_PATH).
'exercise/overview.php?exerciseId='.$exerciseId.'&'.api_get_cidreq(); 'exercise/overview.php?exerciseId='.$exerciseId.'&'.api_get_cidreq();
header("Location: {$url}"); header(sprintf('Location: %s', $url));
exit; exit;
} }
} }
@ -435,7 +433,7 @@ class CourseHomeController extends ToolBaseController
} else { } else {
// Redirecting to the document // Redirecting to the document
$url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq(); $url = api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq();
header("Location: {$url}"); header("Location: $url");
exit; exit;
} }
} }

@ -72,10 +72,8 @@ class EditorController extends BaseController
/** /**
* @Route("/resources/{tool}/{type}/{parentId}", methods={"GET"}, name="resources_filemanager") * @Route("/resources/{tool}/{type}/{parentId}", methods={"GET"}, name="resources_filemanager")
*
* @param int $parentId
*/ */
public function customEditorFileManager(ResourceFactory $resourceFactory, Request $request, $tool, $type, $parentId = 0): Response public function customEditorFileManager(ResourceFactory $resourceFactory, Request $request, $tool, $type, int $parentId = 0): Response
{ {
$id = $request->get('id'); $id = $request->get('id');

@ -46,10 +46,8 @@ class NewsController extends BaseController
/** /**
* @Route("/{id}", name="news", methods={"GET", "POST"}, options={"expose"=true}) * @Route("/{id}", name="news", methods={"GET", "POST"}, options={"expose"=true})
*
* @param int $id
*/ */
public function newsAction($id = 0): Response public function newsAction(int $id = 0): Response
{ {
$visibility = SystemAnnouncementManager::getCurrentUserVisibility(); $visibility = SystemAnnouncementManager::getCurrentUserVisibility();

@ -61,10 +61,8 @@ class OnlineController extends BaseController
/** /**
* @Route("/in_sessions", name="online_users_in_session", methods={"GET", "POST"}, options={"expose"=true}) * @Route("/in_sessions", name="online_users_in_session", methods={"GET", "POST"}, options={"expose"=true})
*
* @param int $id
*/ */
public function onlineUsersInCoursesSessionAction($id = 0): Response public function onlineUsersInCoursesSessionAction(int $id = 0): Response
{ {
$users = who_is_online_in_this_course( $users = who_is_online_in_this_course(
0, 0,

@ -95,10 +95,10 @@ class ResetPasswordController extends AbstractController
try { try {
$user = $this->resetPasswordHelper->validateTokenAndFetchUser($token); $user = $this->resetPasswordHelper->validateTokenAndFetchUser($token);
} catch (ResetPasswordExceptionInterface $e) { } catch (ResetPasswordExceptionInterface $resetPasswordExceptionInterface) {
$this->addFlash('reset_password_error', sprintf( $this->addFlash('reset_password_error', sprintf(
'There was a problem validating your reset request - %s', 'There was a problem validating your reset request - %s',
$e->getReason() $resetPasswordExceptionInterface->getReason()
)); ));
return $this->redirectToRoute('app_forgot_password_request'); return $this->redirectToRoute('app_forgot_password_request');

@ -159,7 +159,7 @@ class ResourceController extends AbstractResourceController implements CourseCon
$course = $this->getCourse(); $course = $this->getCourse();
$totalSize = 0; $totalSize = 0;
if ($course) { if (null !== $course) {
$totalSize = $course->getDiskQuota(); $totalSize = $course->getDiskQuota();
} }
@ -750,11 +750,9 @@ class ResourceController extends AbstractResourceController implements CourseCon
} }
/** /**
* @param string $fileType
*
* @return RedirectResponse|Response * @return RedirectResponse|Response
*/ */
private function createResource(Request $request, $fileType = 'file') private function createResource(Request $request, string $fileType = 'file')
{ {
$resourceNodeParentId = $request->get('id'); $resourceNodeParentId = $request->get('id');
$repository = $this->getRepositoryFromRequest($request); $repository = $this->getRepositoryFromRequest($request);

@ -6,9 +6,7 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Controller; namespace Chamilo\CoreBundle\Controller;
use Chamilo\CoreBundle\Entity\AbstractResource;
use Chamilo\CoreBundle\Entity\Course; use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\ResourceInterface;
use Chamilo\CoreBundle\Entity\ResourceNode; use Chamilo\CoreBundle\Entity\ResourceNode;
use Chamilo\CoreBundle\Entity\Session; use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Repository\ResourceFactory; use Chamilo\CoreBundle\Repository\ResourceFactory;
@ -18,7 +16,6 @@ use Oneup\UploaderBundle\Uploader\File\FileInterface;
use Oneup\UploaderBundle\Uploader\File\FilesystemFile; use Oneup\UploaderBundle\Uploader\File\FilesystemFile;
use Oneup\UploaderBundle\Uploader\Response\EmptyResponse; use Oneup\UploaderBundle\Uploader\Response\EmptyResponse;
use Symfony\Component\HttpFoundation\File\Exception\UploadException; use Symfony\Component\HttpFoundation\File\Exception\UploadException;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
class ResourceUploadController extends BlueimpController class ResourceUploadController extends BlueimpController

@ -235,7 +235,7 @@ class SessionController extends AbstractController
//'sequences' => $sessionRequirements, //'sequences' => $sessionRequirements,
'is_premium' => $sessionIsPremium, 'is_premium' => $sessionIsPremium,
'show_tutor' => 'true' === api_get_setting('show_session_coach'), 'show_tutor' => 'true' === api_get_setting('show_session_coach'),
'page_url' => api_get_path(WEB_PATH)."sessions/{$session->getId()}/about/", 'page_url' => api_get_path(WEB_PATH).sprintf('sessions/%s/about/', $session->getId()),
'session_date' => $sessionDates, 'session_date' => $sessionDates,
'is_subscribed' => SessionManager::isUserSubscribedAsStudent( 'is_subscribed' => SessionManager::isUserSubscribedAsStudent(
$session->getId(), $session->getId(),

@ -23,10 +23,8 @@ class UserController extends AbstractController
* Public profile. * Public profile.
* *
* @Route("/{username}", methods={"GET"}, name="chamilo_core_user_profile") * @Route("/{username}", methods={"GET"}, name="chamilo_core_user_profile")
*
* @param string $username
*/ */
public function profileAction($username, UserRepository $userRepository, IllustrationRepository $illustrationRepository) public function profileAction(string $username, UserRepository $userRepository, IllustrationRepository $illustrationRepository)
{ {
$user = $userRepository->findByUsername($username); $user = $userRepository->findByUsername($username);

@ -49,7 +49,7 @@ final class CDocumentExtension implements QueryCollectionExtensionInterface //,
$rootAlias = $queryBuilder->getRootAliases()[0]; $rootAlias = $queryBuilder->getRootAliases()[0];
$queryBuilder $queryBuilder
->innerJoin("{$rootAlias}.resourceNode", 'node') ->innerJoin("$rootAlias.resourceNode", 'node')
->innerJoin('node.resourceLinks', 'links') ->innerJoin('node.resourceLinks', 'links')
; ;

@ -16,7 +16,7 @@ class DoctrineEntityListenerPass implements CompilerPassInterface
$definition = $container->getDefinition('chamilo.doctrine.entity_listener_resolver'); $definition = $container->getDefinition('chamilo.doctrine.entity_listener_resolver');
$services = $container->findTaggedServiceIds('doctrine.entity_listener'); $services = $container->findTaggedServiceIds('doctrine.entity_listener');
foreach ($services as $service => $attributes) { foreach (array_keys($services) as $service) {
$definition->addMethodCall( $definition->addMethodCall(
'addMapping', 'addMapping',
[$container->getDefinition($service)->getClass(), $service] [$container->getDefinition($service)->getClass(), $service]

@ -26,7 +26,7 @@ class ToolCompilerClass implements CompilerPassInterface
if ($container->has(ToolChain::class)) { if ($container->has(ToolChain::class)) {
$definition = $container->findDefinition(ToolChain::class); $definition = $container->findDefinition(ToolChain::class);
$taggedServices = $container->findTaggedServiceIds('chamilo_core.tool'); $taggedServices = $container->findTaggedServiceIds('chamilo_core.tool');
foreach ($taggedServices as $id => $attributes) { foreach (array_keys($taggedServices) as $id) {
$definition->addMethodCall('addTool', [new Reference($id)]); $definition->addMethodCall('addTool', [new Reference($id)]);
} }
} }

Loading…
Cancel
Save