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); }
/** * @return string */ public function opcache_version() { $code = new Code(); $code->addStatement('return phpversion("Zend OPcache");'); return $this->adapter->run($code); }
/** * @return string */ public function apc_version() { $code = new Code(); $code->addStatement('return phpversion("apc");'); return $this->adapter->run($code); }