<?php
namespace App\Libraries;
use CodeIgniter\CLI\CLI as BaseCLI;
class CLI extends BaseCLI
{
/**
* Outputs result of print_r to the cli on its own line.
*
* @return void
*/
public static function print_r($data, ?string $foreground = null, ?string $background = null)
{
$toPrint = print_r($data, TRUE);
CLI::write($toPrint, $foreground, $background);
}
/**
* Outputs result of vaar_dump to the cli on its own line.
*
* @return void
*/
public static function var_dump($data, ?string $foreground = null, ?string $background = null)
{
ob_start();
var_dump($data);
$toPrint = ob_get_contents();
ob_end_clean();
CLI::write($toPrint, $foreground, $background);
}
}