Overview

Packages

  • Phery

Classes

  • Phery
  • PheryFunction
  • PheryResponse

Exceptions

  • PheryException
  • Overview
  • Package
  • Class

Class PheryFunction

Create an anonymous function for use on Javascript callbacks

Package: Phery
License: MIT License
Author: Paulo Cesar
Located at Phery.php
Methods summary
public
# __construct( string|array $value, array $parameters = array() )

Sets new raw parameter to be passed, that will be eval'ed. If you don't pass the function(){ } it will be appended

Sets new raw parameter to be passed, that will be eval'ed. If you don't pass the function(){ } it will be appended

$raw = new PheryFunction('function($val){ return $val; }');
// or
$raw = new PheryFunction('alert("done");'); // turns into function(){ alert("done"); }

Parameters

$value
string|array
$value Raw function string. If you pass an array, it will be joined with a line feed \n
$parameters
array
$parameters You can pass parameters that will be replaced in the $value when compiling
public PheryFunction
# bind( string $param, mixed & $var )

Bind a variable to a parameter.

Bind a variable to a parameter.

Parameters

$param
string
$param parameter key to replace
$var
mixed
$var variable to use

Returns

PheryFunction
public PheryFunction
# param( string $param, mixed $value )

Set the value of a parameter.

Set the value of a parameter.

Parameters

$param
string
$param parameter key to replace
$value
mixed
$value value to use

Returns

PheryFunction
public PheryFunction
# parameters( array $params )

Add multiple parameter values.

Add multiple parameter values.

Parameters

$params
array
$params list of parameter values

Returns

PheryFunction
public string
# value( )

Get the value as a string.

Get the value as a string.

Returns

string
public string
# __toString( )

Return the value of the expression as a string.

Return the value of the expression as a string.

echo $expression;

Returns

string
public string
# compile( )

Compile function and return it. Replaces any parameters with their given values.

Compile function and return it. Replaces any parameters with their given values.

Returns

string
public static PheryFunction
# factory( string|array $value, array $parameters = array() )

Static instantation for PheryFunction

Static instantation for PheryFunction

Parameters

$value
string|array
$value
$parameters
array
$parameters

Returns

PheryFunction
Properties summary
protected array $parameters array()
#

Parameters that will be replaced inside the response

Parameters that will be replaced inside the response

protected array $value null
#

The function string itself

The function string itself

Phery API documentation generated by ApiGen 2.8.0