-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
65 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>'; | ||
} | ||
} |