Compare commits

..

1 Commits
master ... 0.1

Author SHA1 Message Date
R. Eric Wheeler 7f645f3002 added array_pop and non array_* functions 2016-07-22 14:35:40 -07:00
4 changed files with 895 additions and 685 deletions

View File

@ -33,5 +33,10 @@
"Sikofitt\\Tests\\": "tests/Sikofitt/Tests/" "Sikofitt\\Tests\\": "tests/Sikofitt/Tests/"
} }
}, },
"extra":{
"branch-alias": {
"dev-master": "0.1"
}
},
"minimum-stability": "stable" "minimum-stability": "stable"
} }

262
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "e783c69d217d2ee4cd8d84375554030d", "hash": "7a143d2b80a8fbc2a3a2ba8f3a471dcc",
"content-hash": "a03a3e83bc124fad42d5a75c770dc38a", "content-hash": "a5f532508427f4bca1f34f14b1aa4688",
"packages": [ "packages": [
{ {
"name": "ircmaxell/password-compat", "name": "ircmaxell/password-compat",
@ -424,38 +424,87 @@
"time": "2015-03-18 18:23:50" "time": "2015-03-18 18:23:50"
}, },
{ {
"name": "phpdocumentor/reflection-docblock", "name": "phpdocumentor/reflection-common",
"version": "2.0.4", "version": "1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.5"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.0" "phpunit/phpunit": "^4.6"
},
"suggest": {
"dflydev/markdown": "~1.0",
"erusev/parsedown": "~1.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.0.x-dev" "dev-master": "1.0.x-dev"
} }
}, },
"autoload": { "autoload": {
"psr-0": { "psr-4": {
"phpDocumentor": [ "phpDocumentor\\Reflection\\": [
"src"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jaap van Otterdijk",
"email": "opensource@ijaap.nl"
}
],
"description": "Common reflection classes used by phpdocumentor to reflect the code structure",
"homepage": "http://www.phpdoc.org",
"keywords": [
"FQSEN",
"phpDocumentor",
"phpdoc",
"reflection",
"static analysis"
],
"time": "2015-12-27 11:43:31"
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "9270140b940ff02e58ec577c237274e92cd40cdd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd",
"reference": "9270140b940ff02e58ec577c237274e92cd40cdd",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0@dev",
"phpdocumentor/type-resolver": "^0.2.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^4.4"
},
"type": "library",
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/" "src/"
] ]
} }
@ -467,10 +516,58 @@
"authors": [ "authors": [
{ {
"name": "Mike van Riel", "name": "Mike van Riel",
"email": "mike.vanriel@naenius.com" "email": "me@mikevanriel.com"
} }
], ],
"time": "2015-02-03 12:10:50" "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"time": "2016-06-10 09:48:41"
},
{
"name": "phpdocumentor/type-resolver",
"version": "0.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b39c7a5b194f9ed7bd0dd345c751007a41862443",
"reference": "b39c7a5b194f9ed7bd0dd345c751007a41862443",
"shasum": ""
},
"require": {
"php": ">=5.5",
"phpdocumentor/reflection-common": "^1.0"
},
"require-dev": {
"mockery/mockery": "^0.9.4",
"phpunit/phpunit": "^5.2||^4.8.24"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"phpDocumentor\\Reflection\\": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "me@mikevanriel.com"
}
],
"time": "2016-06-10 07:14:17"
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",
@ -1375,21 +1472,21 @@
}, },
{ {
"name": "symfony/config", "name": "symfony/config",
"version": "v2.8.8", "version": "v3.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/config.git", "url": "https://github.com/symfony/config.git",
"reference": "0926e69411eba491803dbafb9f1f233e2ced58d0" "reference": "bcf5aebabc95b56e370e13d78565f74c7d8726dc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/0926e69411eba491803dbafb9f1f233e2ced58d0", "url": "https://api.github.com/repos/symfony/config/zipball/bcf5aebabc95b56e370e13d78565f74c7d8726dc",
"reference": "0926e69411eba491803dbafb9f1f233e2ced58d0", "reference": "bcf5aebabc95b56e370e13d78565f74c7d8726dc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9", "php": ">=5.5.9",
"symfony/filesystem": "~2.3|~3.0.0" "symfony/filesystem": "~2.8|~3.0"
}, },
"suggest": { "suggest": {
"symfony/yaml": "To use the yaml reference dumper" "symfony/yaml": "To use the yaml reference dumper"
@ -1397,7 +1494,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.8-dev" "dev-master": "3.1-dev"
} }
}, },
"autoload": { "autoload": {
@ -1424,30 +1521,30 @@
], ],
"description": "Symfony Config Component", "description": "Symfony Config Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-06-29 05:31:50" "time": "2016-06-29 05:41:56"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v2.8.8", "version": "v3.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "c392a6ec72f2122748032c2ad6870420561ffcfa" "reference": "747154aa69b0f83cd02fc9aa554836dee417631a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/c392a6ec72f2122748032c2ad6870420561ffcfa", "url": "https://api.github.com/repos/symfony/console/zipball/747154aa69b0f83cd02fc9aa554836dee417631a",
"reference": "c392a6ec72f2122748032c2ad6870420561ffcfa", "reference": "747154aa69b0f83cd02fc9aa554836dee417631a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9", "php": ">=5.5.9",
"symfony/polyfill-mbstring": "~1.0" "symfony/polyfill-mbstring": "~1.0"
}, },
"require-dev": { "require-dev": {
"psr/log": "~1.0", "psr/log": "~1.0",
"symfony/event-dispatcher": "~2.1|~3.0.0", "symfony/event-dispatcher": "~2.8|~3.0",
"symfony/process": "~2.1|~3.0.0" "symfony/process": "~2.8|~3.0"
}, },
"suggest": { "suggest": {
"psr/log": "For using the console logger", "psr/log": "For using the console logger",
@ -1457,7 +1554,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.8-dev" "dev-master": "3.1-dev"
} }
}, },
"autoload": { "autoload": {
@ -1484,7 +1581,7 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-06-29 07:02:14" "time": "2016-06-29 07:02:31"
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
@ -1548,25 +1645,25 @@
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v2.8.8", "version": "v3.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "7258ddd6f987053f21fa43d03430580ba54e6096" "reference": "322da5f0910d8aa0b25fa65ffccaba68dbddb890"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/7258ddd6f987053f21fa43d03430580ba54e6096", "url": "https://api.github.com/repos/symfony/filesystem/zipball/322da5f0910d8aa0b25fa65ffccaba68dbddb890",
"reference": "7258ddd6f987053f21fa43d03430580ba54e6096", "reference": "322da5f0910d8aa0b25fa65ffccaba68dbddb890",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9" "php": ">=5.5.9"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.8-dev" "dev-master": "3.1-dev"
} }
}, },
"autoload": { "autoload": {
@ -1593,7 +1690,7 @@
], ],
"description": "Symfony Filesystem Component", "description": "Symfony Filesystem Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-06-29 05:31:50" "time": "2016-06-29 05:41:56"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
@ -1656,25 +1753,25 @@
}, },
{ {
"name": "symfony/stopwatch", "name": "symfony/stopwatch",
"version": "v2.8.8", "version": "v3.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/stopwatch.git", "url": "https://github.com/symfony/stopwatch.git",
"reference": "35bae476693150728b0eb51647faac82faf9aaca" "reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/35bae476693150728b0eb51647faac82faf9aaca", "url": "https://api.github.com/repos/symfony/stopwatch/zipball/bb42806b12c5f89db4ebf64af6741afe6d8457e1",
"reference": "35bae476693150728b0eb51647faac82faf9aaca", "reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9" "php": ">=5.5.9"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.8-dev" "dev-master": "3.1-dev"
} }
}, },
"autoload": { "autoload": {
@ -1701,29 +1798,29 @@
], ],
"description": "Symfony Stopwatch Component", "description": "Symfony Stopwatch Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-06-29 05:29:29" "time": "2016-06-29 05:41:56"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v2.8.8", "version": "v3.1.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "dba4bb5846798cd12f32e2d8f3f35d77045773c8" "reference": "2884c26ce4c1d61aebf423a8b912950fe7c764de"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/dba4bb5846798cd12f32e2d8f3f35d77045773c8", "url": "https://api.github.com/repos/symfony/yaml/zipball/2884c26ce4c1d61aebf423a8b912950fe7c764de",
"reference": "dba4bb5846798cd12f32e2d8f3f35d77045773c8", "reference": "2884c26ce4c1d61aebf423a8b912950fe7c764de",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9" "php": ">=5.5.9"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.8-dev" "dev-master": "3.1-dev"
} }
}, },
"autoload": { "autoload": {
@ -1750,7 +1847,56 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-06-29 05:29:29" "time": "2016-06-29 05:41:56"
},
{
"name": "webmozart/assert",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde",
"reference": "30eed06dd6bc88410a4ff7f77b6d22f3ce13dbde",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
"phpunit/phpunit": "^4.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"Webmozart\\Assert\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Assertions to validate method input/output with nice error messages.",
"keywords": [
"assert",
"check",
"validate"
],
"time": "2015-08-24 13:29:44"
} }
], ],
"aliases": [], "aliases": [],
@ -1759,7 +1905,7 @@
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": ">=5.3.29" "php": ">=5.3"
}, },
"platform-dev": [] "platform-dev": []
} }

View File

@ -19,17 +19,10 @@ namespace Sikofitt\Utility;
* *
* @package Sikofitt\Utility * @package Sikofitt\Utility
*/ */
use Guzzle\Common\Exception\BadMethodCallException;
/**
* Class ArrayObjectArray
*
* @package Sikofitt\Utility
*/
class ArrayObjectArray extends \ArrayObject implements \IteratorAggregate class ArrayObjectArray extends \ArrayObject implements \IteratorAggregate
{ {
/** /**
* @var \ArrayIterator * @var \Iterator
*/ */
private $iterator; private $iterator;
@ -64,11 +57,14 @@ class ArrayObjectArray extends \ArrayObject implements \IteratorAggregate
} }
/** /**
* Alias of current
* *
* @return int
* Current position of the array
*/ */
public function pos() public function pos()
{ {
return pos($this->iterator); return $this->current();
} }
/** /**
@ -167,11 +163,20 @@ class ArrayObjectArray extends \ArrayObject implements \IteratorAggregate
$argv[0], $argv[0],
$this->getArrayCopy() $this->getArrayCopy()
); );
break;
case 'array_map': case 'array_map':
$callback = $argv[0]; $callback = $argv[0];
array_shift($argv); array_shift($argv);
return call_user_func_array('array_map', array_merge(array($callback), array($this->getArrayCopy()), $argv)); return call_user_func_array('array_map', array_merge(array($callback), array($this->getArrayCopy()), $argv));
break;
case 'array_pop':
$arrayCopy = $this->getArrayCopy();
if(null !== $returnValue = array_pop($arrayCopy))
{
$this->exchangeArray($arrayCopy);
}
return $returnValue;
break;
default: default:
return call_user_func_array( return call_user_func_array(
$function, $function,

View File

@ -9,11 +9,11 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Sikofitt\Tests; namespace Sikofitt\Tests;
use Sikofitt\Utility\ArrayObjectArray; use Sikofitt\Utility\ArrayObjectArray;
/** /**
* Class ArrayObjectArrayTest * Class ArrayObjectArrayTest
* *
* @covers \Sikofitt\Utility\ArrayObjectArray * @covers \Sikofitt\Utility\ArrayObjectArray
@ -26,37 +26,82 @@
* array_column Return the values from a single column in the * array_column Return the values from a single column in the
* input array * input array
* array_combine Creates an array by using one array for keys * array_combine Creates an array by using one array for keys
* and another for its values array_count_values Counts all the * and another for its values
* values of an array array_diff_assoc Computes the difference of * array_count_values Counts all the values of an array
* arrays with additional index check array_diff_key Computes * array_diff_assoc Computes the difference of arrays with additional index check
* the difference of arrays using keys for comparison array_diff_uassoc * array_diff_key Computes the difference of arrays using keys for comparison
* Computes the difference of arrays with additional index check which * array_diff_uassoc Computes the difference of arrays with additional index check which
* is performed by a user supplied callback function. array_diff_ukey * is performed by a user supplied callback function.
* Computes the difference of arrays using a callback function * array_diff_ukey Computes the difference of arrays using a callback function
* on the keys for comparison array_diff Computes * on the keys for comparison
* the difference of arrays array_fill_keys Fill an * array_diff Computes the difference of arrays
* array with values, specifying keys array_fill Fill an array with values array_filter Filters elements of an array using a callback function array_flip Exchanges all keys with their associated values in an array array_intersect_assoc Computes the intersection of arrays with additional index check array_intersect_key Computes the intersection of arrays using keys for comparison array_intersect_uassoc Computes the intersection of arrays with additional index check, compares indexes by a callback function array_intersect_ukey Computes the intersection of arrays using a callback function on the keys for comparison array_intersect Computes the intersection of arrays array_key_exists Checks if the given key or index exists in the array array_keys Return all the keys or a subset of the keys of an array array_map Applies the callback to the elements of the given arrays array_merge_recursive Merge two or more arrays recursively array_merge Merge one or more arrays array_multisort Sort multiple or multi-dimensional arrays array_pad Pad array to the specified length with a value array_pop Pop the element off the end of array array_product Calculate the product of values in an array array_push Push one or more elements onto the end of array array_rand Pick one or more random entries out of an array array_reduce Iteratively reduce the array to a single value using a callback function array_replace_recursive Replaces elements from passed arrays into the first array recursively array_replace Replaces elements from passed arrays into the first array array_reverse Return an array with elements in reverse order array_search Searches the array for a given value and returns the corresponding key if successful array_shift Shift an element off the beginning of array array_slice Extract a slice of the array array_splice Remove a portion of the array and replace it with something else array_sum Calculate the sum of values in an array array_udiff_assoc Computes the difference of arrays with additional index check, compares data by a callback function array_udiff_uassoc Computes the difference of arrays with additional index check, compares data and indexes by a callback function array_udiff Computes the difference of arrays by using a callback function for data comparison a rray_uintersect_assoc Computes the intersection of arrays with additional index check, compares data by a callback function array_uintersect_uassoc Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions array_uintersect Computes the intersection of arrays, compares data by a callback function array_unique Removes duplicate values from an array array_unshift Prepend one or more elements to the beginning of an array array_values Return all the values of an array array_walk_recursive Apply a user function recursively to every member of an array array_walk Apply a user supplied function to every member of an array * array_fill_keys Fill an array with values, specifying keys
* array_fill Fill an array with values
* array_filter Filters elements of an array using a callback function
* array_flip Exchanges all keys with their associated values in an array
* array_intersect_assoc Computes the intersection of arrays with additional index check
* array_intersect_key Computes the intersection of arrays using keys for comparison
* array_intersect_uassoc Computes the intersection of arrays with additional index check, compares indexes by a callback function
* array_intersect_ukey Computes the intersection of arrays using a callback function on the keys for comparison
* array_intersect Computes the intersection of arrays
* array_key_exists Checks if the given key or index exists in the array
* array_keys Return all the keys or a subset of the keys of an array
* array_map Applies the callback to the elements of the given arrays
* array_merge_recursive Merge two or more arrays recursively array_merge Merge one or more arrays
* array_multisort Sort multiple or multi-dimensional arrays
* array_pad Pad array to the specified length with a value
* array_pop Pop the element off the end of array
* array_product Calculate the product of values in an array
* array_push Push one or more elements onto the end of array
* array_rand Pick one or more random entries out of an array
* array_reduce Iteratively reduce the array to a single value using a callback function a
* rray_replace_recursive Replaces elements from passed arrays into the first array recursively
* array_replace Replaces elements from passed arrays into the first array
* array_reverse Return an array with elements in reverse order
* array_search Searches the array for a given value and returns the corresponding key if successful
* array_shift Shift an element off the beginning of array
* array_slice Extract a slice of the array
* array_splice Remove a portion of the array and replace it with something else
* array_sum Calculate the sum of values in an array
* array_udiff_assoc Computes the difference of arrays with additional index check, compares data by a callback function
* array_udiff_uassoc Computes the difference of arrays with additional index check, compares data and indexes by a callback function
* array_udiff Computes the difference of arrays by using a callback function for data comparison
* array_uintersect_assoc Computes the intersection of arrays with additional index check, compares data by a callback function
* array_uintersect_uassoc Computes the intersection of arrays with additional index check, compares data and indexes by separate callback functions
* array_uintersect Computes the intersection of arrays, compares data by a callback function
* array_unique Removes duplicate values from an array
* array_unshift Prepend one or more elements to the beginning of an array
* array_values Return all the values of an array
* array_walk_recursive Apply a user function recursively to every member of an array
* array_walk Apply a user supplied function to every member of an array
* *
* Non array_* prefixed functions * Non array_* prefixed functions
* *
* arsort Sort an array in reverse order and maintain * arsort Sort an array in reverse order and maintain
* index association current Return the current element * index association
* in an array * current Return the current element in an array
** each Return the current key and value pair from an array and advance the array cursor * each Return the current key and value pair from an
* end Set the internal pointer of an array to its * array and advance the array cursor
* last element in_array Checks if a value exists in an ** end Set the internal pointer of an array to its
* array key_exists Alias of array_key_exists key * last element
* Fetch a key from an array krsort Sort an * in_array Checks if a value exists in an array
* array by key in reverse order next Advance * key_exists Alias of array_key_exists
* the internal array pointer of an array pos * key Fetch a key from an array
* Alias of current prev Rewind the * krsort Sort an array by key in reverse order
* internal array pointer reset Set the * next Advance the internal array pointer of an array
* internal pointer of an array to its first element rsort * pos Alias of current
* Sort an array in reverse order shuffle * prev Rewind the internal array pointer
* Shuffle an array sizeof Alias of count sort Sort an array usort Sort an array by values using a user-defined comparison function * reset Set the internal pointer of an array to its
* first element
* rsort Sort an array in reverse order
* shuffle Shuffle an array
* sizeof Alias of count
* sort Sort an array
* usort Sort an array by values using a user-defined
* comparison function
*/ */
class ArrayObjectArrayTest extends \PHPUnit_Framework_TestCase class ArrayObjectArrayTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* @var ArrayObjectArray * @var ArrayObjectArray
* default ArrayObjectArray class to work with * default ArrayObjectArray class to work with
@ -308,8 +353,17 @@
// array_pad // array_pad
$this->assertSame(array_pad($this->workingArray, 6, 'hello'), $this->arrayObjectArray->array_pad(6, 'hello')); $this->assertSame(array_pad($this->workingArray, 6, 'hello'), $this->arrayObjectArray->array_pad(6, 'hello'));
// array_pop // array_pop
$data = $this->arrayObjectArrayData();
$arrayObjectArray = new ArrayObjectArray($data['alpha']);
$alpha = $data['alpha'];
$this->assertSame($alpha, $arrayObjectArray->getArrayCopy());
$this->assertSame(array_pop($alpha), $arrayObjectArray->array_pop());
$this->assertSame($alpha, $arrayObjectArray->getArrayCopy());
// array_product // array_product
// array_push // array_push
// array_rand // array_rand
// array_reduce // array_reduce
@ -632,4 +686,4 @@
{ {
$this->arrayObjectArray->error(); $this->arrayObjectArray->error();
} }
} }