flattens the given detail to be used within a message

@param   mixed   $detail
@return  string
340299
private function flattenDetail($detail): string
    {
        if (is_array($detail)) {
            return join(', ', $detail);
        } elseif (is_object($detail) && !method_exists($detail, '__toString')) {
            return get_class($detail);
        }

        return (string) $detail;
    }
729287
public function getFormattedSize(
        int $precision = 0,
        string $point = ".",
        string $sep = ","
    ): string
    {
        return \sndsgd\Fs::formatSize($this->size, $precision, $point, $sep);
    }
853004
private function getUrlDestinationDetailsHtml(&$details) {
    $html = '<h4>Url Destination Goal</h4>';
    $html .= <<<HTML
<pre>
Goal URL            = {$details->getUrl()}
Case Sensitive      = {$details->getCaseSensitive()}
Match Type          = {$details->getMatchType()}
First Step Required = {$details->getFirstStepRequired()}
</pre>
HTML;

  $html .= '<h4>Destination Goal Steps</h4>';
  $steps = $details->getSteps();
  if (count($steps) == 0) {
    $html .= '<p>No Steps Configured</p>';

  } else {
    foreach ($steps as &$step) {
      $html .= <<<HTML
<pre>
Step Number = {$step->getNumber()}
Step Name   = {$step->getName()}
Step URL    = {$step->getUrl()}
</pre>
HTML;
    }
  }

  return $html;
  }
135276
private function flattenStructure($subject, &$result = [], $prefix = '', $delimiter = '.')
    {
        foreach ($subject as $key => $value) {
            if (is_array($value) || is_object($value)) {
                $this->flattenStructure($value, $result, $prefix ? $prefix.$delimiter.$key : $key);
            } else {
                if ($prefix) {
                    $key = $prefix.$delimiter.$key;
                }
                // Do not nullify existing key/value pairs if already present.
                if (empty($value) && false !== $value && !isset($result[$key])) {
                    $result[$key] = null;
                } else {
                    // Handle repeated arrays without unique keys.
                    $originalKey = $key;
                    $count       = 0;
                    while (isset($result[$key])) {
                        $key = $originalKey.$delimiter.$count;
                        ++$count;
                    }
                    $result[$key] = $value;
                }
            }
        }

        return $result;
    }
203811
private function getEventDetailsHtml(&$details) {
    $html = '<h4>Event Goal</h4><pre>' .
            'Use Event Value = ' . $details->getUseEventValue();

    // Get all the event goal conditions.
    $conditions = $details->getEventConditions();

    // String condition types.
    $stringTypes = array('CATEGORY', 'ACTION', 'LABEL');

    foreach ($conditions as &$condition) {
      $html .= "Event Type = $condition->getEventType()";

      $eventType = $condition->getType();
      if (in_array($eventType, $stringTypes)) {
        // Process CATEGORY, ACTION, LABEL.
        $html .= "Match Type = $condition->getMatchType()" .
                 "Expression = $condition->getExpression()";
      } else {
        // Process VALUE.
        $html .= "Comparison Type  = $condition->getComparisonType()" .
                 "Comparison Value = $condition->getComparisonValue()";
      }
    }

    return $html . '</pre>';
  }
230858
protected function getFieldValue($details)
    {
        $this->initializeSprGlbAndSession();
        $rqCN = $this->tCmnRequest->request->get($details['COLUMN_NAME']);
        if (!is_null($rqCN)) {
            if (($details['IS_NULLABLE'] == 'YES') && ($rqCN == '')) {
                return 'NULL';
            }
            return $rqCN;
        }
        return $this->getFieldValueWithoutUserInput($details);
    }
237855
protected function prepareDataPayPalAddress($details)
    {
        $addressData = array();

        $fullName = oxNew(\OxidEsales\PayPalModule\Core\FullName::class, $details->getShipToName());

        $addressData['oxfname'] = $fullName->getFirstName();
        $addressData['oxlname'] = $fullName->getLastName();

        $street = $this->splitShipToStreetPayPalAddress($details->getShipToStreet());
        $addressData['oxstreet'] = $street['street'];
        $addressData['oxstreetnr'] = $street['streetnr'];

        $addressData['oxcity'] = $details->getShipToCity();

        $country = oxNew(\OxidEsales\Eshop\Application\Model\Country::class);
        $countryId = $country->getIdByCode($details->getShipToCountryCode());
        $addressData['oxcountryid'] = $countryId;

        if ($details->getShipToState()) {
            $state = oxNew(\OxidEsales\Eshop\Application\Model\State::class);
            $stateId = $state->getIdByCode($details->getShipToState(), $countryId);
        }
        $addressData['oxstateid'] = $stateId;

        $addressData['oxzip'] = $details->getShipToZip();
        $addressData['oxfon'] = $details->getShipToPhoneNumber();
        $addressData['oxaddinfo'] = $details->getShipToStreet2();

        return $addressData;
    }
89001
public function formatContactDetails(ClientContactDetailsInterface $details, $lineSeparator = self::LINES_SEPARATOR)
    {
        $lines   = [];
        $lines[] = sprintf('%s %s', $details->getFirstName(), $details->getLastName());
        $lines[] = sprintf('%s %s', $details->getPhone(), $details->getSecondaryPhone());
        $lines[] = $details->getEmail();
        
        return implode($lineSeparator, $lines);
    }
5551
private function decorateParamsForMethodCall(array $params) : string
    {
        $params_out = [];
        foreach($params as $param) {
            $params_out[] = $this->decorateValue($param);
        }
        return implode(',',$params_out);
    }
1158253
protected function _render_details($mode)
    {
        if (count($this->order_by))
        {
            $order_direct = strtolower(reset($this->order_by));
            $order_column = key($this->order_by);
        }
        else
        {
            $order_column = $this->table . '.' . $this->primary_key;
            $order_direct = 'asc';
        }

        /*        if ($mode == 'create')
        {
        $this->disabled = $this->disabled_on_create;
        $this->readonly = $this->readonly_on_create;
        }
        elseif ($mode == 'edit')
        {
        $this->disabled = $this->disabled_on_edit;
        $this->readonly = $this->readonly_on_edit;
        }
        */
        if (isset($this->result_row['primary_key']))
        {
            $this->primary_val = $this->result_row['primary_key'];
        }
        if ($this->result_row)
        {
            foreach ($this->fields as $field => $fitem)
            {
                if (isset($this->custom_fields[$field]))
                {
                    $this->result_row[$field] = $this->defaults[$field];
                }
                if ($this->field_type[$field] == 'hidden')
                {
                    $this->hidden_fields_output[$field] = $this->create_hidden($field, $this->result_row[$field]);
                }
                else
                {

                    if (isset($this->field_callback[$field]) && $mode != 'view')
                    {
                        $path = $this->check_file($this->field_callback[$field]['path'], 'field_callback');
                        include_once ($path);
                        if (is_callable($this->field_callback[$field]['callback']))
                        {
                            $this->fields_output[$field] = array(
                                'label' => $this->fields_names[$field],
                                'field' => call_user_func_array($this->field_callback[$field]['callback'], array(
                                    $this->result_row[$field],
                                    $field,
                                    $mode,
                                    $this->result_row,
                                    $this)),
                                'name' => $field,
                                'value' => $this->result_row[$field]);
                        }
                    }
                    elseif (isset($this->column_callback[$field]) && $mode == 'view')
                    {
                        $path = $this->check_file($this->column_callback[$field]['path'], 'column_callback');
                        include_once ($path);
                        if (is_callable($this->column_callback[$field]['callback']) && $this->result_row)
                        {
                            $this->fields_output[$field] = array(
                                'label' => $this->fields_names[$field],
                                'field' => call_user_func_array($this->column_callback[$field]['callback'], array(
                                    $this->result_row[$field],
                                    $field,
                                    $this->primary_val,
                                    $this->result_row,
                                    $this)),
                                'name' => $field,
                                'value' => $this->result_row[$field]);
                        }

                    }
                    else
                    {
                        $attr = $this->get_field_attr($field, $mode);
                        if ($mode == 'view')
                        {
                            $func = 'create_view_' . $this->field_type[$field];
                        }
                        else
                        {
                            $func = 'create_' . $this->field_type[$field];
                        }
                        if (!method_exists($this, $func))
                            continue;
                        $this->fields_output[$field] = array(
                            'label' => $this->fields_names[$field],
                            'field' => call_user_func_array(array($this, $func), array(
                                $field,
                                $this->result_row[$field],
                                $attr)),
                            'name' => $field,
                            'value' => $this->result_row[$field]);
                        if (isset($this->column_pattern[$field]) && $mode == 'view')
                        {
                            $this->fields_output[$field]['field'] = str_ireplace('{value}', $this->fields_output[$field]['field'], $this->
                                column_pattern[$field]);
                            $this->fields_output[$field]['field'] = $this->replace_text_variables($this->fields_output[$field]['field'], $this->
                                result_row, true);
                        }
                    }
                }
            }
        }

        if ($this->inner_table_instance && ($mode == 'view' or $mode == 'edit')) // restoring nested objects
        {
            foreach ($this->inner_table_instance as $inst_name => $field)
            {
                if (isset($this->result_row[$field]))
                {
                    $instance = self::get_instance($inst_name);
                    $instance->ajax_request = true;
                    $instance->import_vars();
                    $instance->inner_where($this->result_row[$field]);

                    if ($mode == 'view' && Fruit_config::$nested_readonly_on_view)
                    {
                        $instance->table_ro = true;
                    }
                    else
                    {
                        $instance->table_ro = false;
                    }
                    $this->nested_rendered[$inst_name] =
                        '<div class="fruit-nested-container fruit-container"><div class="fruit-ajax" id="fruit-ajax-' . base_convert(rand(), 10,
                        36) . '">' . $instance->render('list') . '</div></div>';
                }
            }
        }

        $view_file = FRUIT_PATH . '/' . Fruit_config::$themes_path . '/' . $this->theme . '/' . $this->load_view[$mode];
        $this->check_file($view_file, 'render');
        ob_start();
        include ($view_file);
        $this->data = $this->render_search_hidden() . ob_get_contents();
        ob_end_clean();
        /*if ($this->inner_table_instance && ($mode == 'view' or $mode == 'edit')) // restoring nested objects
        {
        foreach ($this->inner_table_instance as $inst_name => $field)
        {
        if (isset($this->result_row[$field]))
        {
        $instance = self::get_instance($inst_name);
        $instance->ajax_request = true;
        $instance->import_vars();
        $instance->inner_where($this->result_row[$field]);

        if ($mode == 'view' && Fruit_config::$nested_readonly_on_view)
        {
        $instance->table_ro = true;
        }
        else
        {
        $instance->table_ro = false;
        }
        //$this->data .= '<div class="fruit-nested-container fruit-container"><div class="fruit-ajax" id="fruit-ajax-' .
        //    base_convert(rand(), 10, 36) . '">' . $instance->render('list') . '</div></div>';
        $this->nested_rendered[$inst_name] = '<div class="fruit-nested-container fruit-container"><div class="fruit-ajax" id="fruit-ajax-' .
        base_convert(rand(), 10, 36) . '">' . $instance->render('list') . '</div></div>';
        }
        }
        }*/
        if ($this->nested_rendered)
        {
            $this->data .= implode('', $this->nested_rendered);
        }
        return $this->render_output();
    }
981231
protected function renderMessage(string $title, string $details, int $status)
    {
        $msg = new Message();
        $msg->add($title)
            ->setDetails($details)
            ->setStatus($status);
        return $msg;
    }
55085
public function getDescription()
    {
        $flattened = (array) $this->getStringTask();
        $flattened = implode('/', $flattened);

        return parent::getDescription() ?: $flattened;
    }
1324897
private function resolveOutputGroups(array $details, $briefMode = false)
    {
        $detailsResolver = new \Vaimo\ComposerChangelogs\Resolvers\ReleaseDetailsResolver();

        $generalInfo = $detailsResolver->resolveOverview($details);
        $groups = $detailsResolver->resolveChangeGroups($details);

        if ($briefMode) {
            $summary = array_map(function ($key, $group) {
                return sprintf('%s (%s)', $key, count($group));
            }, array_keys($groups), $groups);

            $generalInfo = $detailsResolver->resolveOverview($details);

            $groups = array(
                'overview' => $generalInfo['overview'],
                'summary' => sprintf('Includes: %s', implode(', ', $summary))
            );
        } elseif ($generalInfo['overview']) {
            $groups = array_merge(
                $groups,
                array('overview' => $generalInfo['overview'])
            );
        }

        return $groups;
    }
400178
protected function displayJson(array $details)
    {
        $errors = 0;

        array_walk(
            $details,
            function (&$info) use (&$errors) {
                $info['file'] = (string) $info['file'];
                unset($info['template']);

                if (!$info['valid']) {
                    $info['message'] = $info['exception']->getMessage();
                    unset($info['exception']);
                    $errors++;
                }
            }
        );

        $this->line(json_encode($details, JSON_PRETTY_PRINT));

        return min($errors, 1);
    }
262732
public function formatDetailed($value)
    {
        //\MUtil_Echo::track($value);
        if (is_array($value)) {
            $group = $this->currentUser->getGroup();

            if ($group) {
                $value = $group->applyGroupToData($value);
            }
        }

        return parent::formatDetailed($value);
    }
1159216
public function getFullMessage(): string {
        $paras = [];

        if (!empty($this->getMainMessage())) {
            $paras[] = $this->getMainMessage();
        } elseif ($this->getErrorCount() === 0) {
            return '';
        }

        if (isset($this->errors[''])) {
            $paras[] = $this->formatErrorList('', $this->errors['']);
        }

        foreach ($this->errors as $field => $errors) {
            if ($field === '') {
                continue;
            }
            $paras[] = $this->formatErrorList($field, $errors);
        }

        $result = implode("\n\n", $paras);
        return $result;
    }
857827
public function getButton($details)
    {
        if (is_string($details)) {
            return HtmlHelper::get()->noContentElement('input', array(
                'type' => 'submit',
                'name' => $details,
                'value' => $this->translate(ucwords(str_replace('_', ' ', $details)))
            ));
        }
        if (isset($details['visible']) && $details['visible'] == false) {
            return ''; //return nothing if hidden;
        }
        $htmlOptions = isset($details['htmlOptions']) ? $details['htmlOptions'] : array();
        $htmlOptions['type'] = isset($details['type']) ? $details['type'] : 'submit';
        $htmlOptions['name'] = $details['name'];
        $htmlOptions['value'] = $this->translate($details['label']);
        return HtmlHelper::get()->noContentElement('input', $htmlOptions);
    }