Class Graphite_Graph_CallSpec
Description of the call specification for a Graphite function.
Author(s):- Bryan Davis <bd808@bd808.com>
Copyright: | 2012 Bryan Davis and contributors. All Rights Reserved. |
License: | Simplified BSD License |
Constants
FMT_FORMAT_ARG
|
Sprintf format string for creating a lambda function to format a list of arguments. |
Member Variables
protected bool |
$isAlias
Does this function provide an alias for the series? |
protected string |
$name
Canonical name of the function. |
protected int |
$order
Sort order. |
protected array |
$signature
Description of function arguments. |
protected bool |
$usesSeries
Does this function wrap a series? |
Method Summary
public static bool |
argHasMods(
$arg
)
Does the given argument have modifiers? |
public static bool |
argIsOptional(
$arg
)
Is the given argument optional? |
public static bool |
argIsString(
$arg
)
Is the given argument optional? |
public static bool |
argIsWildcard(
$arg
)
Is the given argument a wildcard? |
public static int |
cmp(
$a
, $b
)
Compare two CallSpecs for sort ordering. |
public static mixed |
format(
$arg
, $type
)
Format an argument as a specified type. |
public string |
asString(
$series
, $args
)
Format the call for use as a target. |
public Graphite_Graph_CallSpec |
__construct(
$name
, $signature
, [ $order
= 50] , [ $alias
= false] , [ $generator
= false] )
Constructor. |
public string |
getArg(
$idx
)
Get the Nth argument spec. |
public bool |
isAlias(
)
Does this function provide an alias for the series? |
public int |
maxArgs(
)
How many args are possible for this function? |
public int |
requiredArgs(
)
How many args are required for this function? |
public bool |
takesArgs(
)
Does this function require arguments other than a series? |
Methods
argHasMods
Does the given argument have modifiers?
Parameters:
Name | Type | Description |
---|---|---|
$arg |
string | Argument description to check |
argIsOptional
Is the given argument optional?
Parameters:
Name | Type | Description |
---|---|---|
$arg |
string | Argument description to check |
argIsString
Is the given argument optional?
Parameters:
Name | Type | Description |
---|---|---|
$arg |
string | Argument description to check |
argIsWildcard
Is the given argument a wildcard?
Parameters:
Name | Type | Description |
---|---|---|
$arg |
string | Argument description to check |
cmp
Compare two CallSpecs for sort ordering.
Parameters:
Name | Type | Description |
---|---|---|
$a |
CallSpec | First spec |
$b |
CallSpec | Second spec |
format
Format an argument as a specified type.
$type is one of:
- - : Verbatum
- " : Quoted String
- # : Numeric
- ^ : Boolean
- ! : Flag parameter (null to omit from call, non-null to include)
Parameters:
Name | Type | Description |
---|---|---|
$arg |
mixed | Argument to format |
$type |
string | Output type |
asString
Format the call for use as a target.
Arguments to the function can be provided as an array or using a varadic argument style.
- // args provided as array
- // varadic args
If this call is a generator the $series argument will be ignored.
Parameters:
Name | Type | Description |
---|---|---|
$series |
string | Series to apply function to |
$args |
array | Arguments to function |
__construct
Constructor.
- $signature is a single value or array of argument specs.
- $order is an integer between 1 and 99 used to sort functions when nesting.
- $alias is truthy if this function provides a legend alias.
Output type is one of:
- - : Verbatum
- " : Quoted String
- # : Numeric
- ^ : Boolean
- ! : Flag parameter (null to omit from call, non-null to include)
- - : Verbatum (default if omitted)
- ? : Argument is optional
- * : Variadic args
- < : Argument preceeds series in call
Parameters:
Name | Type | Description |
---|---|---|
$name |
string | Function name |
$signature |
mixed | Argument spec |
$order |
int | Sort order |
$alias |
bool | Does this function provide an alias? |
$generator |
bool | Is this function a generator? |
getArg
Get the Nth argument spec.
Parameters:
Name | Type | Description |
---|---|---|
$idx |
int | Argument index |
isAlias
Does this function provide an alias for the series?
maxArgs
How many args are possible for this function?
requiredArgs
How many args are required for this function?
takesArgs
Does this function require arguments other than a series?
Located in /src/Graphite/Graph/CallSpec.php [line 19]