public function keys(bool $recursive = false, $search_value = null, bool $strict = true): self
    {

        // recursive

        if ($recursive === true) {
            if ($search_value === null) {
                $array = $this->array_keys_recursive($this->getArray());
            } else {
                $array = $this->array_keys_recursive($this->getArray(), $search_value, $strict);
            }

            return static::create(
                $array,
                $this->iteratorClass,
                false
            );
        }

        // non recursive

        if ($search_value === null) {
            $arrayFunction = function () {
                foreach ($this->getGenerator() as $key => $value) {
                    yield $key;
                }
            };
        } else {
            $arrayFunction = function () use ($search_value, $strict) {
                foreach ($this->getGenerator() as $key => $value) {
                    if ($strict) {
                        if ($search_value === $value) {
                            yield $key;
                        }
                    } else {
                        /** @noinspection NestedPositiveIfStatementsInspection */
                        if ($search_value == $value) {
                            yield $key;
                        }
                    }
                }
            };
        }

        return static::create(
            $arrayFunction,
            $this->iteratorClass,
            false
        );
    }
public function keys(bool $recursive = false, $search_value = null, bool $strict = true): self
    {

        // recursive

        if ($recursive === true) {
            if ($search_value === null) {
                $array = $this->array_keys_recursive($this->getArray());
            } else {
                $array = $this->array_keys_recursive($this->getArray(), $search_value, $strict);
            }

            return static::create(
                $array,
                $this->iteratorClass,
                false
            );
        }

        // non recursive

        if ($search_value === null) {
            $arrayFunction = function () {
                foreach ($this->getGenerator() as $key => $value) {
                    yield $key;
                }
            };
        } else {
            $arrayFunction = function () use ($search_value, $strict) {
                foreach ($this->getGenerator() as $key => $value) {
                    if ($strict) {
                        if ($search_value === $value) {
                            yield $key;
                        }
                    } else {
                        /** @noinspection NestedPositiveIfStatementsInspection */
                        if ($search_value == $value) {
                            yield $key;
                        }
                    }
                }
            };
        }

        return static::create(
            $arrayFunction,
            $this->iteratorClass,
            false
        );
    }
public function keys ( bool $ recursive = false , $ search_value = null , bool $ strict = true ) : self { // recursive if ( $ recursive === true ) { if ( $ search_value === null ) { $ array = $ this -> array_keys_recursive ( $ this -> getArray ( ) ) ; } else { $ array = $ this -> array_keys_recursive ( $ this -> getArray ( ) , $ search_value , $ strict ) ; } return static :: create ( $ array , $ this -> iteratorClass , false ) ; } // non recursive if ( $ search_value === null ) { $ arrayFunction = function ( ) { foreach ( $ this -> getGenerator ( ) as $ key => $ value ) { yield $ key ; } } ; } else { $ arrayFunction = function ( ) use ( $ search_value , $ strict ) { foreach ( $ this -> getGenerator ( ) as $ key => $ value ) { if ( $ strict ) { if ( $ search_value === $ value ) { yield $ key ; } } else { /** @noinspection NestedPositiveIfStatementsInspection */ if ( $ search_value == $ value ) { yield $ key ; } } } } ; } return static :: create ( $ arrayFunction , $ this -> iteratorClass , false ) ; }
Get all keys from the current array.

@param bool  $recursive    [optional] <p>
Get all keys, also from all sub-arrays from an multi-dimensional array.
</p>
@param mixed $search_value [optional] <p>
If specified, then only keys containing these values are returned.
</p>
@param bool  $strict       [optional] <p>
Determines if strict comparison (===) should be used during the search.
</p>

@return static
<p>(Immutable) An array of all the keys in input.</p>
Get all keys from the current array .