From 95c15758b50144105064d2613d1e9a9da23d4e7c Mon Sep 17 00:00:00 2001 From: horus_arch Date: Mon, 20 Feb 2017 12:42:43 +0100 Subject: Committed vendor/ for lazyness. --- .../pda/pheanstalk/src/Response/ArrayResponse.php | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Response/ArrayResponse.php (limited to 'intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Response/ArrayResponse.php') diff --git a/intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Response/ArrayResponse.php b/intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Response/ArrayResponse.php new file mode 100644 index 0000000..23c03ed --- /dev/null +++ b/intern.gospeladlershof.de/vendor/pda/pheanstalk/src/Response/ArrayResponse.php @@ -0,0 +1,69 @@ +value data + * + * @author Paul Annesley + * @package Pheanstalk + * @license http://www.opensource.org/licenses/mit-license.php + */ +class ArrayResponse + extends \ArrayObject + implements Response +{ + private $_name; + + /** + * @param string $name + * @param array $data + */ + public function __construct($name, $data) + { + $this->_name = $name; + parent::__construct($data); + } + + /* (non-phpdoc) + * @see Response::getResponseName() + */ + public function getResponseName() + { + return $this->_name; + } + + /** + * Object property access to ArrayObject data. + */ + public function __get($property) + { + $key = $this->_transformPropertyName($property); + + return isset($this[$key]) ? $this[$key] : null; + } + + /** + * Object property access to ArrayObject data. + */ + public function __isset($property) + { + $key = $this->_transformPropertyName($property); + + return isset($this[$key]); + } + + // ---------------------------------------- + + /** + * Tranform underscored property name to hyphenated array key. + * @param string + * @return string + */ + private function _transformPropertyName($propertyName) + { + return str_replace('_', '-', $propertyName); + } +} -- cgit v1.2.3