Sort the array by the provided user function.

@param callable $callback The callback function to use.

@param string   $path     The sub path to be sorted.

@return void
5602
public function uasort($callback, $path = '/')
    {
        $value = $this->get($path);
        if (null === $value || !is_array($value)) {
            return;
        }

        uasort($value, $callback);

        $this->set($path, $value);
    }
826233
public function findIndex(callable $callback)
    {
        $array = $this->getArrayCopy();
        foreach ($array as $key => $value) {
            if ($callback($value, $key, $array) === true) {
                return $key;
            }
        }

        return -1;
    }
468022
public function put(String $path, Callable $callback) : Route {

		return $this->collectRoute('PUT', $path, $callback);

	}
98525
public function sort(callable $callback = null)
    {
        $items = $this->items;

        $callback = $callback ?: function ($a, $b) {
            return $a == $b ? 0 : (($a < $b) ? -1 : 1);

        };

        uasort($items, $callback);

        return new static($items);
    }
881161
public static function filterRecursive($array, callable $callback): array
    {
        foreach ($array as &$value) {
            if (is_array($value)) {
                $value = static::filterRecursive($value, $callback);
            }
        }

        return array_filter($array, $callback);
    }
418397
public function all($path, $callback)
    {
        Argument::i()
            //argument 1 should be a string
            ->test(1, 'string')
            //argument 2 should be callable
            ->test(2, 'callable');
        
        return $this->route('all', $path, $callback);
    }
301751
public function post(string $path, callable $callback, int $priority = 0)
    {
        return $this->route('post', $path, $callback, $priority);
    }
76186
public function sortByCallable(callable $sortFunc)
    {
        $this->prepare();

        if (!is_array($this->_map)) {
            return $this;
        }

        usort($this->_map, $sortFunc);

        return $this;
    }
24520
public static function delete($path, $callback)
    {
        self::instance()->addRoute('DELETE', $path, self::callback($callback));
    }
758323
public function apply(callable $callback)
    {
        foreach ($this->pairs as &$pair) {
            $pair->value = $callback($pair->key, $pair->value);
        }
    }
36330
public static function options($path, $callback)
    {
        self::instance()->addRoute('OPTIONS', $path, self::callback($callback));
    }
1202884
public function sort($callback = null)
    {
        if (is_callable($callback)) {
            usort($this->attributes, $callback);
        } else {
            sort($this->attributes);
        }

        return $this;
    }
486458
public function put($path, $callback)
    {
        Argument::i()
            //argument 1 should be a string
            ->test(1, 'string')
            //argument 2 should be callable
            ->test(2, 'callable');
        
        return $this->route('put', $path, $callback);
    }
308409
private function _sortBy(string $field, callable $callback = null) : array
    {
        $values = $this->getValues();
        if (!$callback){
            $callback = 'strnatcmp';
        }
        usort($values, function($a, $b) use($callback, $field){
            if (is_array($a) && is_array($b) && isset($a[$field]) && isset($b[$field])){
                return $callback($a[$field], $b[$field]);
            }
            if (is_object($a) && is_object($b) && property_exists($a, $field) && property_exists($b, $field)){
                return $callback($a->$field, $b->$field);
            }
            return 0;
        });
        return $values;
    }
633377
public function remove(callable $callback)
    {
        foreach (array_keys($this->storage) as $priority) {
            $indexes = array_keys($this->storage[$priority], $callback, true);
            foreach ($indexes as $index) {
                unset($this->storage[$priority][$index]);
                if (empty($this->storage[$priority])) {
                    unset($this->storage[$priority]);
                }
            }
        }
    }
91793
public function group($data, $callback = null)
    {
        if (is_callable($data)) {
            $callback = $data;
            $data = null;
        }

        if ($data) {
            $this->prefix[] = $data;
        }

        call_user_func($callback, $this);

        if ($data) {
            array_pop($this->prefix);
        }
    }
364126
public function each( callable $callback, $count = 1000 )
	{
		if ( is_null( $this->query->orders ) && is_null( $this->query->unionOrders ) )
		{
			$this->orderBy( $this->model->getQualifiedKeyName(), 'asc' );
		}

		return $this->chunk( $count, function ( $results ) use ( $callback )
		{
			foreach ( $results as $key => $value )
			{
				if ( $callback( $value, $key ) === false )
				{
					return false;
				}
			}
		} );
	}