Add signature for `binarySearch()`, `binarySearchBy()`, `chunked()`.
This commit is contained in:
parent
9dace534af
commit
d39b273251
|
@ -101,12 +101,24 @@ ZEND_BEGIN_ARG_INFO(copy_of_range_arginfo, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, num_elements, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, num_elements, IS_LONG, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO(fill_arginfo, 0)
|
ZEND_BEGIN_ARG_INFO(element_from_to_arginfo, 0)
|
||||||
ZEND_ARG_INFO(0, element)
|
ZEND_ARG_INFO(0, element)
|
||||||
ZEND_ARG_TYPE_INFO(0, from_index, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, from_index, IS_LONG, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, num_elements, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, num_elements, IS_LONG, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO(binary_search_by_arginfo, 0)
|
||||||
|
ZEND_ARG_INFO(0, element)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, from_index, IS_LONG, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, num_elements, IS_LONG, 0)
|
||||||
|
ZEND_ARG_CALLABLE_INFO(0, selector, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
|
ZEND_BEGIN_ARG_INFO(chuncked_arginfo, 0)
|
||||||
|
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
|
||||||
|
ZEND_ARG_CALLABLE_INFO(0, transform, 0)
|
||||||
|
ZEND_END_ARG_INFO()
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO(get_arginfo, 0)
|
ZEND_BEGIN_ARG_INFO(get_arginfo, 0)
|
||||||
ZEND_ARG_INFO(0, key)
|
ZEND_ARG_INFO(0, key)
|
||||||
ZEND_ARG_INFO(0, default)
|
ZEND_ARG_INFO(0, default)
|
||||||
|
@ -126,6 +138,9 @@ const zend_function_entry collection_methods[] = {
|
||||||
PHP_ME(Collection, associateBy, associate_by_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, associateBy, associate_by_arginfo, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Collection, associateByTo, associate_by_to_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, associateByTo, associate_by_to_arginfo, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Collection, average, NULL, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, average, NULL, ZEND_ACC_PUBLIC)
|
||||||
|
PHP_ME(Collection, binarySearch, element_from_to_arginfo, ZEND_ACC_PUBLIC)
|
||||||
|
PHP_ME(Collection, binarySearchBy, binary_search_by_arginfo, ZEND_ACC_PUBLIC)
|
||||||
|
PHP_ME(Collection, chunked, chuncked_arginfo, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Collection, containsAll, other_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, containsAll, other_arginfo, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Collection, containsAllKeys, other_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, containsAllKeys, other_arginfo, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Collection, containsAllValues, other_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, containsAllValues, other_arginfo, ZEND_ACC_PUBLIC)
|
||||||
|
@ -140,7 +155,7 @@ const zend_function_entry collection_methods[] = {
|
||||||
PHP_ME(Collection, dropLast, n_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, dropLast, n_arginfo, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Collection, dropLastWhile, predicate_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, dropLastWhile, predicate_arginfo, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Collection, dropWhile, predicate_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, dropWhile, predicate_arginfo, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Collection, fill, fill_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, fill, element_from_to_arginfo, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Collection, filter, predicate_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, filter, predicate_arginfo, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Collection, filterNot, predicate_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, filterNot, predicate_arginfo, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Collection, filterNotTo, destination_predicate_arginfo, ZEND_ACC_PUBLIC)
|
PHP_ME(Collection, filterNotTo, destination_predicate_arginfo, ZEND_ACC_PUBLIC)
|
||||||
|
|
|
@ -877,6 +877,21 @@ PHP_METHOD(Collection, average)
|
||||||
RETVAL_DOUBLE(sum / zend_hash_num_elements(current));
|
RETVAL_DOUBLE(sum / zend_hash_num_elements(current));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PHP_METHOD(Collection, binarySearch)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PHP_METHOD(Collection, binarySearchBy)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PHP_METHOD(Collection, chunked)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
PHP_METHOD(Collection, containsAll)
|
PHP_METHOD(Collection, containsAll)
|
||||||
{
|
{
|
||||||
zval* elements;
|
zval* elements;
|
||||||
|
|
|
@ -18,6 +18,9 @@ PHP_METHOD(Collection, associateTo);
|
||||||
PHP_METHOD(Collection, associateBy);
|
PHP_METHOD(Collection, associateBy);
|
||||||
PHP_METHOD(Collection, associateByTo);
|
PHP_METHOD(Collection, associateByTo);
|
||||||
PHP_METHOD(Collection, average);
|
PHP_METHOD(Collection, average);
|
||||||
|
PHP_METHOD(Collection, binarySearch);
|
||||||
|
PHP_METHOD(Collection, binarySearchBy);
|
||||||
|
PHP_METHOD(Collection, chunked);
|
||||||
PHP_METHOD(Collection, containsAll);
|
PHP_METHOD(Collection, containsAll);
|
||||||
PHP_METHOD(Collection, containsAllKeys);
|
PHP_METHOD(Collection, containsAllKeys);
|
||||||
PHP_METHOD(Collection, containsAllValues);
|
PHP_METHOD(Collection, containsAllValues);
|
||||||
|
|
|
@ -92,6 +92,44 @@ class Collection implements ArrayAccess, Countable
|
||||||
*/
|
*/
|
||||||
function average() {}
|
function average() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches the array or the range of the array for the provided element using the
|
||||||
|
* binary search algorithm.
|
||||||
|
*
|
||||||
|
* The array is expected to be packed and sorted, otherwise the result is undefined.
|
||||||
|
*
|
||||||
|
* @param mixed $element
|
||||||
|
* @param int $from_index[optional]
|
||||||
|
* @param int $num_elements[optional]
|
||||||
|
* @return int|null
|
||||||
|
*/
|
||||||
|
function binarySearch($element, $from_index, $num_elements) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches the array or the range of the array for the provided element using the
|
||||||
|
* binary search algorithm, where the element equals to the one returned by the
|
||||||
|
* corresponding selector function.
|
||||||
|
*
|
||||||
|
* The array is expected to be packed and sorted, otherwise the result is undefined.
|
||||||
|
*
|
||||||
|
* @param mixed $element
|
||||||
|
* @param int $from_index[optional]
|
||||||
|
* @param int $num_elements[optional]
|
||||||
|
* @param callable $selector ($value, $key) -> $new_value
|
||||||
|
* @return int|null
|
||||||
|
*/
|
||||||
|
function binarySearchBy($element, $from_index, $num_elements, $selector) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Splits this collection into a collection of arrays each not exceeding the given size.
|
||||||
|
*
|
||||||
|
* If the transform function is provided, apply it on each array.
|
||||||
|
*
|
||||||
|
* @param int $size
|
||||||
|
* @param callable $transform[optional] ($value, $key) -> $new_value
|
||||||
|
*/
|
||||||
|
function chunked($size, $transform) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if all key-value pairs in the specified collection are contained in this collection.
|
* Checks if all key-value pairs in the specified collection are contained in this collection.
|
||||||
*
|
*
|
||||||
|
|
Reference in New Issue