array-object-array/src/Sikofitt/Utility/ArrayObjectArray.php

42 lines
916 B
PHP
Raw Normal View History

2016-07-19 14:54:35 -07:00
<?php
/*
* This file is part of ArrayObjectArray.
*
* (copyleft) R. Eric Wheeler <sikofitt@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sikofitt\Utility;
/**
* Class ArrayObjectArray
*
* Adds array functions to the ArrayObject class.
* https://secure.php.net/manual/en/class.arrayobject.php#107079
*
* @package Sikofitt\Utility
*/
class ArrayObjectArray extends \ArrayObject
{
/**
* @param $function
* @param $argv
*
* @return mixed
*/
public function __call($function, $argv)
{
if (!is_callable($function) || substr($function, 0, 6) !== 'array_') {
throw new \BadMethodCallException(__CLASS__ . '->' . $function);
}
return call_user_func_array(
$function,
array_merge(array($this->getArrayCopy()), $argv)
);
}
}