/
githubmirror
/
joomla-cms
Обзор
Документация
Войти
/
githubmirror
/
joomla-cms
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
5.4-dev
plugins/system/debug/src/DataCollector/UserCollector.php
62 строки
1 KB
Brian Teeman
[4.2] Debug plugin - fix copyright (#39071)
25 окт 2022, 18:01
Не верифицирован
25 окт 2022, 18:01
429e945
Код
Авторство
О чём код?
<?php /** * @package Joomla.Plugin * @subpackage System.Debug * * @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Plugin\System\Debug\DataCollector; use DebugBar\DataCollector\DataCollectorInterface; use Joomla\CMS\Factory; use Joomla\CMS\User\UserFactoryInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * User collector that stores the user id of the person making the request allowing us to filter on it after storage * * @since 4.2.4 */ class UserCollector implements DataCollectorInterface { /** * Collector name. * * @var string * @since 4.2.4 */ private $name = 'juser'; /** * Called by the DebugBar when data needs to be collected * * @since 4.2.4 * * @return array Collected data */ public function collect() { $user = Factory::getApplication()->getIdentity() ?: Factory::getContainer()->get(UserFactoryInterface::class)->loadUserById(0); return ['user_id' => $user->id]; } /** * Returns the unique name of the collector * * @since 4.2.4 * * @return string */ public function getName() { return $this->name; } }