Hoa central
Static Public Member Functions | Static Protected Attributes | List of all members
Hoa\Praspel\Praspel Class Reference

Static Public Member Functions

static interpret ($praspel, $bindToClass=null)
 
static extractFromComment ($comment)
 
static getRegistry ()
 

Static Protected Attributes

static $_registry = null
 

Detailed Description

Class .

Take a specification + data and validate/verify a callable.

Definition at line 51 of file Praspel.php.

Member Function Documentation

static Hoa\Praspel\Praspel::extractFromComment (   $comment)
static

Extract Praspel (as a string) from a comment.

Parameters
string$commentComment.
Returns
string

Definition at line 99 of file Praspel.php.

100  {
101  $i = preg_match('#/\*(.*?)\*/#s', $comment, $matches);
102 
103  if (0 === $i) {
104  return '';
105  }
106 
107  $i = preg_match_all('#^[\s\*]*\s*\*\s?([^\n]*)$#m', $matches[1], $maatches);
108 
109  if (0 === $i) {
110  return '';
111  }
112 
113  return trim(implode("\n", $maatches[1]));
114  }

Here is the caller graph for this function:

static Hoa\Praspel\Praspel::getRegistry ( )
static

Get registry of all contracts.

Returns

Definition at line 121 of file Praspel.php.

122  {
123  if (null === static::$_registry) {
124  static::$_registry = new \ArrayObject();
125  }
126 
127  return static::$_registry;
128  }
129 }
130 
134 Core\Consistency::flexEntity('Hoa\Praspel\Praspel');
135 
136 }
137 
138 namespace {
139 
146 if (!function_exists('praspel')) {
147  function praspel($praspel)
148  {
149  return Hoa\Praspel::interpret($praspel);
150  }
151 }

Here is the caller graph for this function:

static Hoa\Praspel\Praspel::interpret (   $praspel,
  $bindToClass = null 
)
static

Short interpreter.

Parameters
string$praspelPraspel.
string$bindToClassClassname to bind.
Returns

Definition at line 69 of file Praspel.php.

70  {
71  static $_compiler = null;
72  static $_interpreter = null;
73 
74  if (null === $_compiler) {
75  $_compiler = Compiler\Llk::load(
76  new File\Read('hoa://Library/Praspel/Grammar.pp')
77  );
78  }
79 
80  if (null === $_interpreter) {
81  $_interpreter = new Visitor\Interpreter();
82  }
83 
84  $ast = $_compiler->parse($praspel);
85 
86  if (null !== $bindToClass) {
87  $_interpreter->bindToClass($bindToClass);
88  }
89 
90  return $_interpreter->visit($ast);
91  }

Here is the caller graph for this function:

Member Data Documentation

Hoa\Praspel\Praspel::$_registry = null
staticprotected

Definition at line 58 of file Praspel.php.


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