/** * Returns the rendered ManiaScript code. * @return string The code. */ public function getCode() { $result = ''; if ($this->options->getRenderContextDirective()) { $result .= $this->renderedCode->getContextDirective(); } if ($this->options->getRenderDirectives()) { $result .= $this->renderedCode->getDirectives(); } if ($this->options->getRenderGlobalCode()) { $result .= $this->renderedCode->getGlobalCode(); } if ($this->options->getRenderMainFunction()) { $result .= $this->renderedCode->getMainFunction(); } if ($this->options->getCompress()) { $result = $this->compress($result); } if ($this->options->getIncludeScriptTag()) { $result = $this->addScriptTag($result); } return $result; }
/** * Tests the setMainFunction() method. * @covers \ManiaScript\Builder\RenderedCode::setMainFunction */ public function testSetMainFunction() { $expected = 'abc'; $renderedCode = new RenderedCode(); $result = $renderedCode->setMainFunction($expected); $this->assertEquals($renderedCode, $result); $this->assertPropertyEquals($expected, $renderedCode, 'mainFunction'); }