src/Codegen/CodegenBase.php
protected function getTemplateSettings($strTemplateFilePath, &$strTemplate = null)
    {
        if ($strTemplate === null) {
            $strTemplate = file_get_contents($strTemplateFilePath);
        }
        $strError = 'Template\'s first line must be <template OverwriteFlag="boolean" TargetDirectory="string" DirectorySuffix="string" TargetFileName="string"/>: ' . $strTemplateFilePath;
        // Parse out the first line (which contains path and overwriting information)
        $intPosition = strpos($strTemplate, "\n");
        if ($intPosition === false) {
            throw new \Exception($strError);
        }

        $strFirstLine = trim(substr($strTemplate, 0, $intPosition));

        $objTemplateXml = null;
        // Attempt to Parse the First Line as XML
        try {
            @$objTemplateXml = new \SimpleXMLElement($strFirstLine);
        } catch (\Exception $objExc) {
        }

        if (is_null($objTemplateXml) || (!($objTemplateXml instanceof \SimpleXMLElement))) {
            throw new \Exception($strError);
        }
        $strTemplate = substr($strTemplate, $intPosition + 1);
        return $objTemplateXml;
    }
protected function getTemplateSettings($strTemplateFilePath, &$strTemplate = null)
    {
        if ($strTemplate === null) {
            $strTemplate = file_get_contents($strTemplateFilePath);
        }
        $strError = 'Template\'s first line must be <template OverwriteFlag="boolean" TargetDirectory="string" DirectorySuffix="string" TargetFileName="string"/>: ' . $strTemplateFilePath;
        // Parse out the first line (which contains path and overwriting information)
        $intPosition = strpos($strTemplate, "\n");
        if ($intPosition === false) {
            throw new \Exception($strError);
        }

        $strFirstLine = trim(substr($strTemplate, 0, $intPosition));

        $objTemplateXml = null;
        // Attempt to Parse the First Line as XML
        try {
            @$objTemplateXml = new \SimpleXMLElement($strFirstLine);
        } catch (\Exception $objExc) {
        }

        if (is_null($objTemplateXml) || (!($objTemplateXml instanceof \SimpleXMLElement))) {
            throw new \Exception($strError);
        }
        $strTemplate = substr($strTemplate, $intPosition + 1);
        return $objTemplateXml;
    }
protected function getTemplateSettings ( $ strTemplateFilePath , & $ strTemplate = null ) { if ( $ strTemplate === null ) { $ strTemplate = file_get_contents ( $ strTemplateFilePath ) ; } $ strError = 'Template\'s first line must be <template OverwriteFlag="boolean" TargetDirectory="string" DirectorySuffix="string" TargetFileName="string"/>: ' . $ strTemplateFilePath ; // Parse out the first line (which contains path and overwriting information) $ intPosition = strpos ( $ strTemplate , "\n" ) ; if ( $ intPosition === false ) { throw new \ Exception ( $ strError ) ; } $ strFirstLine = trim ( substr ( $ strTemplate , 0 , $ intPosition ) ) ; $ objTemplateXml = null ; // Attempt to Parse the First Line as XML try { @ $ objTemplateXml = new \ SimpleXMLElement ( $ strFirstLine ) ; } catch ( \ Exception $ objExc ) { } if ( is_null ( $ objTemplateXml ) || ( ! ( $ objTemplateXml instanceof \ SimpleXMLElement ) ) ) { throw new \ Exception ( $ strError ) ; } $ strTemplate = substr ( $ strTemplate , $ intPosition + 1 ) ; return $ objTemplateXml ; }
Returns the settings of the template file as SimpleXMLElement object

@param null|string $strTemplateFilePath Path to the file
@param null|string $strTemplate Text of the template (if $strTemplateFilePath is null, this field must be string)
@deprecated

@return \SimpleXMLElement
@throws \Exception
Returns the settings of the template file as SimpleXMLElement object