| Server IP : 213.186.33.4 / Your IP : 216.73.216.59 Web Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : awebpaca ( 35430) PHP Version : 8.5.0 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/awebpaca/Dolibarr/htdocs/includes/DebugBar/DataCollector/ |
Upload File : |
<?php
/*
* This file is part of the DebugBar package.
*
* (c) 2013 Maxime Bouroumeau-Fuseau
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace DebugBar\DataCollector;
use DebugBar\DataFormatter\DataFormatter;
use DebugBar\DataFormatter\DataFormatterInterface;
/**
* Abstract class for data collectors
*/
abstract class DataCollector implements DataCollectorInterface
{
private static $defaultDataFormatter;
protected $dataFormater;
/**
* Sets the default data formater instance used by all collectors subclassing this class
*
* @param DataFormatterInterface $formater
*/
public static function setDefaultDataFormatter(DataFormatterInterface $formater)
{
self::$defaultDataFormatter = $formater;
}
/**
* Returns the default data formater
*
* @return DataFormatterInterface
*/
public static function getDefaultDataFormatter()
{
if (self::$defaultDataFormatter === null) {
self::$defaultDataFormatter = new DataFormatter();
}
return self::$defaultDataFormatter;
}
/**
* Sets the data formater instance used by this collector
*
* @param DataFormatterInterface $formater
*/
public function setDataFormatter(DataFormatterInterface $formater)
{
$this->dataFormater = $formater;
return $this;
}
public function getDataFormatter()
{
if ($this->dataFormater === null) {
$this->dataFormater = self::getDefaultDataFormatter();
}
return $this->dataFormater;
}
/**
* @deprecated
*/
public function formatVar($var)
{
return $this->getDataFormatter()->formatVar($var);
}
/**
* @deprecated
*/
public function formatDuration($seconds)
{
return $this->getDataFormatter()->formatDuration($seconds);
}
/**
* @deprecated
*/
public function formatBytes($size, $precision = 2)
{
return $this->getDataFormatter()->formatBytes($size, $precision);
}
}