- md5
- ea44dc70f64f57d0e9191dbccbf21451
- sha1
- f11ffcefd9da19a9c2ad778f5be664394ff601f7
- sha256
- 2d4c41fcf225a3d1bd1b75896e95c4c771946ab155f648bb6917f9bd137c22b0
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
<?php
/**
* @package Joomla.Plugin
* @subpackage System.Debug
*
* @copyright (C) 2018 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 Joomla\CMS\Factory;
use Joomla\Plugin\System\Debug\AbstractDataCollector;
use Joomla\Plugin\System\Debug\Extension\Debug;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* SessionDataCollector
*
* @since 4.0.0
*/
class SessionCollector extends AbstractDataCollector
{
/**
* Collector name.
*
* @var string
* @since 4.0.0
*/
private $name = 'session';
/**
* Called by the DebugBar when data needs to be collected
*
* @since 4.0.0
*
* @return array Collected data
*/
public function collect()
{
$returnData = [];
$sessionData = Factory::getApplication()->getSession()->all();
// redact value of potentially secret keys
array_walk_recursive($sessionData, static function (&$value, $key) {
if (!preg_match(Debug::PROTECTED_COLLECTOR_KEYS, $key)) {
return;
}
$value = '***redacted***';
});
foreach ($sessionData as $key => $value) {
$returnData[$key] = $this->getDataFormatter()->formatVar($value);
}
return ['data' => $returnData];
}
/**
* Returns the unique name of the collector
*
* @since 4.0.0
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Returns a hash where keys are control names and their values
* an array of options as defined in {@see \DebugBar\JavascriptRenderer::addControl()}
*
* @since 4.0.0
*
* @return array
*/
public function getWidgets()
{
return [
'session' => [
'icon' => 'key',
'widget' => 'PhpDebugBar.Widgets.VariableListWidget',
'map' => $this->name . '.data',
'default' => '[]',
],
];
}
}
The same content is in 12 releases, Joomla 4.4.0-alpha1 to 5.0.0-beta2. See them all, or every version of this file.