-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update of init and expose data to test new structure
- Loading branch information
Showing
7 changed files
with
214 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
/composer.lock | ||
/*.log | ||
/null | ||
/.htaccess | ||
/.user.ini | ||
/example/.htaccess | ||
/example/.user.ini |
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,2 @@ | ||
1655576398 2022-06-18 13:19:58 Test Trace: No backtrace data in the ExceptionHandler. | ||
1655576399 2022-06-18 13:19:59 Use of undefined constant wath - assumed 'wath' (this will throw an Error in a future version of PHP) Trace: No backtrace data in the ErrorHandler. |
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,153 @@ | ||
<?php | ||
|
||
/** | ||
* PHP Development Tools. | ||
* PHP Version required 7.4.* or higher | ||
* | ||
* @see https://github.com/arcanisgk/PHP-Development-Tools | ||
* | ||
* @author Walter Nuñez (arcanisgk/original founder) | ||
* @email icarosnet@gmail.com | ||
* @copyright 2020 - 2022 Walter Nuñez/Icaros Net S.A. | ||
* @license For the full copyright and licence information, please view the LICENSE | ||
* @note This program is distributed in the hope that it will be useful | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace ArcanisGK\PhpDevelopmentTool\ExposeData; | ||
|
||
/** | ||
* ExposeEngine Class. | ||
*/ | ||
class ExposeEngine | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
|
||
private string $data; | ||
|
||
/** | ||
* @var bool|mixed | ||
*/ | ||
|
||
private bool $highlight = true; | ||
|
||
/** | ||
* @var bool|mixed | ||
*/ | ||
|
||
private bool $end = true; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
|
||
private array $options; | ||
|
||
/** | ||
* Description: instantiate Class Static. | ||
* @var ExposeEngine|null $instance | ||
*/ | ||
|
||
private static ?ExposeEngine $instance = null; | ||
|
||
/** | ||
* @param array $data | ||
* @return ExposeEngine | ||
*/ | ||
|
||
public static function getInstance(array $data): ExposeEngine | ||
{ | ||
if (!self::$instance instanceof self) { | ||
self::$instance = new self($data); | ||
} | ||
|
||
return self::$instance; | ||
} | ||
|
||
/** | ||
* @noinspection PhpUnused | ||
* @param array $options | ||
*/ | ||
|
||
public function __construct(array $options = []) | ||
{ | ||
if (!empty($options)) { | ||
if (isset($options['highlight'])) { | ||
$this->highlight = $options['highlight']; | ||
} | ||
if (isset($options['end'])) { | ||
$this->end = $options['end']; | ||
} | ||
} | ||
$this->options = $options; | ||
} | ||
|
||
/** | ||
* @param $var | ||
* @return void | ||
*/ | ||
|
||
public function varDump($var): void | ||
{ | ||
$this->clean(); | ||
if ($this->highlight) { | ||
$this->Explain($var); | ||
} else { | ||
$this->capture($var); | ||
} | ||
$this->output(); | ||
if ($this->end) { | ||
die; | ||
} | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
|
||
private function clean(): void | ||
{ | ||
if (ob_get_contents() || ob_get_length()) { | ||
ob_end_clean(); | ||
flush(); | ||
} | ||
} | ||
|
||
/** | ||
* @param $var | ||
* @return void | ||
*/ | ||
|
||
private function Explain($var) | ||
{ | ||
echo 'Under Development<br>'; | ||
$this->capture($var); | ||
} | ||
|
||
/** | ||
* @param $var | ||
* @return void | ||
*/ | ||
|
||
private function capture($var): void | ||
{ | ||
ob_start(); | ||
var_dump($var); | ||
$this->data = ob_get_contents(); | ||
ob_end_clean(); | ||
} | ||
|
||
/** | ||
* @return void | ||
*/ | ||
|
||
private function output(): void | ||
{ | ||
echo '<pre>' . $this->data . '</pre>'; | ||
} | ||
} |
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,46 @@ | ||
<?php | ||
|
||
/** | ||
* PHP Development Tools. | ||
* PHP Version required 7.4.* or higher | ||
* | ||
* @see https://github.com/arcanisgk/PHP-Development-Tools | ||
* | ||
* @author Walter Nuñez (arcanisgk/original founder) | ||
* @email icarosnet@gmail.com | ||
* @copyright 2020 - 2022 Walter Nuñez/Icaros Net S.A. | ||
* @license For the full copyright and licence information, please view the LICENCE | ||
* @note This program is distributed in the hope that it will be useful | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
* or FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
use ArcanisGK\PhpDevelopmentTool\ExposeData\ExposeEngine; | ||
|
||
/** | ||
* @param ...$data | ||
* @return void | ||
* @noinspection PhpUnused | ||
*/ | ||
|
||
function sd(...$data) | ||
{ | ||
foreach ($data as $var) { | ||
ExposeEngine::getInstance(['highlight' => false, 'end' => false])->varDump($var); | ||
} | ||
} | ||
|
||
/** | ||
* @param ...$data | ||
* @return void | ||
* @noinspection PhpUnused | ||
*/ | ||
|
||
function sda(...$data) | ||
{ | ||
foreach ($data as $var) { | ||
ExposeEngine::getInstance(['highlight' => true])->varDump($var); | ||
} | ||
} |