Skip to content

Commit

Permalink
Add version 3.1.9-rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Dec 12, 2024
1 parent 14e0342 commit d3ddcb2
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 48 deletions.
26 changes: 1 addition & 25 deletions framework/library/astroid/Debugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function stop($name)
$utime = $this->getRunTime($stop, $this->markers[$name], "utime");
$stime = $this->getRunTime($stop, $this->markers[$name], "stime");

$report = new DebugReport($name);
$report = new Helper\DebugReport($name);
$report->save($utime, $stime, memory_get_usage(), memory_get_peak_usage());
Framework::getReporter('Debug')->add($report->render());
}
Expand All @@ -60,27 +60,3 @@ protected function getRunTime($ru, $rus, $index)
return ($ru["ru_$index.tv_sec"] * 1000 + intval($ru["ru_$index.tv_usec"] / 1000)) - ($rus["ru_$index.tv_sec"] * 1000 + intval($rus["ru_$index.tv_usec"] / 1000));
}
}

class DebugReport
{
public $id = '', $title = '', $utime = 0, $stime = 0, $memory = 0, $memorypeak = 0, $processed = false;
public function __construct($id)
{
$this->id = $id;
$this->title = str_replace(['-', '_'], ' ', Helper::title($id));
}

public function save($utime, $stime, $memory, $memorypeak)
{
$this->utime = $utime;
$this->stime = $stime;
$this->memory = $memory;
$this->memorypeak = $memorypeak;
$this->processed = true;
}

public function render()
{
return '<p class="m-0"><strong class="mr-2"><em>' . $this->title . '</em></strong> <span class="badge badge-light mr-2">Time: ' . $this->utime . ' ms</span> <span class="badge badge-light">Memory: ' . round(($this->memorypeak - $this->memory) / 1048576, 3) . ' MB' . '</span></p>';
}
}
23 changes: 1 addition & 22 deletions framework/library/astroid/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,6 @@ public function getForm()
protected function getParams()
{
$formData = [];
$return = [];
foreach ($this->data as $data) {
$data = (array) $data;
$formData[$data['name']] = $data['value'];
Expand All @@ -300,26 +299,6 @@ protected function getParams()
}
} */

return $AstroidParams = new AstroidParams($formData);
return new Helper\AstroidParams($formData);
}
}

class AstroidParams
{

public $params = [];

function __construct($params)
{
$this->params = $params;
}

public function get($key, $default = null)
{
if (isset($this->params[$key])) {
return $this->params[$key];
} else {
return $default;
}
}
}
28 changes: 28 additions & 0 deletions framework/library/astroid/Helper/AstroidParams.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/**
* @package Astroid Framework
* @author Astroid Framework Team https://astroidframe.work
* @copyright Copyright (C) 2023 AstroidFrame.work.
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
*/

namespace Astroid\Helper;

class AstroidParams
{
public $params = [];
function __construct($params)
{
$this->params = $params;
}

public function get($key, $default = null)
{
if (isset($this->params[$key])) {
return $this->params[$key];
} else {
return $default;
}
}
}
2 changes: 1 addition & 1 deletion framework/library/astroid/Helper/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class Constants
{
public static $astroid_version = '3.1.8';
public static $astroid_version = '3.1.9-rc1';
public static $fontawesome_version = '6.6.0';
public static $fancybox_version = '5.0';
public static $animatecss_version = '3.7.0';
Expand Down
34 changes: 34 additions & 0 deletions framework/library/astroid/Helper/DebugReport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

/**
* @package Astroid Framework
* @author Astroid Framework Team https://astroidframe.work
* @copyright Copyright (C) 2023 AstroidFrame.work.
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
*/

namespace Astroid\Helper;
use Astroid\Helper;
class DebugReport
{
public $id = '', $title = '', $utime = 0, $stime = 0, $memory = 0, $memorypeak = 0, $processed = false;
public function __construct($id)
{
$this->id = $id;
$this->title = str_replace(['-', '_'], ' ', Helper::title($id));
}

public function save($utime, $stime, $memory, $memorypeak)
{
$this->utime = $utime;
$this->stime = $stime;
$this->memory = $memory;
$this->memorypeak = $memorypeak;
$this->processed = true;
}

public function render()
{
return '<p class="m-0"><strong class="mr-2"><em>' . $this->title . '</em></strong> <span class="badge badge-light mr-2">Time: ' . $this->utime . ' ms</span> <span class="badge badge-light">Memory: ' . round(($this->memorypeak - $this->memory) / 1048576, 3) . ' MB' . '</span></p>';
}
}

0 comments on commit d3ddcb2

Please sign in to comment.