protected function normalize(array $data, string $prefix = null): array
    {
        if ($prefix) {
            $prefix .= '.';
        }

        $result = [];
        foreach ($data as $item) {
            $value = [
                'label' => (string)$item['label'],
                'inactive' => (bool)$item['inactive']
            ];

            if (! empty($item['children'])) {
                $value['children'] = $this->normalize($item['children'], $prefix . $item['value']);
            }
            $result[$prefix . $item['value']] = $value;
        }

        return $result;
    }
protected function normalize(array $data, string $prefix = null): array
    {
        if ($prefix) {
            $prefix .= '.';
        }

        $result = [];
        foreach ($data as $item) {
            $value = [
                'label' => (string)$item['label'],
                'inactive' => (bool)$item['inactive']
            ];

            if (! empty($item['children'])) {
                $value['children'] = $this->normalize($item['children'], $prefix . $item['value']);
            }
            $result[$prefix . $item['value']] = $value;
        }

        return $result;
    }
protected function normalize ( array $ data , string $ prefix = null ) : array { if ( $ prefix ) { $ prefix .= '.' ; } $ result = [ ] ; foreach ( $ data as $ item ) { $ value = [ 'label' => ( string ) $ item [ 'label' ] , 'inactive' => ( bool ) $ item [ 'inactive' ] ] ; if ( ! empty ( $ item [ 'children' ] ) ) { $ value [ 'children' ] = $ this -> normalize ( $ item [ 'children' ] , $ prefix . $ item [ 'value' ] ) ; } $ result [ $ prefix . $ item [ 'value' ] ] = $ value ; } return $ result ; }
Method that restructures list options csv data for better handling.

@param mixed[] $data csv data
@param string|null $prefix nested option prefix
@return mixed[]
Method that restructures list options csv data for better handling .