From 79119b28ed22ffc66a74b381e500ee048c5e49b0 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Wed, 14 Oct 2015 13:04:23 -0400 Subject: [PATCH] Update to Registry 1.5 package --- composer.lock | 10 +- libraries/vendor/composer/installed.json | 112 +++++++++--------- .../registry/src/AbstractRegistryFormat.php | 56 ++------- .../vendor/joomla/registry/src/Factory.php | 74 ++++++++++++ .../vendor/joomla/registry/src/Format/Ini.php | 10 +- .../joomla/registry/src/FormatInterface.php | 41 +++++++ .../vendor/joomla/registry/src/Registry.php | 6 +- 7 files changed, 195 insertions(+), 114 deletions(-) create mode 100644 libraries/vendor/joomla/registry/src/Factory.php create mode 100644 libraries/vendor/joomla/registry/src/FormatInterface.php diff --git a/composer.lock b/composer.lock index 839fb3d6956ad..5ee2228f2d645 100644 --- a/composer.lock +++ b/composer.lock @@ -329,16 +329,16 @@ }, { "name": "joomla/registry", - "version": "1.4.5", + "version": "1.5.0", "source": { "type": "git", "url": "https://github.com/joomla-framework/registry.git", - "reference": "4f926ba961ca45eb95076a1598c3ae689cb02fc5" + "reference": "db55cf426bd27524557affbe95b18d6a2f959657" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/registry/zipball/4f926ba961ca45eb95076a1598c3ae689cb02fc5", - "reference": "4f926ba961ca45eb95076a1598c3ae689cb02fc5", + "url": "https://api.github.com/repos/joomla-framework/registry/zipball/db55cf426bd27524557affbe95b18d6a2f959657", + "reference": "db55cf426bd27524557affbe95b18d6a2f959657", "shasum": "" }, "require": { @@ -379,7 +379,7 @@ "joomla", "registry" ], - "time": "2015-03-28 17:54:38" + "time": "2015-10-14 17:01:46" }, { "name": "joomla/session", diff --git a/libraries/vendor/composer/installed.json b/libraries/vendor/composer/installed.json index 46671a5f78607..40499234cf7a9 100644 --- a/libraries/vendor/composer/installed.json +++ b/libraries/vendor/composer/installed.json @@ -319,62 +319,6 @@ "utilities" ] }, - { - "name": "joomla/registry", - "version": "1.4.5", - "version_normalized": "1.4.5.0", - "source": { - "type": "git", - "url": "https://github.com/joomla-framework/registry.git", - "reference": "4f926ba961ca45eb95076a1598c3ae689cb02fc5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/joomla-framework/registry/zipball/4f926ba961ca45eb95076a1598c3ae689cb02fc5", - "reference": "4f926ba961ca45eb95076a1598c3ae689cb02fc5", - "shasum": "" - }, - "require": { - "joomla/compat": "~1.0", - "joomla/string": "~1.3", - "joomla/utilities": "~1.0", - "php": ">=5.3.10" - }, - "require-dev": { - "joomla/test": "~1.0", - "phpunit/phpunit": "4.*", - "squizlabs/php_codesniffer": "1.*", - "symfony/yaml": "~2.0" - }, - "suggest": { - "symfony/yaml": "Install 2.* if you require YAML support." - }, - "time": "2015-03-28 17:54:38", - "type": "joomla-package", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Joomla\\Registry\\": "src/", - "Joomla\\Registry\\Tests\\": "Tests/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "description": "Joomla Registry Package", - "homepage": "https://github.com/joomla-framework/registry", - "keywords": [ - "framework", - "joomla", - "registry" - ] - }, { "name": "joomla/event", "version": "1.1.1", @@ -766,5 +710,61 @@ "framework", "joomla" ] + }, + { + "name": "joomla/registry", + "version": "1.5.0", + "version_normalized": "1.5.0.0", + "source": { + "type": "git", + "url": "https://github.com/joomla-framework/registry.git", + "reference": "db55cf426bd27524557affbe95b18d6a2f959657" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/joomla-framework/registry/zipball/db55cf426bd27524557affbe95b18d6a2f959657", + "reference": "db55cf426bd27524557affbe95b18d6a2f959657", + "shasum": "" + }, + "require": { + "joomla/compat": "~1.0", + "joomla/string": "~1.3", + "joomla/utilities": "~1.0", + "php": ">=5.3.10" + }, + "require-dev": { + "joomla/test": "~1.0", + "phpunit/phpunit": "4.*", + "squizlabs/php_codesniffer": "1.*", + "symfony/yaml": "~2.0" + }, + "suggest": { + "symfony/yaml": "Install 2.* if you require YAML support." + }, + "time": "2015-10-14 17:01:46", + "type": "joomla-package", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Joomla\\Registry\\": "src/", + "Joomla\\Registry\\Tests\\": "Tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "description": "Joomla Registry Package", + "homepage": "https://github.com/joomla-framework/registry", + "keywords": [ + "framework", + "joomla", + "registry" + ] } ] diff --git a/libraries/vendor/joomla/registry/src/AbstractRegistryFormat.php b/libraries/vendor/joomla/registry/src/AbstractRegistryFormat.php index 7840f0fa289c9..6a490275ca594 100644 --- a/libraries/vendor/joomla/registry/src/AbstractRegistryFormat.php +++ b/libraries/vendor/joomla/registry/src/AbstractRegistryFormat.php @@ -11,13 +11,15 @@ /** * Abstract Format for Registry * - * @since 1.0 + * @since 1.0 + * @deprecated 2.0 Format objects should directly implement the FormatInterface */ -abstract class AbstractRegistryFormat +abstract class AbstractRegistryFormat implements FormatInterface { /** - * @var array Format instances container. + * @var AbstractRegistryFormat[] Format instances container. * @since 1.0 + * @deprecated 2.0 Object caching will no longer be supported */ protected static $instances = array(); @@ -25,55 +27,17 @@ abstract class AbstractRegistryFormat * Returns a reference to a Format object, only creating it * if it doesn't already exist. * - * @param string $type The format to load + * @param string $type The format to load + * @param array $options Additional options to configure the object * * @return AbstractRegistryFormat Registry format handler * + * @deprecated 2.0 Use Factory::getFormat() instead * @since 1.0 * @throws \InvalidArgumentException */ - public static function getInstance($type) + public static function getInstance($type, array $options = array()) { - // Sanitize format type. - $type = strtolower(preg_replace('/[^A-Z0-9_]/i', '', $type)); - - // Only instantiate the object if it doesn't already exist. - if (!isset(self::$instances[$type])) - { - $class = '\\Joomla\\Registry\\Format\\' . ucfirst($type); - - if (!class_exists($class)) - { - throw new \InvalidArgumentException('Unable to load format class.', 500); - } - - self::$instances[$type] = new $class; - } - - return self::$instances[$type]; + return Factory::getFormat($type, $options); } - - /** - * Converts an object into a formatted string. - * - * @param object $object Data Source Object. - * @param array $options An array of options for the formatter. - * - * @return string Formatted string. - * - * @since 1.0 - */ - abstract public function objectToString($object, $options = null); - - /** - * Converts a formatted string into an object. - * - * @param string $data Formatted string - * @param array $options An array of options for the formatter. - * - * @return object Data Object - * - * @since 1.0 - */ - abstract public function stringToObject($data, array $options = array()); } diff --git a/libraries/vendor/joomla/registry/src/Factory.php b/libraries/vendor/joomla/registry/src/Factory.php new file mode 100644 index 0000000000000..4b20b51364778 --- /dev/null +++ b/libraries/vendor/joomla/registry/src/Factory.php @@ -0,0 +1,74 @@ + $item) { $array_key = ($assoc) ? $array_key : ''; - $local[] = $k . '[' . $array_key . ']=' . $this->getValueAsINI($item); + $local[] = $k . '[' . $array_key . ']=' . $this->getValueAsIni($item); } } else { - $local[] = $k . '=' . $this->getValueAsINI($v); + $local[] = $k . '=' . $this->getValueAsIni($v); } } @@ -113,13 +113,13 @@ public function objectToString($object, $options = array()) foreach ($value as $array_key => $item) { $array_key = ($assoc) ? $array_key : ''; - $global[] = $key . '[' . $array_key . ']=' . $this->getValueAsINI($item); + $global[] = $key . '[' . $array_key . ']=' . $this->getValueAsIni($item); } } else { // Not in a section so add the property to the global array. - $global[] = $key . '=' . $this->getValueAsINI($value); + $global[] = $key . '=' . $this->getValueAsIni($value); $in_section = false; } } @@ -338,7 +338,7 @@ public function stringToObject($data, array $options = array()) * * @since 1.0 */ - protected function getValueAsINI($value) + protected function getValueAsIni($value) { $string = ''; diff --git a/libraries/vendor/joomla/registry/src/FormatInterface.php b/libraries/vendor/joomla/registry/src/FormatInterface.php new file mode 100644 index 0000000000000..da6b0ae1b085c --- /dev/null +++ b/libraries/vendor/joomla/registry/src/FormatInterface.php @@ -0,0 +1,41 @@ +stringToObject($data, $options); $this->loadObject($obj); @@ -644,7 +646,7 @@ public function toObject() public function toString($format = 'JSON', $options = array()) { // Return a namespace in a given format - $handler = AbstractRegistryFormat::getInstance($format); + $handler = AbstractRegistryFormat::getInstance($format, $options); return $handler->objectToString($this->data, $options); }