class \mpf\cli\Helper

class \mpf\cli\Helper

-no description found-

Attributes
protected string $OS

Current running OS.

public bool $showActions = true

Record if it should display actions or not;

public bool $showProgressBar = true

Record if it should display progressBar or not;

public string $timeTextSeparator = " "

Separator to be used between time and message

protected mixed $currentActionHadLogs

-no description found-

protected mixed $pendingActionLogs = []

-no description found-

protected mixed $currentAction

-no description found-

protected int $lastTimeLenght

Number of characters used to display last time

protected mixed $requestsRepeats

-no description found-

private mixed $activeProgressBar

-no description found-

const OS_LINUX = "linux"

-no description found-

Methods

protected mixed init (mixed $config)

  • $config

    -no description found-

-no description found-

public mixed color (mixed $message, mixed $color = self::CWHITE, mixed $background = null)

  • $message

    -no description found-

  • $color

    -no description found-

  • $background

    -no description found-

-no description found-

public string log (mixed $message, string $color = self::CWHITE)

  • $message

    -no description found-

  • $color

    -no description found-

-no description found-

public string startAction (string $message, string $color = self::CWHITE, int $microtime = null)

  • $message

    -no description found-

  • $color

    one of class constants

  • $microtime

    a custom start time;

Start a new action

public int getTextLength (string $text)

  • $text

    -no description found-

Return text length after removing colors

public mixed continueAction (string $message, string $color = "default")

  • $message

    -no description found-

  • $color

    one of class constants

Continue an action.

public string endAction (string $message = "done", string $color = self::CLIGHT_GREEN)

  • $message

    -no description found-

  • $color

    -no description found-

End a started action.

protected int getScreen (string $what)

  • $what

    -no description found-

Get current console dimensions. If is not run from console(and is a cron job or something) then some default values are returned

public string timeItTook (float $startTime)

  • $startTime

    micro start time

Returns a string with time difference between the start time and current time

public bool progressBar (int $total = null, int $done = null, int $width = null)

  • $total

    -no description found-

  • $done

    -no description found-

  • $width

    -no description found-

Start a progress bar;

public mixed progress (mixed $message = null, mixed $progressValue = 1, mixed $color = self::CWHITE)

  • $message

    -no description found-

  • $progressValue

    -no description found-

  • $color

    -no description found-

-no description found-

public mixed endProgressBar ()

-no description found-

public string logToHtml (string $logText, bool $userPre = true)

  • $logText

    original log text

  • $userPre

    if set to false then it will use
    for new line , else inserts the code inside

Parse cli logs and change the cli colors to html tags and colors;

public string logToTextFile (string $logText)

  • $logText

    -no description found-

Remove colors from logs so that it can be read in a text editor;

Prepares the log for a text file;

public string input (string $text, string $defaultValue = "", null $color = null)

  • $text

    -no description found-

  • $defaultValue

    Value that will be returned if nothing is completed

  • $color

    -no description found-

Get input from cli.

public string passwordInput (mixed $text)

  • $text

    -no description found-

Get hidden input from cli.