xplo.re Medusa Core Framework 3.2
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Event
  • Todo
  • Download

Namespaces

  • Core
    • Authentication
      • Auto
        • Driver
      • Driver
    • Cache
      • Driver
    • Charset
      • Driver
    • Configuration
      • Driver
    • Controller
    • Converter
      • Driver
    • Decoder
      • Driver
    • Encoder
      • Driver
    • Env
      • Authentication
      • Locale
      • Proxy
      • Server
        • HTTP
        • Redirect
        • X
    • Exception
    • Exchange
      • Driver
    • Fault
      • Formatter
        • Driver
      • Incident
        • Exception
      • Reporter
        • Driver
    • Field
    • Filter
      • Driver
    • Formatter
      • Driver
        • coreuimarkup
          • Token
    • Hash
    • Loader
    • Locale
    • Log
      • Driver
    • Module
      • Dependency
        • Requirement
          • Core
          • PHP
      • Linkage
        • Driver
    • PDF
    • Plugin
    • Query
      • Driver
    • Server
      • Driver
    • Session
      • Driver
    • Set
    • Storage
      • Driver
      • Field
        • Element
    • Stream
      • Driver
    • String
    • Translation
      • Driver
      • Language
        • Driver
    • Type
    • URI
      • Driver
    • Version
    • View
      • Driver
        • coreui
          • Control
            • Button
            • Table
          • Element
        • htmlbuilder
          • Tags
        • yui
          • Modules
  • None
  • PHP

Classes

  • Authentication
  • Authentication_Token
  • AutoLoader
  • Cache
  • Charset
  • ClassDescriptor
  • Closure
  • Configuration
  • Controller
  • Converter
  • Date
  • Decoder
  • Delegate
  • Dispatcher
  • Encoder
  • Env
  • Env_Field
  • Env_File
  • Env_FileList
  • Env_Request
  • Env_SERVER
  • Exchange
  • Fault
  • Field
  • Filter
  • Filter_Value
  • Formatter
  • Hash
  • IP
  • Loader
  • Locale
  • Locale_Node
  • Log
  • Module
  • Module_Iterator
  • Nothing
  • Object
  • OS
  • Plugin
  • Profiler
  • Query
  • Registry
  • Resource
  • Server
  • Session
  • Session_Token
  • Set
  • Storage
  • Storage_Result
  • Storage_Statement
  • Stream
  • Translation
  • URI
  • URI_Parameters
  • UUID
  • Value
  • Version
  • View

Interfaces

  • Accessor
  • Chainable
  • Comparable
  • Configurable
  • Equality
  • Identity
  • Inquiry
  • Masquerade
  • Mutator
  • SeekableStream
  • Storable
  • Variator

Exceptions

  • Exception

Constants

  • Copyright
  • ProductName
  • Version

Class Encoder

Provides encoding of arbitrary data. Encoders are commonly used to enable transparent data processing, such as escaping of HTML CDATA, password hashing, conversion of data streams. Additionally, encoder instances can be chained together to provide complex data conversion schemes.

Core\Object implements Core\Chainable
Extended by Core\Set implements Core\Accessor
Extended by Core\Set\Mutable implements Core\Mutator
Extended by Core\Field implements Core\Inquiry
Extended by Core\Encoder

Direct known subclasses

Core\Encoder\Driver\base16, Core\Encoder\Driver\base64, Core\Encoder\Driver\html, Core\Encoder\Driver\integer, Core\Encoder\Driver\md5, Core\Encoder\Driver\md5sum, Core\Encoder\Driver\passthrough, Core\Encoder\Driver\qp, Core\Encoder\Driver\rawurl, Core\Encoder\Driver\serialize, Core\Encoder\Driver\sha1, Core\Encoder\Driver\sha1sum, Core\Encoder\Driver\base64s, Core\Encoder\Driver\smd5, Core\Encoder\Driver\split, Core\Encoder\Driver\ssha, Core\Encoder\Driver\taggedhash, Core\Encoder\Driver\url, Core\Encoder\Driver\uu, Core\Encoder\Driver\boolean, Core\Encoder\Driver\charset, Core\Encoder\Driver\crc32, Core\Encoder\Driver\decimal, Core\Encoder\Driver\delegate, Core\Encoder\Driver\escape, Core\Encoder\Driver\hash

Indirect known subclasses

Core\Encoder\Driver\base16uppercase, Core\Encoder\Driver\clear, Core\Encoder\Driver\escapestring, Core\Encoder\Driver\sha, Core\Encoder\Driver\xml

Abstract
Namespace: Core
Package: Core\Encoder
Since: 3.0
Requires: PHP 5.3
Version: 1.1
Located at Encoder.inc.php

Methods summary

public
# __construct( Core\URI $uri )

Initialises new encoder instance and automatically initialises and chains a successor encoder if specified by URI.

Initialises new encoder instance and automatically initialises and chains a successor encoder if specified by URI.

Parameters

$uri
Reference to describing URI instance from factory.

Since

3.1
public static Core\Encoder
# autocreate( Core\URI $uri )

Parameters

$uri

Returns

Core\Encoder

Since

3.0
public mixed
# __invoke( mixed $value )

Object invocation alias for Core\Encoder::encode().

Object invocation alias for Core\Encoder::encode().

Parameters

$value
Value to encode.

Returns

mixed
Encoded value.

See

Core\Encoder::encode()

Since

3.0
public boolean
# chain( Core\Chainable $object, array $flags = null )

Chains another object to this encoder instance.

Chains another object to this encoder instance.

Parameters

$object

Object to chain to this instance. Supports the following classes:

  • Core\Encoder

    Sets or adds a new successor. If a successor is already set and the boolean replace flag is not set to true, the chain call is delegated to the chain method of the successor. Otherwise a new successor for this instance is set.

  • Core\Inquiry

    Attaches a new data source to this instance.

$flags
Hash of flags. See object parameter description for details.

Returns

boolean
true on success, otherwise false.

Throws

Core\Exception\InvalidArgument
Class of provided object is not supported.

Since

3.0

Overrides

Core\Object::chain
public Core\URI
# decoderChainURI( )

Returns an URI representing the full decoder chain of this instance.

Returns an URI representing the full decoder chain of this instance.

Returns

Core\URI
Reference to URI instance for full decoder chain of this instance.

Since

3.1
public Core\URI
# decoderURI( )

Resolves the decoder initialisation URI to reverse this encoding.

Resolves the decoder initialisation URI to reverse this encoding.

The default implementation returns the initial encoder URI with removed successor. Advanced encoders should provide the best possible decoder URI with parameters that reverse the encoding process.

Returns

Core\URI

Reference to URI instance to initialise decoder with or null, if this encoding does not allow reversal.

See

Core\Decoder
Core\Encoder::resolveDecoderChain()

Since

3.0
public string
# encode( string $data )

Passes arbitrary data through the full encoder chain of this instance and returns the encoded data.

Passes arbitrary data through the full encoder chain of this instance and returns the encoded data.

Parameters

$data
Data to encode.

Returns

string
Encoded data.

Since

3.0
public Core\URI
# encoderChainURI( )

Returns a URI representing the full encoder chain of this instance.

Returns a URI representing the full encoder chain of this instance.

Returns

Core\URI
Reference to URI instance for full encoder chain of this instance.

Since

3.1
public string
# getDataForUndefinedKey( string $key )

Returns a value from an attached data source automatically encoded by this encoder chain via KDC access.

Returns a value from an attached data source automatically encoded by this encoder chain via KDC access.

Parameters

$key
Data key to return encoded value for.

Returns

string
Encoded value for requested key.

Throws

Core\Exception\UndefinedKey
Encoder does not have an attached data source.

Since

3.0

Overrides

Core\Field::getDataForUndefinedKey
public Core\Decoder
# resolveDecoder( )

Returns a decoder instance that reversals this encoding.

Returns a decoder instance that reversals this encoding.

Returns

Core\Decoder

Reference to decoder instance with complete chain of all required successors to reverse the encoding of this encoder instance chain or null, if at least one encoding of this encoder chain is not reversible.

Since

3.0
public Core\URI[]
# resolveDecoderChain( )

Returns an array of decoder URI instances that allow reversal of the full encoder chain of this instance.

Returns an array of decoder URI instances that allow reversal of the full encoder chain of this instance.

Returns

Core\URI[]

Sequential array or references to URI instances that reverse the full encoder chain of this instance.

Since

3.0
public boolean
# reversible( )

Tests, whether this encoding is reversible. This includes tests on the existence of all drivers for an appropriate decoder chain.

Tests, whether this encoding is reversible. This includes tests on the existence of all drivers for an appropriate decoder chain.

An encoding is considered reversible, if the returned encoder chain is complete and all decoder drivers exist. A non-reversible encoding should override this method and directly return false; the standard implementation is comparably costly due to testing for driver existence.

Returns

boolean
true, if the encoding is reversible, otherwise false.

Since

3.0
public boolean
# verify( string $input, string $output )

Verifies that this encoder applied to given input data yields the given output data.

Verifies that this encoder applied to given input data yields the given output data.

Encoder verification is commonly used to verify passwords, where the input is set to the user-supplied password and the output to the stored password hash.

Parameters

$input
Raw data to verify.
$output
Expected output data to verify against.

Returns

boolean
true, if the input matches the output, otherwise false.

Since

3.0
abstract protected string
# _encode( string $data )

Encoder stub used by drivers to implement specific encodings.

Encoder stub used by drivers to implement specific encodings.

Parameters

$data
Data to encode.

Returns

string
Encoded data.

Since

3.0

Methods inherited from Core\Field

getDataForKey(), getDataForKeys(), issetDataForKey(), offsetExists(), offsetGet(), offsetSet(), offsetUnset()

Methods inherited from Core\Set\Mutable

__set(), __unset()

Methods inherited from Core\Set

__get(), __isset()

Methods inherited from Core\Object

__autocreateFactory(), __call(), __processParameters(), __toString(), attachMethod(), getValueForKey(), getValueForKeyPath(), getValueForUndefinedKey(), hash(), issetValueForKey(), setValueForKey(), setValueForKeyPath(), setValueForUndefinedKey(), uuid()

Constants summary

string SuccessorParameter

URI string of encoding successor that is automatically instantiated and chained to the instance during initialisation. Allows description of full encoder chains by a single URI.

URI string of encoding successor that is automatically instantiated and chained to the instance during initialisation. Allows description of full encoder chains by a single URI.

Since

3.0
# 'successor'

Constants inherited from Core\Object

AnyParameterType, AutochainParameterType, AutocreateParameterType, BooleanParameterType, CharParameterType, EnumParameterType, IntegerParameterType, RealParameterType, StringParameterType, UserParameterType

Properties summary

protected array $_v_parameters

Hash of parsed parameters from URI during initialisation.

Hash of parsed parameters from URI during initialisation.

Since

3.1
#
protected Core\Encoder $_v_successor

Subsequent (chained) encoder layer. Defaults to null.

Subsequent (chained) encoder layer. Defaults to null.

Since

3.0
#
protected Core\URI $_v_uri

Reference to URI instance from factory.

Reference to URI instance from factory.

Since

3.1
#

Properties inherited from Core\Field

$_v_data

Magic properties

public read-only Core\Inquiry $dataSource

Attached data source. Defaults to null.

public read-only array $parameters

Hash of parsed parameters from URI during initialisation.

public read-only Core\Encoder $successor

Subsequent (chained) encoder layer. Defaults to null.

public read-only Core\URI $uri

Reference to URI instance from factory.

Magic properties inherited from Core\Field

$data

Magic properties inherited from Core\Object

$hash, $uuid

xplo.re Medusa Core Framework 3.2 API documentation generated by ApiGen