Oroboros Core
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • None
  • oroboros
    • core
      • abstracts
        • adapters
        • bootstrap
        • controllers
        • libraries
          • auth
          • bootstrap
          • cache
          • codex
          • config
          • container
          • data
          • database
          • dns
          • entity
          • enum
          • error
          • event
          • extension
          • file
          • flags
          • hooks
          • job
          • logger
          • manager
          • message
          • prototype
          • request
          • response
          • routine
          • shell
          • startup
          • stream
          • template
          • uri
          • utility
          • validation
            • workers
          • worker
        • models
        • patterns
          • behavioral
          • creational
        • utilities
          • exception
            • cache
            • container
          • http
        • views
      • interfaces
        • adapters
          • interpreters
          • sdk
        • api
          • adapters
          • bootstrap
          • controllers
          • psr
        • contract
          • adapters
          • bootstrap
          • codex
          • components
          • controllers
          • data
          • entities
          • errors
          • events
          • extensions
          • jobs
          • libraries
            • auth
            • cache
            • config
            • container
            • enum
            • file
            • flags
            • hooks
            • module
            • promise
            • record
            • request
            • response
            • server
            • shutdown
            • site
            • stream
            • template
            • theme
            • uri
          • models
          • patterns
            • behavioral
            • concurrency
            • creational
            • structural
          • routes
          • routines
            • bootload
            • declarative
            • procedural
            • subsystem
          • services
            • consumer
              • cgi
              • rest
                • local
                • remote
                  • authenticated
                  • unauthenticated
            • provider
              • cgi
              • rest
                • local
                • remote
                  • authenticated
                  • unauthenticated
          • utilities
            • datetime
            • exception
              • cache
              • container
            • filebase
            • http
            • math
            • parser
            • regex
            • session
          • views
        • enumerated
          • environment
          • flags
          • http
          • views
        • libraries
          • manager
          • worker
      • libraries
        • api
        • codex
        • container
        • enum
          • http
        • file
        • hooks
        • logger
        • math
        • psr4
        • request
        • response
        • stream
        • uri
      • patterns
        • creational
      • traits
        • adapters
        • bootstrap
        • codex
        • components
        • controllers
        • data
        • entities
        • events
        • extensions
        • jobs
        • libraries
          • container
          • file
          • request
          • response
          • stream
          • uri
        • models
        • modules
        • patterns
          • behavioral
          • concurrency
          • creational
          • structural
        • routes
        • services
        • utilities
          • core
            • api
            • config
            • contract
              • contract
            • enum
            • environment
            • routines
          • datetime
          • error
          • exception
          • filebase
          • hooks
          • html
          • http
          • logic
          • math
          • parsers
          • regex
          • session
        • views
      • utilities
        • exception
          • cache
          • container
        • http
      • views
    • tests
      • patterns
        • creational
      • psr
        • psr7
      • utilities
        • exception
  • PasswordCompat
    • binary
  • PHP

Classes

  • AbstractHook
  • AbstractHookParser

Class AbstractHookParser

Abstract Hook Defines a set of methods for identifying and replacing hooks within supplied data.

oroboros\core\abstracts\OroborosBaseAbstract implements oroboros\core\interfaces\BaseAbstractInterface uses oroboros\core\traits\BaseTrait
Extended by oroboros\core\abstracts\libraries\AbstractLibrary implements oroboros\core\interfaces\psr3\LoggerAwareInterface uses oroboros\core\traits\utilities\LoaderTrait, oroboros\core\traits\utilities\DefaultLoggerTrait
Extended by oroboros\core\abstracts\libraries\hooks\AbstractHookParser uses oroboros\core\traits\patterns\behavioral\Registry (not available)
Abstract
Namespace: oroboros\core\abstracts\libraries\hooks
Author: Brian Dayhoff mopsyd@me.com
Located at core/abstracts/libraries/hooks/AbstractHookParser.php

Methods summary

public
# __construct( array $params = array(), array $flags = array() )

Parameters

$params
$flags

Overrides

oroboros\core\abstracts\libraries\AbstractLibrary::__construct
public
# initialize( array $params = array(), array $flags = array() )

Parameters

$params
$flags

Overrides

oroboros\core\abstracts\libraries\AbstractLibrary::initialize
public
# __toString( )
public
# registerHook( $hook, $result = null )
public
# unregisterHook( $hook )
public
# getHookValue( $hook )
public
# getIndices( $hook )
public
# setContent( $content )
public
# getRawContent( )
public
# parse( )

Publicly accessible parse method. Prevents child classes from tampering with the baseline parse operation.

Publicly accessible parse method. Prevents child classes from tampering with the baseline parse operation.

public
# reset( )

Publicly accessible reset method. Prevents child classes from tampering with the baseline reset operation.

Publicly accessible reset method. Prevents child classes from tampering with the baseline reset operation.

public
# resetContent( )
public
# resetHooks( )
public
# getContent( )
protected string
# _hookOverridePrefix( )

If you need a more granular means of generating a debug prefix than a simple string, override this method.

If you need a more granular means of generating a debug prefix than a simple string, override this method.

If a simple string is acceptable, override the class constant: HOOK_DEBUG_PREFIX instead.

Returns

string
protected string
# _hookDebugOverrideSuffix( )

If you need a more granular means of generating a debug suffix than a simple string, override this method.

If you need a more granular means of generating a debug suffix than a simple string, override this method.

If a simple string is acceptable, override the class constant: HOOK_DEBUG_SUFFIX instead.

Returns

string
private
# _getHookIndices( $content, $hook )

Under the hood stuff.

Under the hood stuff.

private
# _getHookDebugInformation( $hook )
private
# _validateHook( $hook )
private
# _replaceHook( $content, $value = null )
private
# _getHookCallbackContent( $callable )
private string;
# _getRawContent( )

Returns the baseline raw content.

Returns the baseline raw content.

Returns

string;
private
# _parse( )

Performs the baseline parse operation.

Performs the baseline parse operation.

private
# _reset( )

Performs the baseline reset operation.

Performs the baseline reset operation.

private
# _resetContent( )
private
# _resetHooks( )
private string
# _contencateContentSafely( mixed $content )

Safely generates content recursively without allowing errors to arise. Will throw an exception if it cannot proceed without errors, and does not make any assumption that partial content is acceptable.

Safely generates content recursively without allowing errors to arise. Will throw an exception if it cannot proceed without errors, and does not make any assumption that partial content is acceptable.

If supplied content is multidimensional, all leaf nodes must be able to be cast to string or an exception will arise.

This method uses recursion if given multidimensional content. Large content complexity may cause performance to hang. If this becomes an issue, chunk out your request more granularly in the referencing class, and ideally populate a stream with the partially processed content so it is not bloating runtime memory.

Parameters

$content
any of the following: [string, int, float, double, bool, null, an object that is iterable, an object with the __toString method]

Returns

string

Throws

oroboros\core\utilities\exception\InvalidArgumentException
if it encounters un-stringable content.
private boolean
# _isIterableObject( stdClass $object )

Returns whether or not the object passed is iterable, and can be handled similarly to an array.

Returns whether or not the object passed is iterable, and can be handled similarly to an array.

Will only accept an actual object (all php classes extend \stdClass). Type checking needs to be done earlier on if it applies. Will produce a fatal error if you give it anything else.

Checks against native php valid iterable interfaces, and returns true if the object or it's parent implements either of them.

Parameters

$object

Returns

boolean

See

http://php.net/manual/en/class.iterator.php
http://php.net/manual/en/class.iteratoraggregate.php
http://php.net/manual/en/class.traversable.php

Note

when only PHP 7.0+ is supported, this will be replaced with the native is_iterable function.
private boolean
# _isDebugEnabled( )

Checks if debug is enabled for the current object instance.

Checks if debug is enabled for the current object instance.

Returns

boolean
private string|null
# _getDebugPrefix( string $hook )

Returns the debug hook replacement prefix if debug is enabled, and null if it isn't.

Returns the debug hook replacement prefix if debug is enabled, and null if it isn't.

Parameters

$hook

Returns

string|null

See

\oroboros\core\abstracts\libraries\hooks\AbstractHook::_isDebugEnabled
private string|null
# _getDebugSuffix( string $hook )

Returns the debug hook replacement suffix if debug is enabled, and null if it isn't.

Returns the debug hook replacement suffix if debug is enabled, and null if it isn't.

Parameters

$hook

Returns

string|null

See

\oroboros\core\abstracts\libraries\hooks\AbstractHook::_isDebugEnabled
private
# _getHookValue( $hook )
private
# _setHook( $hook, $value )
private
# _unsetHook( $hook )
private
# _listHooks( )
private
# _getValidHookNames( )
private
# _getHookValueByKey( $hook )

Methods inherited from oroboros\core\abstracts\libraries\AbstractLibrary

__destruct()

Methods inherited from oroboros\core\interfaces\BaseAbstractInterface

fingerprint()

Methods used from oroboros\core\traits\utilities\LoaderTrait

_initializeLoader(), _load(), _setAllowedLoaderTypes()

Methods used from oroboros\core\traits\utilities\DefaultLoggerTrait

_getLogger(), _log(), setLogger()

Constants summary

string HOOK_PREFIX

Overrideable way of designating the prefix of a valid hook

Overrideable way of designating the prefix of a valid hook

# '::'
string HOOK_SUFFIX

Overrideable way of designating the suffix of a valid hook

Overrideable way of designating the suffix of a valid hook

# '::'
string HOOK_DEBUG_PREFIX

If the debug flag is passed, parsed output will prefix the hooked content with this value, applying sprintf to it with the parameters $hook and $current_class

If the debug flag is passed, parsed output will prefix the hooked content with this value, applying sprintf to it with the parameters $hook and $current_class

# '\r\n[HOOK_DEBUG: start_hook[hook: _%s_][class: _%s_ ]\r\n'
string HOOK_DEBUG_SUFFIX

If the debug flag is passed, parsed output will suffix the hooked content with this value, applying sprintf to it with the parameters $hook and $current_class

If the debug flag is passed, parsed output will suffix the hooked content with this value, applying sprintf to it with the parameters $hook and $current_class

# '\r\n[/hook: _%s_][class: _%s_] /HOOK_DEBUG]\r\n'
string CONTENCATION_DELIMITER

Overrideable way of designating the implode delimiter for content that is an array.

Overrideable way of designating the implode delimiter for content that is an array.

By default, uses line breaks. This only applies if the content is an array or an iterable object.

# PHP_EOL

Constants inherited from oroboros\core\abstracts\OroborosBaseAbstract

API, CLASS_SCOPE

Constants inherited from oroboros\core\interfaces\api\LogLevelApi

ALERT, CRITICAL, DEBUG, EMERGENCY, ERROR, INFO, NOTICE, WARNING

Constants inherited from oroboros\core\interfaces\api\FlagApi

FLAG_ALPHA, FLAG_BETA, FLAG_DEBUG, FLAG_DEVELOPMENT, FLAG_LOCK_EXECUTE, FLAG_LOCK_READ, FLAG_LOCK_WRITE, FLAG_MAINTENANCE, FLAG_MODE_AJAX, FLAG_MODE_CLI, FLAG_PRODUCTION, FLAG_READONLY, FLAG_RECOVERY, FLAG_SANDBOX, FLAG_TYPE_DELETE, FLAG_TYPE_GET, FLAG_TYPE_HEAD, FLAG_TYPE_OPTIONS, FLAG_TYPE_POST, FLAG_TYPE_PUT, FLAG_UNIT_TEST

Constants inherited from oroboros\core\interfaces\api\ExceptionCodeApi

ERROR_ADAPTER, ERROR_CLUSTER, ERROR_CONTROLLER, ERROR_CORE, ERROR_CORE_ADAPTER_FAILURE, ERROR_CORE_AUTH_FAILURE, ERROR_CORE_BOOTSTRAP_FAILURE, ERROR_CORE_CONTROLLER_FAILURE, ERROR_CORE_DATA_OBJECT_FAILURE, ERROR_CORE_ENTITY_FAILURE, ERROR_CORE_ENUM_FAILURE, ERROR_CORE_ERROR_FAILURE, ERROR_CORE_EVENT_FAILURE, ERROR_CORE_EXTENSION_FAILURE, ERROR_CORE_FLAG_FAILURE, ERROR_CORE_FUNCTION_FAILURE, ERROR_CORE_JOB_FAILURE, ERROR_CORE_LIBRARY_FAILURE, ERROR_CORE_MODEL_FAILURE, ERROR_CORE_MODULE_FAILURE, ERROR_CORE_PARSER_FAILURE, ERROR_CORE_PATTERN_FAILURE, ERROR_CORE_RECORD_FAILURE, ERROR_CORE_REQUEST_FAILURE, ERROR_CORE_RESPONSE_FAILURE, ERROR_CORE_ROUTER_FAILURE, ERROR_CORE_ROUTINE_FAILURE, ERROR_CORE_SERVICE_FAILURE, ERROR_CORE_STREAM_FAILURE, ERROR_CORE_UTILITY_FAILURE, ERROR_CORE_VIEW_FAILURE, ERROR_DATABASE, ERROR_FILESYSTEM, ERROR_INITIALIZATION, ERROR_INSTALLATION, ERROR_LIBRARY, ERROR_LOGIC, ERROR_LOGIC_BAD_PARAMETERS, ERROR_LOGIC_MISSING_PARAMETERS, ERROR_MODEL, ERROR_MODULE, ERROR_NETWORK, ERROR_NODE, ERROR_PHP, ERROR_PHP_BAD_FUNCTION_CALL, ERROR_PHP_BAD_METHOD_CALL, ERROR_PHP_BAD_PARAMETERS, ERROR_PHP_CALLSTATIC_FAILURE, ERROR_PHP_CALL_FAILURE, ERROR_PHP_CLONE_FAILURE, ERROR_PHP_DEBUG_INFO_FAILURE, ERROR_PHP_DESTRUCTOR_FAILURE, ERROR_PHP_GETTER_FAILURE, ERROR_PHP_INSTANTIATION_FAILURE, ERROR_PHP_INVOCATION_FAILURE, ERROR_PHP_IS_SET_FAILURE, ERROR_PHP_KEY_NOT_FOUND, ERROR_PHP_METHOD_FAILURE, ERROR_PHP_NOT_INITIALIZED, ERROR_PHP_SERIALIZATION_FAILURE, ERROR_PHP_SETTER_FAILURE, ERROR_PHP_SLEEP_FAILURE, ERROR_PHP_TO_ARRAY_FAILURE, ERROR_PHP_UNSERIALIZATION_FAILURE, ERROR_PHP_UN_SET_FAILURE, ERROR_PHP_WAKEUP_FAILURE, ERROR_PHP_WRONG_INSTANCE_SUPPLIED, ERROR_PHP_WRONG_SCHEMA_PROVIDED, ERROR_ROUTINE, ERROR_ROUTING, ERROR_SDK, ERROR_SECURITY, ERROR_SECURITY_LOCKED_COLUMN, ERROR_SECURITY_LOCKED_COMMAND, ERROR_SECURITY_LOCKED_ENTITY, ERROR_SECURITY_LOCKED_EVENT, ERROR_SECURITY_LOCKED_FILE, ERROR_SECURITY_LOCKED_JOB, ERROR_SECURITY_LOCKED_OBJECT, ERROR_SECURITY_LOCKED_POLICY, ERROR_SECURITY_LOCKED_RESOURCE, ERROR_SECURITY_LOCKED_ROUTE, ERROR_SECURITY_LOCKED_TABLE, ERROR_SESSION, ERROR_UNKNOWN, ERROR_VIEW, SAFE_MINIMUM_ERROR_RANGE

Constants inherited from oroboros\OroborosInterface

OROBOROS_VENDOR_NAMESPACE, OROBOROS_VERSION

Properties summary

private $_content
# null
private boolean $_isParsed
# false
private boolean $_debug_enabled
# false
private boolean $_use_hook_debug_override_methods
# false

Properties used from oroboros\core\traits\BaseTrait

$_constructed

Properties used from oroboros\core\traits\utilities\LoaderTrait

$_LoaderTrait_allowed_types, $_LoaderTrait_factory, $_LoaderTrait_loader_initialized, $_LoaderTrait_loader_types

Properties used from oroboros\core\traits\utilities\DefaultLoggerTrait

$_DefaultLoggerTrait_logger

Oroboros Core API documentation generated by ApiGen