-
Docs
Backend
-
Behaviors
-
Classes
-
Controllers
-
Database
-
Seeds
-
-
Facades
-
FormWidgets
-
Helpers
-
Exception
- Backend
-
-
Models
-
ReportWidgets
-
Skins
-
Traits
-
Widgets
- ServiceProvider
-
-
Cms
-
Classes
- Asset
- AutoDatasource
- CmsCompoundObject
- CmsController
- CmsException
- CmsObject
- CmsObjectCollection
- CodeBase
- CodeParser
- ComponentBase
- ComponentHelpers
- ComponentManager
- ComponentPartial
- Content
- Controller
- Layout
- LayoutCode
- MediaLibrary
- MediaLibraryItem
- MediaViewHelper
- Meta
- ObjectMemoryCache
- Page
- PageCode
- Partial
- PartialCode
- PartialStack
- Router
- Theme
- ThemeManager
-
Components
-
Contracts
-
Controllers
-
Facades
-
FormWidgets
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ComponentNode
- ComponentTokenParser
- ContentNode
- ContentTokenParser
- DebugExtension
- DefaultNode
- DefaultTokenParser
- Extension
- FlashNode
- FlashTokenParser
- FrameworkNode
- FrameworkTokenParser
- Loader
- PageNode
- PageTokenParser
- PartialNode
- PartialTokenParser
- PlaceholderNode
- PlaceholderTokenParser
- PutNode
- PutTokenParser
- ScriptsNode
- ScriptsTokenParser
- StylesNode
- StylesTokenParser
-
Widgets
- ServiceProvider
-
-
System
-
Behaviors
-
Classes
-
Console
-
Controllers
-
Database
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ServiceProvider
-
-
Events
-
backend
-
ajax
-
filter
-
form
-
list
-
menu
-
page
-
user
-
-
cms
-
ajax
-
block
-
combiner
-
component
-
object
-
page
-
router
-
template
-
theme
-
-
halcyon
-
datasource
-
-
mailer
-
media
-
model
-
system
-
assets
-
console
-
mirror
-
theme
-
-
reportwidgets
-
settings
- extendConfigFile
-
-
translator
-
-
Library
-
Argon
-
Auth
-
Models
- AuthException
- Manager
-
-
Config
-
Cookie
-
Middleware
-
-
Database
-
Attach
-
Behaviors
-
Concerns
-
Connections
-
Connectors
-
Models
-
Relations
-
Schema
-
Traits
-
Updates
- README
- Builder
- Collection
- DatabaseServiceProvider
- DataFeed
- Dongle
- MemoryCache
- Model
- ModelBehavior
- ModelException
- NestedTreeScope
- Pivot
- QueryBuilder
- SortableScope
- TreeCollection
- Updater
-
-
Events
-
Exception
-
Extension
-
Filesystem
-
Flash
-
Foundation
-
Bootstrap
-
Console
-
Exception
-
Http
-
Middleware
- Kernel
-
-
Providers
- Application
- Maker
-
-
Halcyon
-
Datasource
-
Exception
-
Processors
-
Traits
- README
- Builder
- Collection
- HalcyonServiceProvider
- MemoryCacheManager
- MemoryRepository
- Model
-
-
Html
-
Mail
-
Network
-
Parse
-
Router
-
Scaffold
-
Support
-
Translation
-
- Documentation
- API
- Cms
- Classes
- CodeParser
Cms\Classes\CodeParser
Source: ~/modules/cms/classes/CodeParser.php
Parses the PHP code section of CMS objects.
Protected properties
protected Cms\Classes\CmsCompoundObject $object
A reference to the CMS object being parsed.
protected string $filePath
Contains a path to the CMS object's file being parsed.
protected static mixed $cache
The internal cache, keeps parsed object information during a request.
protected string $dataCacheKey
Key for the parsed PHP file information cache.
Public methods
public void __construct(Cms\Classes\CmsCompoundObject $object)
Creates the class instance
Parameters
- Cms\Classes\CmsCompoundObject $object - A reference to a CMS object to parse.
public array parse()
Parses the CMS object's PHP code section and returns an array with the following keys:
- className
- filePath (path to the parsed PHP file)
- offset (PHP section offset in the template file)
- source ('parser', 'request-cache', or 'cache')
public mixed source(Cms\Classes\Page $page, Cms\Classes\Layout $layout, Cms\Classes\Controller $controller)
Runs the object's PHP file and returns the corresponding object.
Parameters
- Cms\Classes\Page $page - Specifies the CMS page.
- Cms\Classes\Layout $layout - Specifies the CMS layout.
- Cms\Classes\Controller $controller - Specifies the CMS controller.
Protected methods
protected string extractClassFromFile($path)
Extracts the class name from a cache file
Parameters
- $path
protected string getCacheFilePath()
Returns path to the cached parsed file
protected integer getCachedFileInfo()
Returns information about a cached file
protected mixed getCachedInfo()
Returns information about all cached files.
protected void handleCorruptCache($data)
In some rare cases the cache file will not contain the class name we expect. When this happens, destroy the corrupt file, flush the request cache, and repeat the cycle.
Parameters
- $data
protected void makeDirectorySafe($dir)
Make directory with concurrency support
Parameters
- $dir
protected void rebuild(string $path)
Rebuilds the current file cache.
Parameters
- string $path - The path in which the cached file should be stored
protected void storeCachedInfo(array $result)
Stores result data inside cache.
Parameters
- array $result
protected void validate($php)
Evaluates PHP content in order to detect syntax errors. The method handles PHP errors and throws exceptions.
Parameters
- $php
protected void writeContentSafe($path, $content)
Writes content with concurrency support and cache busting This work is based on the Twig\Cache\FilesystemCache class
Parameters
- $path
- $content