Example #1
0
 /**
  * @param $content
  * @param $blueprint
  * @return array|string
  */
 protected function parse($content, $blueprint)
 {
     $this->currentMethod = new ApistMethod($this, null, $blueprint);
     $this->currentMethod->setContent($content);
     $result = $this->currentMethod->parseBlueprint($blueprint);
     $this->currentMethod = null;
     return $result;
 }
Example #2
0
 /**
  * @param $blueprint
  * @return ApistFilter
  */
 public function each($blueprint = null)
 {
     $callback = $blueprint;
     if (is_null($callback)) {
         $callback = function ($node) {
             return $node;
         };
     }
     if (!is_callable($callback)) {
         $callback = function ($node) use($blueprint) {
             return $this->method->parseBlueprint($blueprint, $node);
         };
     }
     return $this->node->each($callback);
 }