SectionParser
        
        This class parses CMS object files (pages, partials and layouts).
    
    
 class Winter\Storm\Halcyon\Processors\SectionParserReturns the structured file information.
Constants
| Constant | Type | Value | Description | 
|---|---|---|---|
| ERROR_INI | string | "_PARSER_ERROR_INI" | 
                                                            string
                                                         "_PARSER_ERROR_INI" | 
| SECTION_SEPARATOR | string | "==" | 
                                                            string
                                                         "==" | 
Methods
            
            
            
                public
            
                            
                    static
                
                        
            parse (string $content, array $options = [])
                            : array
                    
        
        Parses Halcyon section content.
The expected file format is following:
INI settings section
==
PHP code section
==
Twig markup section
If the content has only 2 sections they are parsed as settings and markup. If there is only a single section, it is parsed as markup.
Returns an array with the following elements: (array|null) 'settings', (string|null) 'markup', (string|null) 'code'.
| Property | Type | Description | 
|---|---|---|
| $content | string | string | 
| $options | array | array | 
public static parseCode (string $code) : string
Processes the Code section into a usable form
| Property | Type | Description | 
|---|---|---|
| $code | string | string | 
public static parseMarkup (string $markup) : string
Processes the Markup section into a usable form
| Property | Type | Description | 
|---|---|---|
| $markup | string | string | 
public static parseOffset (string $content) : array
Same as parse method, except the line number where the respective section begins is returned.
Returns an array with the following elements: (integer|null) 'settings', (integer|null) 'markup', (integer|null) 'code'.
| Property | Type | Description | 
|---|---|---|
| $content | string | string | 
public static parseSettings (string $settings) : array
Parses the Settings section into an array
| Property | Type | Description | 
|---|---|---|
| $settings | string | string | 
            
            
            
                public
            
                            
                    static
                
                        
            render (array $data, array $options = [])
                            : string
                    
        
        Renders a CMS object as file content.
| Property | Type | Description | 
|---|---|---|
| $data | array | array | 
| $options | array | array | 
            
            
            
                public
            
                            
                    static
                
                        
            renderCode (string $code, array $options = [])
                            : string
                    
        
        Renders the provided string into a string that can be stored in the Code section
| Property | Type | Description | 
|---|---|---|
| $code | string | string | 
| $options | array | array | 
public static renderMarkup (string $markup) : string
Renders the provided string into a string that can be stored in the Markup section
| Property | Type | Description | 
|---|---|---|
| $markup | string | string | 
public static renderSettings (array $data) : string
Renders the provided settings data into a string that can be stored in the Settings section
| Property | Type | Description | 
|---|---|---|
| $data | array | array | 
            
            
            
                protected
            
                            
                    static
                
                        
            adjustLinePosition (string $content, integer $startLine = -1)
                            : integer
                    
        
        Pushes the starting line number forward since it is not always directly after the separator (==). There can be an opening tag or white space in between where the section really begins.
| Property | Type | Description | 
|---|---|---|
| $content | string | string | 
| $startLine | integer | integer | 
            
            
            
                protected
            
                            
                    static
                
                        
            calculateLinePosition (string $content, integer $instance = 1)
                            : integer | null
                    
        
        Returns the line number of a found instance of CMS object section separator (==).
| Property | Type | Description | 
|---|---|---|
| $content | string | string Object content | 
| $instance | integer | integer Which instance to look for | 
The line number the instance was found.
            
            
            
                protected
            
                            
                    static
                
                        
            parseIntoSections (string $content, integer $limit = 3)
                            : array
                    
        
        Parse the provided content into sections
| Property | Type | Description | 
|---|---|---|
| $content | string | string | 
| $limit | integer | integer |