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

Traits

  • DefaultLoggerTrait
  • ExceptionHelperTrait
  • LoaderTrait
  • UtilityTrait

Trait UtilityTrait

Provides compatibility with oroboros core for 3rd party class children.

Direct Known Users

oroboros\core\traits\BaseTrait

Namespace: oroboros\core\traits\utilities
Author: Brian Dayhoff mopsyd@me.com
Requires: \oroboros\core\interfaces\api\UtilityApi
Located at core/traits/utilities/UtilityTrait.php

Methods summary

public type
# __get( string $name )

Defers magic method getter to the standard getter method

Defers magic method getter to the standard getter method

Parameters

$name

Returns

type

Since

0.0.1a
public type
# __set( type $name, type $value )

Defers magic method setter to the standard setter method

Defers magic method setter to the standard setter method

Parameters

$name
$value

Returns

type

Since

0.0.1a
public boolean
# set( type $key, mixed $value )

Default standard setter. Performs the same as the native php getter, except that it honors locks if they are defined.

Default standard setter. Performs the same as the native php getter, except that it honors locks if they are defined.

Parameters

$key
$value

Returns

boolean

Since

0.0.1a
public mixed
# get( string $id )

Default standard getter. Throws an oroboros exception if resource not found instead of an error. Otherwise behaves the same as the native php getter.

Default standard getter. Throws an oroboros exception if resource not found instead of an error. Otherwise behaves the same as the native php getter.

Parameters

$id
$key

Returns

mixed

Throws

oroboros\core\utilities\exception\Exception

Since

0.0.1a
public
# initialize( array $params = array(), array $flags = array() )

Provides an unopinionated way to initialize parameters and flags. This class does nothing with the parameters or flags aside from storing them so they can be referenced and checked against. Child classes should implement their own functionality around this, but it can be safely ignored entirely.

Provides an unopinionated way to initialize parameters and flags. This class does nothing with the parameters or flags aside from storing them so they can be referenced and checked against. Child classes should implement their own functionality around this, but it can be safely ignored entirely.

Parameters

$params
$flags

Since

0.0.1a

Note

Parameter and flag initialization can also happen directly in the constructor if they need to be exposed before your class initialization method runs, or may be exposed at both if you need to separate pre-initialization parameters from initialization parameters.
public boolean
# isInitialized( )

Provides a simple way of checking if initialization has occurred. If initialization method has been called, this will return true.

Provides a simple way of checking if initialization has occurred. If initialization method has been called, this will return true.

Returns

boolean

Since

0.0.2a
final public type
# fingerprint( )

This returns the unique fingerprint of the object. All instantiated Oroboros objects have this method. This method may not be overruled.

This returns the unique fingerprint of the object. All instantiated Oroboros objects have this method. This method may not be overruled.

Returns

type

Since

0.0.2a
protected boolean
# _isConstructed( )

Returns [true] if the base class has been constructed. Useful for sanity checks and control blocks that suppress triggers from firing before construction is complete.

Returns [true] if the base class has been constructed. Useful for sanity checks and control blocks that suppress triggers from firing before construction is complete.

Returns

boolean

Since

0.0.2a
protected type
# _checkLocks( array $status )

Provides a simple way of checking all current lock types at once.

Provides a simple way of checking all current lock types at once.

Parameters

$status

Returns

type

Throws

Exception

Since

0.0.1a
protected type
# _checkLock( type $type )

Checks whether the provided type is enabled or disabled. If the type is not recognized, throws an exception.

Checks whether the provided type is enabled or disabled. If the type is not recognized, throws an exception.

Parameters

$type

Returns

type

Throws

oroboros\core\utilities\exception\Exception

Since

0.0.1a
protected type
# _setLock( string $type, boolean $value )

Sets a lock to the specified state (true is on, false is off).

Sets a lock to the specified state (true is on, false is off).

Parameters

$type
["read", "write", "execute"]
$value
[true, false, 0, 1]

Returns

type

Throws

oroboros\core\utilities\exception\Exception

Since

0.0.1a
protected
# _updateParameterConditions( $parameter_key )

Overrule this method with how your parameters passed into the constructor or initialization method should be handled. It will be called whenever those parameters are updated.

Overrule this method with how your parameters passed into the constructor or initialization method should be handled. It will be called whenever those parameters are updated.

Since

0.0.1a
protected
# _updateFlagConditions( )

Overrule this method with how your flags passed into the constructor or initialization method should be handled. It will be called whenever those parameters are updated.

Overrule this method with how your flags passed into the constructor or initialization method should be handled. It will be called whenever those parameters are updated.

Since

0.0.1a
protected
# _setFlag( type $key )

Sets a flag.

Sets a flag.

Parameters

$key

Throws

oroboros\core\utilities\exception\Exception

Since

0.0.1a
protected boolean
# _checkFlag( string $flag )

Checks if a specific flag has been set.

Checks if a specific flag has been set.

Parameters

$flag

Returns

boolean

Since

0.0.1a
protected boolean
# _checkParam( string $key )

Returns [true] if a parameter is defined, [false] if undefined. This can be used to circumvent exceptions if the presence of a specific parameter is not certain.

Returns [true] if a parameter is defined, [false] if undefined. This can be used to circumvent exceptions if the presence of a specific parameter is not certain.

Parameters

$key

Returns

boolean

Since

0.0.2a
protected mixed
# _getParam( string $key )

Gets a specific parameter by key.

Gets a specific parameter by key.

Parameters

$key

Returns

mixed

Throws

oroboros\core\utilities\exception\Exception
protected
# _setParam( string $key, mixed $value )

Sets a specific parameter.

Sets a specific parameter.

Parameters

$key
$value

Since

0.0.1a
protected
# _setParams( array $params )

Sets a list of parameters.

Sets a list of parameters.

Parameters

$params

Since

0.0.2a
private
# _handleParameters( array $parameters )

If [$parameters] is provided, sets the object flags to the provided values, and calls the _updateParameterConditions method. If no parameters provided, Sets the parameters back to their default state, and calls the _updateParametersConditions method (which fires any time parameters are updated).

If [$parameters] is provided, sets the object flags to the provided values, and calls the _updateParameterConditions method. If no parameters provided, Sets the parameters back to their default state, and calls the _updateParametersConditions method (which fires any time parameters are updated).

Parameters

$parameters
private
# _handleFlags( array $flags )

If [$flag] is provided, sets the object flags to the provided values, and calls the _updateFlagConditions method. If no parameters provided, Sets the flags back to their default state, and calls the _updateFlagConditions method (which fires any time flags are updated).

If [$flag] is provided, sets the object flags to the provided values, and calls the _updateFlagConditions method. If no parameters provided, Sets the flags back to their default state, and calls the _updateFlagConditions method (which fires any time flags are updated).

private
# _resetParameters( )

Resets the defined class parameters to their default state.

Resets the defined class parameters to their default state.

Since

0.0.1a
private
# _resetFlags( )

Resets flags in the object back to their predefined defaults.

Resets flags in the object back to their predefined defaults.

Since

0.0.1a
protected
# _setFlags( array $flags )

Sets a group of flags.

Sets a group of flags.

Parameters

$flags

Since

0.0.2a
private
# _lock( type $type )

Places a lock on this object instance for one of the specified lock types [read, write, execute].

Places a lock on this object instance for one of the specified lock types [read, write, execute].

Parameters

$type

Throws

oroboros\core\utilities\exception\Exception

Since

0.0.1a
private
# _unlock( type $type )

Unlocks access in the class for a specific lock type [read, write, execute]

Unlocks access in the class for a specific lock type [read, write, execute]

Parameters

$type

Throws

oroboros\core\utilities\exception\Exception

Since

0.0.1a
private string
# _generateObjectFingerprint( )

Creates a unique fingerprint string.

Creates a unique fingerprint string.

Returns

string

Since

0.0.2a
private
# _setFingerprint( )

Sets a unique fingerprint for each instantiated instance of a class.

Sets a unique fingerprint for each instantiated instance of a class.

Since

0.0.2a

Properties summary

private static array $_fingerprint_instances

This is a list of all currently registered class fingerprints. It is only accessible to this class. This is used to insure that there are no collisions in instance keys for any reason (without needing to implement a heavier randomization engine), and otherwise has no effect.

This is a list of all currently registered class fingerprints. It is only accessible to this class. This is used to insure that there are no collisions in instance keys for any reason (without needing to implement a heavier randomization engine), and otherwise has no effect.

# array()
private string $_fingerprint

This is generated at the end of the base class constructor sequence. It is a unique key that can only exist for that specific instance of a constructor firing.

This is generated at the end of the base class constructor sequence. It is a unique key that can only exist for that specific instance of a constructor firing.

#
private boolean $_initialized
# false
private array $_parameters
# array()
private array $_default_parameters
# array()
private boolean $_parameters_initialized
# false
private array $_flags
# array()
private array $_default_flags
# array()
private boolean $_flags_initialized
# false
private array $_locks
# array( "read" => false, //disables reading public variables "write" => false, //disables setting public variables "execute" => false, //disables any methods that use $this->_checkLockStatus("execute"); )
Oroboros Core API documentation generated by ApiGen