/
var
/
www
/
vhosts
/
ihelp.ro
/
httpdocs
/
vendor
/
cakephp
/
debug_kit
/
src
/
View
/
Helper
/
/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/debug_kit/src/View/Helper
mkdir
upload
Name
Size
Mode
Actions
CredentialsHelper.php
1925
0644
edit
dl
rm
SimpleGraphHelper.php
2283
0644
edit
dl
rm
ToolbarHelper.php
3326
0644
edit
dl
rm
Edit:
/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/debug_kit/src/View/Helper/SimpleGraphHelper.php
(2283B)
<?php declare(strict_types=1); /** * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * @link https://cakephp.org CakePHP(tm) Project * @since 1.0.0 * @license https://www.opensource.org/licenses/mit-license.php MIT License */ namespace DebugKit\View\Helper; use Cake\View\Helper; /** * Class SimpleGraphHelper * * Allows creation and display of extremely simple graphing elements * * @since DebugKit 1.0 */ class SimpleGraphHelper extends Helper { /** * Default settings to be applied to each Simple Graph * * Allowed options: * * - max => (int) Maximum value in the graphs * - width => (int) * - valueType => string (value, percentage) * - style => array * * @var array */ protected $_defaultSettings = [ 'max' => 100, 'width' => 350, 'valueType' => 'value', ]; /** * bar method * * @param float $value Value to be graphed * @param int $offset how much indentation * @param array $options Graph options * @return string Html graph */ public function bar($value, $offset, $options = []) { $settings = array_merge($this->_defaultSettings, $options); $max = $settings['max']; $width = $settings['width']; $valueType = $settings['valueType']; $graphValue = $value / $max * $width; $graphValue = max(round($graphValue), 1); if ($valueType === 'percentage') { $graphOffset = 0; } else { $graphOffset = $offset / $max * $width; $graphOffset = round($graphOffset); } return sprintf( '<div class="c-graph-bar" style="%s"><div class="c-graph-bar__value" style="%s" title="%s"> </div></div>', "width: {$width}px", "margin-left: {$graphOffset}px; width: {$graphValue}px", "Starting {$offset}ms into the request, taking {$value}ms" ); } }
Save
cmd:
run