protected function flatten(array $data): array
    {
        $result = [];
        foreach ($data as $key => $value) {
            $item = [
                'label' => $value['label'],
                'inactive' => $value['inactive']
            ];

            $result[$key] = $item;

            if (isset($value['children'])) {
                $result = array_merge($result, $this->flatten($value['children']));
            }
        }

        return $result;
    }
protected function flatten(array $data): array
    {
        $result = [];
        foreach ($data as $key => $value) {
            $item = [
                'label' => $value['label'],
                'inactive' => $value['inactive']
            ];

            $result[$key] = $item;

            if (isset($value['children'])) {
                $result = array_merge($result, $this->flatten($value['children']));
            }
        }

        return $result;
    }
protected function flatten ( array $ data ) : array { $ result = [ ] ; foreach ( $ data as $ key => $ value ) { $ item = [ 'label' => $ value [ 'label' ] , 'inactive' => $ value [ 'inactive' ] ] ; $ result [ $ key ] = $ item ; if ( isset ( $ value [ 'children' ] ) ) { $ result = array_merge ( $ result , $ this -> flatten ( $ value [ 'children' ] ) ) ; } } return $ result ; }
Flatten list options.

@param mixed[] $data List options
@return mixed[]
Flatten list options .