Example #1
0
 /**
  * @return self
  *
  * @throws \InvalidArgumentException Missing argument(s) when calling unshift
  */
 public function unshift()
 {
     if (func_num_args() === 0) {
         throw new \InvalidArgumentException("Missing argument(s) when calling unshift");
     }
     $spec = func_get_args();
     $this->specs->unshift($spec);
     return $this;
 }
Example #2
0
 /**
  * @return $this
  */
 public function unshift()
 {
     if (func_num_args() === 0) {
         throw new \InvalidArgumentException('Missing argument(s) when calling unshift');
     }
     $msgApp = func_get_args();
     $this->components->unshift($msgApp);
     return $this;
 }
Example #3
0
 /**
  * Push callback to the top of stack
  * @param  callable $cb Callback
  * @return void
  */
 public function unshift($cb)
 {
     parent::unshift(CallbackWrapper::wrap($cb));
 }
Example #4
0
 private function tokenize($text)
 {
     $tokens = new \SplStack();
     $position = 0;
     while (mb_strlen($text) > 0) {
         foreach ($this->lexerRules as $token => $regex) {
             if (preg_match($regex, $text, $matches)) {
                 $tokens->unshift(array($token, $matches[0], $position));
                 $text = mb_substr($text, mb_strlen($matches[0]));
                 $position += mb_strlen($matches[0]);
                 break;
             }
         }
     }
     return $tokens;
 }