/**
  * @param string $scriptName
  * @param TES4VariableDeclarationList $variableList
  * @param TES4CodeChunks $script
  * @return TES5Script
  * @throws ConversionException
  */
 public function convert($scriptName, TES4VariableDeclarationList $variableList, TES4CodeChunks $script)
 {
     //Create the header.
     $scriptHeader = new TES5ScriptHeader($this->nameTransformer->transform($scriptName, ''), $scriptName, TES5BasicType::T_TOPICINFO(), '', true);
     $globalScope = new TES5GlobalScope($scriptHeader);
     foreach ($this->esmAnalyzer->getGlobalVariables() as $globalVariable) {
         $globalScope->addGlobalVariable($globalVariable);
     }
     if ($variableList !== null) {
         //Converting the variables to the properties.
         $this->propertiesFactory->createProperties($variableList, $globalScope);
     }
     $fragment = $this->fragmentFactory->createFragment(TES5FragmentType::T_TIF(), "Fragment_0", $globalScope, new TES5MultipleScriptsScope([$globalScope]), $script);
     $blockList = new TES5BlockList();
     $blockList->add($fragment);
     return new TES5Script($scriptHeader, $globalScope, $blockList);
 }
 /**
  * @param $memberByValue string Type to be created.
  * @param $basicType TES5BasicType You might override the basic type for this custom type created.
  * @return \Eloquent\Enumeration\ValueMultitonInterface|TES5CustomType|TES5VoidType
  */
 public static function memberByValue($memberByValue, TES5BasicType $basicType = null)
 {
     if ($memberByValue == "void") {
         return new TES5VoidType();
     }
     try {
         return TES5BasicType::memberByValue(ucwords($memberByValue));
     } catch (\Exception $e) {
         //Ugly - todo: REFACTOR THIS TO NON-STATIC CLASS AND MOVE THIS TO DI
         if ($basicType === null) {
             $analyzer = ESMAnalyzer::instance();
             $basicType = $analyzer->getScriptType($memberByValue);
         }
         return new TES5CustomType(TES5NameTransformer::transform($memberByValue, self::$scriptsPrefix), self::$scriptsPrefix, $basicType);
     }
 }
 public function getTranspileToPath($scriptName)
 {
     $prefix = "TES4";
     $transformedName = $this->nameTransformer->transform($scriptName, "TES4");
     return $this->getTranspiledPath() . $prefix . $transformedName . ".psc";
 }
 /**
  * @param TES4Script $script
  * @return TES5ScriptHeader
  * @throws \Ormin\OBSLexicalParser\TES5\Exception\ConversionException
  */
 private function createHeader(TES4Script $script)
 {
     $edid = $script->getScriptHeader()->getScriptName();
     $scriptName = $this->nameTransformer->transform($edid, $this->scriptsPrefix);
     return new TES5ScriptHeader($scriptName, $edid, $this->esmAnalyzer->getScriptType($edid), $this->scriptsPrefix);
 }