for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Includes/Text.php
*
* @author Adam "Saibamen" Stachowicz <[email protected]>
* @license MIT
* @link https://github.com/Saibamen/Generate-Sort-Numbers
*/
namespace Includes;
* Functions for printing text.
class Text
{
* @var bool If true - print more information.
private static $debugMode = false;
$debugMode
This check marks private properties in classes that are never used. Those properties can be removed.
* Prints how much time took some action in milliseconds.
* @param float|string $startTime Time when action started
public static function printTimeDuration($startTime)
$currentTime = microtime(true);
if (gettype($startTime) === 'string') {
$currentTime = microtime();
}
$completedIn = (float) $currentTime - (float) $startTime;
$completedIn = number_format((float) $completedIn, 4, '.', '');
self::message('It was done in '.$completedIn.' ms.');
* Set $debugMode property value
* @param bool $value
* @see Text::$debugMode
public static function setDebug($value)
Text::$debugMode = $value;
* Get $debugMode property value
* @return bool
public static function getDebug()
return Text::$debugMode;
* Execute message() function if $debugMode is set to true.
* @param mixed $message Message to print if in DEBUG mode
* @see Text::message()
public static function debug($message)
if (Text::$debugMode) {
Text::message($message);
* Prints message with new lines.
* @param mixed $message Message to print
public static function message($message)
echo "\n".$message."\n";
This check marks private properties in classes that are never used. Those properties can be removed.