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

Namespaces

  • Core
    • Authentication
      • Auto
        • Driver
      • Driver
    • Cache
      • Driver
    • Charset
      • Driver
    • Configuration
    • Controller
    • Converter
      • Driver
    • Decoder
      • Driver
    • Encoder
      • Driver
    • Env
      • Authentication
      • Locale
      • Proxy
      • Server
        • HTTP
        • Redirect
        • X
    • Exception
    • Exchange
      • 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
    • 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
  • 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_Iterator
  • 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
  • String
  • 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
  • UseVersion
  • Version

Functions

  • ns_expand
  • ns_file_exists
  • ns_get_version
  • ns_resolve

Class Loader

Module resolver and loader. Also used by the auto-loader. Keeps track of loaded modules and automatically records time and memory states for modules if enabled in Core configuration.

Namespace: Core
Package: Core
Since: 3.0
Requires: PHP 5.3
Version: 2.0
Located at Loader.inc.php

Methods summary

protected static
# _load( string $module, string $filename, Core\Profiler $profiler )

Internal actual module loader.

Internal actual module loader.

Parameters

$module
Name of module to load.
$filename

Filename of module to load. Automatically resolves the file based on the PHP include path.

$profiler

Profiler instance used to record time and memory states for the module. Set to null to disable profiler.

Throws

Core\Exception\Loader
Module file does not exist or an error occurred while loading the file.

Since

3.0
public static string
# classNameFromModule( $module )

Returns the default class name for a given module.

Returns the default class name for a given module.

The standard class name of a module is the class with the same namespace and base name as the requested module. Note, that the returned value does not implicate the existence of such a class.

Parameters

$module
of module to extract default class name from.

Returns

string
Standard class name for the module with full namespace hierarchy.

Since

3.1
public static string
# cleanupModuleName( $module )

Returns the unified module name from a given string.

Returns the unified module name from a given string.

Parameters

$module
name to return unified variant for.

Returns

string
Unified module name.

Since

3.1
public static string
# driverNameFromClassAndScheme( $class, $scheme )

Formats class name for driver factories.

Formats class name for driver factories.

Parameters

$class

of base class to render driver name for. Usually __CLASS__ is used for standard driver factories. Namespace prefix is mandatory.

$scheme

or Core\URI instance to derive driver class name from. If a Core\URI instance is given, the scheme is automatically extracted. If a provided Core\URI instance includes a scheme namespace, the primary namespace of the given class bane is replaced by the scheme namespace. This is useful to provide inter-library class hierarchies, e.g. applications usually placing views in their own namespace to avoid cluttering the Core namespace.

Returns

string

Class name including namespace information, Core\URI scheme and base class name.

Since

3.1
public static string
# encodeName( $string )

Returns a function, module and class name-safe variant of a string. All characters except alphanumeric characters and underscores are removed.

Returns a function, module and class name-safe variant of a string. All characters except alphanumeric characters and underscores are removed.

Parameters

$string
to return name-safe variant of.

Returns

string

Variant of source string that is safe to use as a file, module, class, function and variable name. If the resulting string is of empty, a single underscore is returned instead.

See

Core\Loader::encodeNameFS()

Since

3.1
public static string
# encodeNameFS( string $string )

Returns a filesystem-safe version of a given string. All characters which may not be handled correctly by some file system are replaced with an underscore.

Returns a filesystem-safe version of a given string. All characters which may not be handled correctly by some file system are replaced with an underscore.

No characters are truncated from the filename. The returned string has the same length as the original string.

Parameters

$string
String to return filesystem-safe variant of.

Returns

string

Variant of source string with all characters not being a Latin alphabet letter or number, minus sign, underscore or dot replaced by an underscore.

See

Core\Loader::encodeName()

Since

3.1
public static string[]
# getLoadedModules( )

Returns an array containing all loaded module names.

Returns an array containing all loaded module names.

Returns

string[]
Array of loaded module names.

Since

3.0
public static string
# getModuleFilename( $module, $omitSuffix = false )

Returns the filename for a given module identifier.

Returns the filename for a given module identifier.

Note, that this method does not test, whether the resulting filename exists.

Parameters

$module
name to retrieve filename for.
$omitSuffix

set to a value that evaluates to true, the filename suffix is omitted. Defaults to false.

Returns

string
Filename of given module.

Since

3.0
public static array|false
# getModuleInfo( string $module )

Returns information set on a specified module.

Returns information set on a specified module.

Parameters

$module
Name of module to retrieve information for.

Returns

array|false

Associative array of module information of false if the named module is not loaded.

Since

3.0 \todo Prototype. Planned to include further module information.


public static
# getModuleInfoList( )

Returns an array of all loaded modules with their information sets.

Returns an array of all loaded modules with their information sets.

Since

3.0 \todo Prototype, probably obsolete.


public static string|false
# getModuleWithFilename( $filename )

Returns the name of a registered module based on the filename.

Returns the name of a registered module based on the filename.

Parameters

$filename
to search module for.

Returns

string|false
Name of module with given filename, otherwise false.

Since

3.1
public static boolean
# loadModule( $arg1 )

Loads a set of given module names.

Loads a set of given module names.

Parameters

$arg1

of modules to load. Multiple module name arguments are supported. Requires fully qualified module names (with full namespace hierarchy).

Returns

boolean
true on success, otherwise an exception is thrown.

Throws

Core\Exception\Loader

Either the module name does not contain the full namespace hierarchy, the module file does not exist or is not readable.

Event

Observers are notified after a module has been loaded.

See

Core\Loader::observeModuleLoaded()

Since

3.0
public static Core\Delegate
# observeModuleLoaded( $objectOrString, string $methodName = null )

Registers an observer for the Module.Loaded event.

Registers an observer for the Module.Loaded event.

Parameters

$objectOrString
Closure::add().
$methodName
See Closure::add().

Returns

Core\Delegate
Registered delegate.

Throws

Core\Exception\Delegate
Core\Exception\Loader

Since

3.1
public static
# registerModule( $version )

Registers module information for the currently loaded module. This is the first method a regular module should call:

Registers module information for the currently loaded module. This is the first method a regular module should call:

Loader::registerModule ('1.0-dev (revision)');

A call to this method is only valid for modules loaded via the Core module loader interface. Otherwise an exception is thrown.

Parameters

$version
version string or false, if no version information is available.

Throws

Core\Exception\Loader
Module registration called from outside the loader process.

Since

3.0
xplo.re Medusa Core Framework 3.1 API documentation generated by ApiGen