PHP Class Cli

* * @package Ninaca * @author Nivl * @started 09/01/2009, 01:29 AM * @last Nivl 05/05/2010, 03:16 PM * @link http://nivl.free.fr * @copyright Copyright (C) 2009 Laplanche Melvin * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see .
Mostrar archivo Open project: datasift/datasift-php Class Usage Examples

Protected Properties

Property Type Description
$arguments array Arguments
$commands array Commands
$options array Options

Public Methods

Method Description
__construct ( array $arguments ) Constructor
callCommand ( object &$object, string $command, array $params, DataSiftUser &$user, $pretty = false ) : mixed Call the command required
getArguments ( ) : array Get the arguments
getCallParameters ( array $allowableParams, array $parameters, DataSift_User &$user ) : array Get the parameters for the call
getCommands ( ) : array Get the list of commands
getEndPointObject ( string $endpoint, DataSift_User &$user ) : object Get the object for target endpoint
getOptions ( ) : type Get the list of options
parseInput ( ) : array Parse the input parameters correctly
printHelp ( ) Print the help
setArguments ( array $arguments ) Set the arguments
validateCommands ( array $parsedOptions ) : boolean Validate the parsed options

Protected Methods

Method Description
getCommandLineOptions ( ) : array Process the command line options
optionMerge ( array $mergeKeys, array $options ) : array Function to merge any occurances of the same option chosen with long and short to a single array
parseAuth ( array $auth ) : array Convert the auth to the array required
sortParams ( array $params ) : array Sorts the parameters into matched pairs

Method Details

__construct() public method

Constructor
public __construct ( array $arguments )
$arguments array

callCommand() public method

Call the command required
public callCommand ( object &$object, string $command, array $params, DataSiftUser &$user, $pretty = false ) : mixed
$object object
$command string
$params array
$user DataSiftUser
return mixed

getArguments() public method

Get the arguments
public getArguments ( ) : array
return array

getCallParameters() public method

Get the parameters for the call
public getCallParameters ( array $allowableParams, array $parameters, DataSift_User &$user ) : array
$allowableParams array
$parameters array
$user DataSift_User
return array

getCommandLineOptions() protected method

Process the command line options
protected getCommandLineOptions ( ) : array
return array

getCommands() public method

Get the list of commands
public getCommands ( ) : array
return array

getEndPointObject() public method

Get the object for target endpoint
public getEndPointObject ( string $endpoint, DataSift_User &$user ) : object
$endpoint string
$user DataSift_User
return object

getOptions() public method

Get the list of options
public getOptions ( ) : type
return type

optionMerge() protected method

Function to merge any occurances of the same option chosen with long and short to a single array
protected optionMerge ( array $mergeKeys, array $options ) : array
$mergeKeys array
$options array
return array

parseAuth() protected method

Convert the auth to the array required
protected parseAuth ( array $auth ) : array
$auth array
return array

parseInput() public method

Parse the input parameters correctly
public parseInput ( ) : array
return array

printHelp() public method

Print the help
public printHelp ( )

setArguments() public method

Set the arguments
public setArguments ( array $arguments )
$arguments array

sortParams() protected method

Sorts the parameters into matched pairs
protected sortParams ( array $params ) : array
$params array
return array

validateCommands() public method

Validate the parsed options
public validateCommands ( array $parsedOptions ) : boolean
$parsedOptions array
return boolean

Property Details

$arguments protected_oe property

Arguments
protected array $arguments
return array

$commands protected_oe property

Commands
protected array $commands
return array

$options protected_oe property

Options
protected array $options
return array