protected function filter(array $data): array
    {
        $result = [];
        foreach ($data as $key => $value) {
            if ($value['inactive']) {
                continue;
            }

            $result[$key] = $value;
            if (isset($value['children'])) {
                $result[$key]['children'] = $this->filter($value['children']);
            }
        }

        return $result;
    }
protected function filter(array $data): array
    {
        $result = [];
        foreach ($data as $key => $value) {
            if ($value['inactive']) {
                continue;
            }

            $result[$key] = $value;
            if (isset($value['children'])) {
                $result[$key]['children'] = $this->filter($value['children']);
            }
        }

        return $result;
    }
protected function filter ( array $ data ) : array { $ result = [ ] ; foreach ( $ data as $ key => $ value ) { if ( $ value [ 'inactive' ] ) { continue ; } $ result [ $ key ] = $ value ; if ( isset ( $ value [ 'children' ] ) ) { $ result [ $ key ] [ 'children' ] = $ this -> filter ( $ value [ 'children' ] ) ; } } return $ result ; }
Method that filters list options, excluding non-active ones

@param  mixed[]  $data list options
@return mixed[]
Method that filters list options excluding non - active ones