phpPeanuts  2.2.0
phpPeanuts framework
 All Data Structures Namespaces Files Functions Variables
Public Member Functions | Static Public Member Functions | Data Fields
PntNavigation Class Reference

Inherits PntEvaluation.

Inherited by PntObjectNavigation.

Public Member Functions

 getItemType ()
 
 setItemType ($value)
 
 getKey ()
 
 setKey ($value)
 
 getNext ()
 
 setNext ($value)
 
 getStepResultType ()
 
 setStepResultType ($value)
 
 setPath ($path)
 
 setNextPath ($path)
 
 getPath ($length=null)
 
 getFirstPropertyLabel ()
 
 getPathLabel ()
 
 getLabel ()
 
 __clone ()
 
 pop ()
 
 evaluate ($item, $extra1=null, $extra2=null, $extra3=null)
 
 collect ($argument)
 
 step ($item)
 
 _setPath ($path)
 
 _step ($item)
 
 _collect (&$argument)
 
- Public Member Functions inherited from PntEvaluation
 getKey ()
 
 setKey ($value)
 
 getLabel ()
 
 getClass ()
 
 evaluate ($item, $extra1=null, $extra2=null, $extra3=null)
 
 getResultType ()
 
 getLastProp ()
 
 __toString ()
 
 toString ()
 
 _evaluate ($item)
 

Static Public Member Functions

static getInstance ($path, $itemType=null)
 
static nav1Sort (&$array, $nav, $ascending=true)
 
static byNav1SortKey (&$array, $nav)
 
static collect_path ($array, $path, $itemType=null)
 
static distinct ($items)
 
static _getInstance ($path, $itemType=null)
 
static _byNav1SortKey (&$array, $nav)
 
static _nav1Sort (&$array, $nav, $ascending=true)
 
- Static Public Member Functions inherited from PntEvaluation
static getInstance ($key)
 
static _getInstance ($key)
 

Data Fields

 $itemType
 
 $key
 
 $next
 
 $getterName
 
- Data Fields inherited from PntEvaluation
 $key
 

Member Function Documentation

__clone ( )
static _byNav1SortKey ( $array,
  $nav 
)
static
_collect ( $argument)
static _getInstance (   $path,
  $itemType = null 
)
static
static _nav1Sort ( $array,
  $nav,
  $ascending = true 
)
static
_setPath (   $path)
_step (   $item)
static byNav1SortKey ( $array,
  $nav 
)
static

Return an array with the elements from the supplied one indexed by keys for sorting, i.e. from concatenating the results of the supplied navigation with the original keys, both padded to the length of the longest.

Parameters
array$arraythe array holding the elements to be sorted
$navPntNavigation the navigation to use. ResultType must be primitive datatype
Returns
Associative Array with keys for sorting and values from array param
Exceptions
PntError
collect (   $argument)

Multi value navigation from the argument over a single value path. if the argument is null, return null otherwise return an array with the results of navigating from each element under the same keys as those of the elements in the argument. If an error occurs, exit returning the error array $argument of mixed Array or Object

Returns
mixed result of the navigation
Exceptions
PntError
static collect_path (   $array,
  $path,
  $itemType = null 
)
static

Multi value navigation from the argument using a path string if the argument is null, return null otherwise return an array with the results of navigating from each element under the same keys as those of the elements in the argument. If an error occurs, trigger E_USER_WARNING and return false.

Array $array String $path the path to navigate

Returns
variant result of the navigation
Exceptions
PntError
static distinct (   $items)
static
Returns
array of PntObject, each only once, in last occurrence order
Parameters
arrayof PntObject $items
evaluate (   $item,
  $extra1 = null,
  $extra2 = null,
  $extra3 = null 
)

Single value navigation from the argument using the key. if the argument is null, return null if the argument is an array, get the next value using the key, else, if the argument is not an object, return an NntReflectionError if the argument has a getter method for the key, get the next value using the getter, else get the field named like the key. if next, return the result of _evaluat next with the next value. mixed $item Array or Object

Returns
mixed result of the navigation
Exceptions
PntError
getFirstPropertyLabel ( )
static getInstance (   $path,
  $itemType = null 
)
static

get an instance of the proper subclass for navigating from the specified itemType over the specified path

Parameters
pathString the navigation path with property names or keys separated by dots
itemTypeString 'Array', 'List' or className
Returns
PntNavigation
Exceptions
PntReflectionError
getItemType ( )
getKey ( )
getLabel ( )
getNext ( )
getPath (   $length = null)
Parameters
int$lengthif positive, include the specified numer of steps, or all if the path is shorter if negative, exclude specified number of steps at the end, return null if this leaves no steps if not specified return the entire path
Returns
string keys of the steps concatenated with '.' inbetween
getPathLabel ( )
getStepResultType ( )
static nav1Sort ( $array,
  $nav,
  $ascending = true 
)
static

Return an array with the elements from the supplied one sorted by the results of the supplied navigation. and under-sorted by the keys from the supplied array ( this allows sub-sorting by first applying the second criterium and then again calling this method with the first) Keys are not retained in the result array Current implementation is case sentitive, this may change in future

Parameters
arrayarray the array holding the elements to be sorted
$navPntNavigation the navigation to sort by. ResultType must be primitive datatype
$ascendingboolean wheather the sort order is ascending
Returns
Associative Array with keys for sorting and values from array param
Exceptions
PntError
pop ( )
setItemType (   $value)
setKey (   $value)
setNext (   $value)
setNextPath (   $path)
setPath (   $path)

PntReflectionError PRECONDITION: this is an instance of the right class

setStepResultType (   $value)
step (   $item)

Single value navigation step from the argument using the key. if the argument is null, return null if the argument is an array, get the next value using the key, else, if the argument is not an object, return an NntReflectionError if the argument has a getter method for the key, get the next value using the getter, else get the field named like the key. mixed $item Array or Object

Returns
mixed result of the navigation
Exceptions
PntError

Field Documentation

$getterName
$itemType
$key
$next

The documentation for this class was generated from the following file: