ICli

Interface for the Artaengine CLI frame class. This interface is to insures the class will always be backward compatible.
Source
ICli.php
Implementations
ArtaCli

Static Methods

getParam

string ICli::getParam(int index)

Get a command param value by index.

Arguments

    index (int)
    The index of the param value to be returned

Returns

string
Value of the param index or null if param not exists

getParam

string ICli::getParam(string index)

Get a command param value by param name.

Arguments

    index (string)
    return the value of the param e.g: "myapp.php -f foo" passinf "-f" will return "foo"

Returns

string
Value of the param or null if param not found

getParam

array ICli::getParam()

Get all the command params.

Returns

array
An array of all params

hasParam

bool ICli::hasParam(string param)

Check if a CLI param value exists inside the proviced params.

Arguments

    param (string)
    Param value

Returns

bool
If param exists

isCli

bool ICli::isCli()

Check if the application is running from the command line.

Returns

bool
true=the application is running from the command line

simulate

void ICli::simulate(string | array configs=null)

Start an Artaengine application. Simulate the Artaengine framework for a CLI application.
Note: This is experimental, Not all Artaengine libs and functions are not tested to work in CLI.

Arguments

    configs=null (string | array)
    App setting file-path or array

Returns

void

Methods

fixCursor

ArtaCli $obj->fixCursor(int column=0, int line=null)

Fix cursor at a point. After the cursor is fixed all next writes will start from this point.

Arguments

    column=0 (int)
    Move cursor to this column number, null=do nothing
    line=null (int)
    Move cursor to this line number, null=do nothing

Returns

ArtaCli
For method chaining

indent

ArtaCli $obj->indent(int indent=1, string str=tab)

Add one or more indents.

Arguments

    indent=1 (int)
    Number of indents to be added
    str=tab (string)
    Indent string

Returns

ArtaCli
For method chaining

moveCursor

ArtaCli $obj->moveCursor(int column=0, int line=null)

Move cursor.

Arguments

    column=0 (int)
    move cursor to this column, null=do nothing
    line=null (int)
    move cursor to this line, null=do nothing

Returns

ArtaCli
For method chaining

nl

ArtaCli $obj->nl(int i)

Print a new line.

Arguments

    i (int)
    Number of new lines

Returns

ArtaCli
For method chaining

releaseCursor

object $obj->releaseCursor()

Release the fixed cursor.

Returns

object
this

removeIndent

ArtaCli $obj->removeIndent(int indent=1)

Remove one or more indents.

Arguments

    indent=1 (int)
    Number of indents to be removed

Returns

ArtaCli
For method chaining

setBackColor

ArtaCli $obj->setBackColor(string color)

Set text back-ground color.

Arguments

    color (string)
    Color name

Returns

ArtaCli
For method chaining

setForeColor

ArtaCli $obj->setForeColor(string color)

Set text color and style.

Arguments

    color (string)
    Color name

Returns

ArtaCli
For method chaining

write

ArtaCli $obj->write(
    string | array data,
    string | array color=null,
    string | array cursor=null
)

Write text.

Arguments

    data (string | array)
    Data to be written
    color=null (string | array)
    "fore-color,back-color" or [fore-color, back-color]
    cursor=null (string | array)
    "column,line" or [column, line]

Returns

ArtaCli
For method chaining

writeLn

ArtaCli $obj->writeLn(
    string | array data,
    string | array color=null,
    string | array cursor=null
)

Write text and goto new line.

Arguments

    data (string | array)
    Data to be written. Array items will be separated by new lines
    color=null (string | array)
    "fore-color,back-color" or [fore-color, back-color]
    cursor=null (string | array)
    "column,line" or [column, line]

Returns

ArtaCli
For method chaining