addStatement() public method

public addStatement ( string $statement )
$statement string
Ejemplo n.º 1
0
 public function testAddStatement()
 {
     $code = new Code();
     $code->addStatement('$a = 10;');
     $this->assertSame('$a = 10;', $code->getCode());
     $code->addStatement('return $a;');
     $this->assertSame("\$a = 10;\nreturn \$a;", $code->getCode());
 }
 /**
  * Evaluate a string as PHP code
  *
  * @param  string $expression Evaluates the given code as PHP
  * @return mixed
  */
 public function _eval($expression)
 {
     $code = new Code();
     $code->addStatement($expression);
     return $this->adapter->run($code);
 }
Ejemplo n.º 3
0
 /**
  * @return string
  */
 public function opcache_version()
 {
     $code = new Code();
     $code->addStatement('return phpversion("Zend OPcache");');
     return $this->adapter->run($code);
 }
Ejemplo n.º 4
0
 /**
  * @return string
  */
 public function apc_version()
 {
     $code = new Code();
     $code->addStatement('return phpversion("apc");');
     return $this->adapter->run($code);
 }