JOOMLA中国
  • Joomla中国首页
  • 社区
  • 教程
  • 应用市场
  • B计划
Joomla! Framework TM
  • Namespace
  • Class
  • Tree
  • Deprecated

Namespaces

  • Composer
    • Autoload
  • Joomla
    • Application
      • Cli
        • Output
          • Processor
      • Web
    • Data
    • DI
      • Exception
    • Event
    • Filter
    • Input
    • Ldap
    • Registry
      • Format
    • Session
      • Storage
    • String
    • Uri
    • Utilities
  • None
  • PasswordCompat
    • binary
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Yaml
        • Exception
    • Polyfill
      • Util

Classes

  • AbstractRegistryFormat
  • Factory
  • Registry

Interfaces

  • FormatInterface

Class Registry

Registry class

Joomla\Registry\Registry implements JsonSerializable, ArrayAccess, IteratorAggregate, Countable

Direct known subclasses

JKeychain

Namespace: Joomla\Registry
Since: 1.0
Located at vendor/joomla/registry/src/Registry.php

Methods summary

public
# __construct( mixed $data = null )

Constructor

Constructor

Parameters

$data
mixed - $data The data to bind to the new Registry object.

Since

1.0
public Joomla\Registry\Registry
# __clone( )

Magic function to clone the registry object.

Magic function to clone the registry object.

Returns

Joomla\Registry\Registry

Since

1.0
public string
# __toString( )

Magic function to render this object as a string using default args of toString method.

Magic function to render this object as a string using default args of toString method.

Returns

string

Since

1.0
public integer
# count( )

Count elements of the data object

Count elements of the data object

Returns

integer - The custom count as an integer.

Since

1.3.0

Link

http://php.net/manual/en/countable.count.php

Implementation of

Countable::count()
public object
# jsonSerialize( )

Implementation for the JsonSerializable interface. Allows us to pass Registry objects to json_encode.

Implementation for the JsonSerializable interface. Allows us to pass Registry objects to json_encode.

Returns

object

Since

1.0

Note

The interface is only present in PHP 5.4 and up.

Implementation of

JsonSerializable::jsonSerialize()
public mixed
# def( string $key, mixed $default = '' )

Sets a default value if not already assigned.

Sets a default value if not already assigned.

Parameters

$key
string - $key The name of the parameter.
$default
mixed - $default An optional value for the parameter.

Returns

mixed - The value set, or the default if the value was not previously set (or null).

Since

1.0
public boolean
# exists( string $path )

Check if a registry path exists.

Check if a registry path exists.

Parameters

$path
string - $path Registry path (e.g. joomla.content.showauthor)

Returns

boolean

Since

1.0
public mixed
# get( string $path, mixed $default = null )

Get a registry value.

Get a registry value.

Parameters

$path
string - $path Registry path (e.g. joomla.content.showauthor)
$default
mixed - $default Optional default value, returned if the internal value is null.

Returns

mixed - Value of entry or null

Since

1.0
public static Joomla\Registry\Registry
# getInstance( string $id )

Returns a reference to a global Registry object, only creating it if it doesn't already exist.

Returns a reference to a global Registry object, only creating it if it doesn't already exist.

This method must be invoked as:

$registry = Registry::getInstance($id);

Deprecated

2.0 Instantiate a new Registry instance instead

Parameters

$id
string - $id An ID for the registry instance

Returns

Joomla\Registry\Registry - The Registry object.

Since

1.0
public ArrayIterator
# getIterator( )

Gets this object represented as an ArrayIterator.

Gets this object represented as an ArrayIterator.

This allows the data properties to be accessed via a foreach statement.

Returns

ArrayIterator - This object represented as an ArrayIterator.

Since

1.3.0

See

IteratorAggregate::getIterator()

Implementation of

IteratorAggregate::getIterator()
public Joomla\Registry\Registry
# loadArray( array $array, boolean $flattened = false, string $separator = null )

Load an associative array of values into the default namespace

Load an associative array of values into the default namespace

Parameters

$array
array - $array Associative array of value to load
$flattened
boolean - $flattened Load from a one-dimensional array
$separator
string - $separator The key separator

Returns

Joomla\Registry\Registry - Return this object to support chaining.

Since

1.0
public Joomla\Registry\Registry
# loadObject( object $object )

Load the public variables of the object into the default namespace.

Load the public variables of the object into the default namespace.

Parameters

$object
object - $object The object holding the publics to load

Returns

Joomla\Registry\Registry - Return this object to support chaining.

Since

1.0
public Joomla\Registry\Registry
# loadFile( string $file, string $format = 'JSON', array $options = array() )

Load the contents of a file into the registry

Load the contents of a file into the registry

Parameters

$file
string - $file Path to file to load
$format
string - $format Format of the file [optional: defaults to JSON]
$options
array - $options Options used by the formatter

Returns

Joomla\Registry\Registry - Return this object to support chaining.

Since

1.0
public Joomla\Registry\Registry
# loadString( string $data, string $format = 'JSON', array $options = array() )

Load a string into the registry

Load a string into the registry

Parameters

$data
string - $data String to load into the registry
$format
string - $format Format of the string
$options
array - $options Options used by the formatter

Returns

Joomla\Registry\Registry - Return this object to support chaining.

Since

1.0
public Joomla\Registry\Registry
# merge( Joomla\Registry\Registry $source, boolean $recursive = false )

Merge a Registry object into this one

Merge a Registry object into this one

Parameters

$source
Joomla\Registry\Registry - $source Source Registry object to merge.
$recursive
boolean - $recursive True to support recursive merge the children values.

Returns

Joomla\Registry\Registry - Return this object to support chaining.

Since

1.0
public Joomla\Registry\Registry|null
# extract( string $path )

Method to extract a sub-registry from path

Method to extract a sub-registry from path

Parameters

$path
string - $path Registry path (e.g. joomla.content.showauthor)

Returns

Joomla\Registry\Registry|null - Registry object if data is present

Since

1.2.0
public boolean
# offsetExists( mixed $offset )

Checks whether an offset exists in the iterator.

Checks whether an offset exists in the iterator.

Parameters

$offset
mixed - $offset The array offset.

Returns

boolean - True if the offset exists, false otherwise.

Since

1.0

Implementation of

ArrayAccess::offsetExists()
public mixed
# offsetGet( mixed $offset )

Gets an offset in the iterator.

Gets an offset in the iterator.

Parameters

$offset
mixed - $offset The array offset.

Returns

mixed - The array value if it exists, null otherwise.

Since

1.0

Implementation of

ArrayAccess::offsetGet()
public
# offsetSet( mixed $offset, mixed $value )

Sets an offset in the iterator.

Sets an offset in the iterator.

Parameters

$offset
mixed - $offset The array offset.
$value
mixed - $value The array value.

Since

1.0

Implementation of

ArrayAccess::offsetSet()
public
# offsetUnset( mixed $offset )

Unsets an offset in the iterator.

Unsets an offset in the iterator.

Parameters

$offset
mixed - $offset The array offset.

Since

1.0

Implementation of

ArrayAccess::offsetUnset()
public mixed
# set( string $path, mixed $value, string $separator = null )

Set a registry value.

Set a registry value.

Parameters

$path
string - $path Registry Path (e.g. joomla.content.showauthor)
$value
mixed - $value Value of entry
$separator
string - $separator The key separator

Returns

mixed - The value of the that has been set.

Since

1.0
public mixed
# append( string $path, mixed $value )

Append value to a path in registry

Append value to a path in registry

Parameters

$path
string - $path Parent registry Path (e.g. joomla.content.showauthor)
$value
mixed - $value Value of entry

Returns

mixed - The value of the that has been set.

Since

1.4.0
public array
# toArray( )

Transforms a namespace to an array

Transforms a namespace to an array

Returns

array - An associative array holding the namespace data

Since

1.0
public object
# toObject( )

Transforms a namespace to an object

Transforms a namespace to an object

Returns

object - An an object holding the namespace data

Since

1.0
public string
# toString( string $format = 'JSON', mixed $options = array() )

Get a namespace in a given string format

Get a namespace in a given string format

Parameters

$format
string - $format Format to return the string in
$options
mixed - $options Parameters used by the formatter, see formatters for more info

Returns

string - Namespace in string format

Since

1.0
protected
# bindData( object $parent, mixed $data, boolean $recursive = true, boolean $allowNull = true )

Method to recursively bind data to a parent object.

Method to recursively bind data to a parent object.

Parameters

$parent
object - $parent The parent object on which to attach the data values.
$data
mixed - $data An array or object of data to bind to the parent object.
$recursive
boolean - $recursive True to support recursive bindData.
$allowNull
boolean - $allowNull True to allow null values.

Since

1.0
protected array
# asArray( object $data )

Method to recursively convert an object of data to an array.

Method to recursively convert an object of data to an array.

Parameters

$data
object - $data An object of data to return as an array.

Returns

array - Array representation of the input object.

Since

1.0
public string[]
# flatten( string $separator = null )

Dump to one dimension array.

Dump to one dimension array.

Parameters

$separator
string - $separator The key separator.

Returns

string[] - Dumped array.

Since

1.3.0
protected
# toFlatten( string $separator = null, array|object $data = null, array & $array = array(), string $prefix = '' )

Method to recursively convert data to one dimension array.

Method to recursively convert data to one dimension array.

Parameters

$separator
string - $separator The key separator.
$data
array|object - $data Data source of this scope.
$array
array - &$array The result array, it is pass by reference.
$prefix
string - $prefix Last level key prefix.

Since

1.3.0

Magic methods summary

Properties summary

protected object $data
#

Registry Object

Registry Object

Since

1.0
protected boolean $initialized
#

Flag if the Registry data object has been initialized

Flag if the Registry data object has been initialized

Since

1.5.2
protected static array $instances
#

Registry instances container.

Registry instances container.

Deprecated

2.0 Object caching will no longer be supported

Since

1.0
public string $separator
#

Path separator

Path separator

Since

1.4.0
Joomla! Framework TM API documentation generated by ApiGen 2.8.0
Joomla!® and Joomla! Framework™ are trademarks of Open Source Matters, Inc. in the United States and other countries.