PHP Class AppserverIo\Appserver\Naming\NamingDirectory

Inheritance: extends AppserverIo\Storage\GenericStackable, implements AppserverIo\Psr\Naming\NamingDirectoryInterface, use trait AppserverIo\Appserver\Core\Traits\ThreadedContextTrait
Show file Open project: appserver-io/appserver Class Usage Examples

Public Methods

Method Description
__construct ( string $name = null, AppserverIo\Psr\Naming\NamingDirectoryInterface $parent = null ) Initialize the directory with a name and the parent one.
__toString ( ) : string Returns a string representation of the naming directory
appendDirectory ( string $name ) : string Append's the passed name to the actual path and return's the new path.
bind ( string $name, mixed $value, array $args = [] ) : void Binds the passed instance with the name to the naming directory.
bindCallback ( string $name, callable $callback, array $args = [] ) : void Binds the passed callback with the name to the naming directory.
bindReference ( string $name, string $reference ) : void Binds a reference with the passed name to the naming directory.
containsScheme ( string $name ) : boolean Query whether the passed name contains the scheme or not.
createSubdirectory ( string $name, array $filter = [] ) : NamingDirectory Create and return a new naming subdirectory with the attributes of this one.
findRoot ( ) : AppserverIo\Psr\Naming\NamingDirectoryInterface Returns the root node of the naming directory tree.
getDirectory ( ) : string Return's the directory.
getIdentifier ( ) : string The unique identifier of this directory. That'll be build up recursive from the scheme and the root directory.
getName ( ) : string Returns the directory name.
getParent ( ) : AppserverIo\Psr\Naming\NamingDirectoryInterface Returns the parend directory.
getScheme ( ) : string Returns the scheme.
prepareDirectory ( string $name ) : The Prepare's and return's the path either by stripping of the scheme if it is absolute or append the name, if it is relative.
search ( string $name, array $args = [] ) : mixed Queries the naming directory for the requested name and returns the value or invokes the bound callback.
setDirectory ( string $name ) : void Set's the passed directory.
setScheme ( string $scheme ) : void Set the scheme, php or http for example
stripSchema ( string $name ) : string Strip off the schema and return the directory part only.
toArray ( array &$buffer = [] ) : array Builds an array with a string representation of the naming directories content.
unbind ( string $name ) : void Unbinds the named object from the naming directory.

Method Details

__construct() public method

Initialize the directory with a name and the parent one.
public __construct ( string $name = null, AppserverIo\Psr\Naming\NamingDirectoryInterface $parent = null )
$name string The directory name
$parent AppserverIo\Psr\Naming\NamingDirectoryInterface The parent directory

__toString() public method

Returns a string representation of the naming directory
public __toString ( ) : string
return string The string representation of the naming directory

appendDirectory() public method

Append's the passed name to the actual path and return's the new path.
public appendDirectory ( string $name ) : string
$name string The name to append to the path
return string The new path, with the name appended

bind() public method

Binds the passed instance with the name to the naming directory.
public bind ( string $name, mixed $value, array $args = [] ) : void
$name string The name to bind the value with
$value mixed The object instance to bind
$args array The array with the arguments
return void

bindCallback() public method

Binds the passed callback with the name to the naming directory.
See also: AppserverIo\Appserver\Naming\NamingDirectory::bind()
public bindCallback ( string $name, callable $callback, array $args = [] ) : void
$name string The name to bind the callback with
$callback callable The callback to be invoked when searching for
$args array The array with the arguments passed to the callback when executed
return void

bindReference() public method

Binds a reference with the passed name to the naming directory.
See also: AppserverIo\Appserver\Naming\NamingDirectory::bind()
public bindReference ( string $name, string $reference ) : void
$name string The name to bind the reference with
$reference string The name of the reference
return void

containsScheme() public method

Query whether the passed name contains the scheme or not.
public containsScheme ( string $name ) : boolean
$name string The name to query for a scheme
return boolean TRUE if the name contains the scheme, else FALSE

createSubdirectory() public method

Create and return a new naming subdirectory with the attributes of this one.
public createSubdirectory ( string $name, array $filter = [] ) : NamingDirectory
$name string The name of the new subdirectory
$filter array Array with filters that will be applied when copy the attributes
return NamingDirectory The new naming subdirectory

findRoot() public method

Returns the root node of the naming directory tree.
Deprecation:
public findRoot ( ) : AppserverIo\Psr\Naming\NamingDirectoryInterface
return AppserverIo\Psr\Naming\NamingDirectoryInterface The root node

getDirectory() public method

Return's the directory.
public getDirectory ( ) : string
return string The directory

getIdentifier() public method

The unique identifier of this directory. That'll be build up recursive from the scheme and the root directory.
See also: AppserverIo\Storage\StorageInterface::getIdentifier()
public getIdentifier ( ) : string
return string The unique identifier

getName() public method

Returns the directory name.
public getName ( ) : string
return string The directory name

getParent() public method

Returns the parend directory.
Deprecation:
public getParent ( ) : AppserverIo\Psr\Naming\NamingDirectoryInterface
return AppserverIo\Psr\Naming\NamingDirectoryInterface

getScheme() public method

Returns the scheme.
public getScheme ( ) : string
return string The scheme we want to use

prepareDirectory() public method

Prepare's and return's the path either by stripping of the scheme if it is absolute or append the name, if it is relative.
public prepareDirectory ( string $name ) : The
$name string The name to prepare the directory with
return The prepared path

setDirectory() public method

Set's the passed directory.
public setDirectory ( string $name ) : void
$name string The directory to set
return void

setScheme() public method

Set the scheme, php or http for example
public setScheme ( string $scheme ) : void
$scheme string The scheme we want to use
return void

stripSchema() public method

Strip off the schema and return the directory part only.
public stripSchema ( string $name ) : string
$name string The directory, maybe containing the scheme
return string The directory without the scheme

toArray() public method

Builds an array with a string representation of the naming directories content.
public toArray ( array &$buffer = [] ) : array
$buffer array The array to append the values to
return array The array with the naming directories string representation

unbind() public method

Unbinds the named object from the naming directory.
public unbind ( string $name ) : void
$name string The name of the object to unbind
return void