Format a installment for output

@param $installment
@return array
172661
private function formatInstallments($installment)
    {
        return [
            'quantity' => $installment->getQuantity(),
            'amount' => $installment->getAmount(),
            'totalAmount' => round($installment->getTotalAmount(), 2),
            'text' => str_replace('.', ',', $this->getInstallmentText($installment))
        ];
    }
446182
public function getRoundDescriptions()
    {
        $this->_ensureRounds();

        $output = array();
        foreach ($this->getRounds() as $roundId => $round) {
            if ($round instanceof Round) {
                $output[$roundId] = $round->getFullDescription();
            }
        }

        return $output;
    }
473996
public function format($diff)
    {

        $xi = $yi = 1;
        $block = false;
        $context = array();

        $nlead = $this->leading_context_lines;
        $ntrail = $this->trailing_context_lines;

        $this->start_diff();
        $x0 = 0;
        $y0 = 0;

        foreach ($diff->edits as $edit) {
            if ($edit->type == 'copy') {
                if (is_array($block)) {
                    if (sizeof($edit->orig) <= $nlead + $ntrail) {
                        $block[] = $edit;
                    } else {
                        if ($ntrail) {
                            $context = array_slice($edit->orig, 0, $ntrail);
                            $block[] = new DiffOp_Copy($context);
                        }
                        $this->block($x0, $ntrail + $xi - $x0,
                            $y0, $ntrail + $yi - $y0,
                            $block);
                        $block = false;
                    }
                }
                $context = $edit->orig;
            } else {
                if (!is_array($block)) {
                    $context = array_slice($context, max(0, sizeof($context) - $nlead));
                    $x0 = $xi - sizeof($context);
                    $y0 = $yi - sizeof($context);
                    $block = array();
                    if ($context)
                        $block[] = new DiffOp_Copy($context);
                }
                $block[] = $edit;
            }

            if ($edit->orig)
                $xi += sizeof($edit->orig);
            if ($edit->final)
                $yi += sizeof($edit->final);
        }

        if (is_array($block))
            $this->block($x0, $xi - $x0,
                $y0, $yi - $y0,
                $block);

        return $this->end_diff();
    }
115021
public function toOptionArray()
    {
        $return = [];

        $paymentMethodCodes = $this->_installmentsHelper->getAllInstallmentPaymentMethodCodes();
        foreach ($paymentMethodCodes as $paymentMethodCode) {
            $return[] = [
                'value' => $paymentMethodCode,
                'label' => ucfirst(str_replace('_', ' ', $paymentMethodCode))
            ];
        }
        return $return;
    }
371220
protected function formatRequirements(array $packages)
    {
        $requires = [];
        $packages = $this->normalizeRequirements($packages);
        foreach ($packages as $package) {
            $requires[$package['name']] = $package['version'];
        }

        return $requires;
    }
642602
protected function outputFormatTablePayment(array $items)
    {
        $header = array(
            $this->text('ID'),
            $this->text('Name'),
            $this->text('Module'),
            $this->text('Enabled'),
        );

        $rows = array();

        foreach ($items as $item) {
            $rows[] = array(
                $item['id'],
                $this->truncate($item['title'], 50),
                $item['module'],
                empty($item['status']) ? $this->text('No') : $this->text('Yes')
            );
        }

        $this->outputFormatTable($rows, $header);
    }
98414
public function formatLongLine(array $privileges)
    {
        $output     = \MUtil_Html::create('div');

        if (count($privileges)) {
            $privileges = array_combine($privileges, $privileges);
            foreach ($this->getUsedPrivileges() as $privilege => $description) {
                if (isset($privileges[$privilege])) {
                    if (count($output) > 11) {
                        $output->append('...');
                        return $output;
                    }
                    if (\MUtil_String::contains($description, '<br/>')) {
                        $description = substr($description, 0, strpos($description, '<br/>') - 1);
                    }
                    $output->raw($description);
                    $output->br();
                }
            }
        }

        return $output;
    }
406876
public function format($event)
    {
        $results = [];

        foreach ($event as $key => $value) {
            if ('extra' === $key && is_array($value)) {
                $results[$key] = $this->format($value);
            } else {
                $results[$key] = $this->normalize($value);
            }
        }

        return $results;
    }
848739
protected function formatFailure($index, Result $failure)
    {
        $exception = $failure->getException();
        $exception_category = $failure->getException()->getCategory();

        return indent(4, implode(
            "\n",
            array(
                tag("info", $exception_category.': ') . $exception->getMessage(),
                tag("info", "Via:"),
                $this->formatTrace($exception)
            )
        ));
    }
651327
private function output($installments, $maxInstallment)
    {
        return ($maxInstallment) ?
            $this->formatOutput($this->getMaxInstallment($installments)) :
            $this->formatOutput($installments);
    }
78956
private function _toFormatBreadcrumbs($list)
    {
        $format = [];
        foreach ($list as $val) {
            $format[$val[$this->pkField]] = $val[$this->showTitleField];
            if (array_key_exists('_child', $val)) {
                $format = ArrayHelper::merge($format, $this->_toFormatBreadcrumbs($val['_child']));
            }
        }
        
        return $format;
    }
712784
private function formatArray($order, $item, $remove = false, $lastItem = true)
    {
        return [
            'remove'   => $remove,
            'lastItem' => $lastItem,
            'item'     => [
                'quantity' => $item->getQuantity(),
                'total'    => $this->moneyFormatter->format(
                    $item->getTotal(),
                    $order->getCurrencyCode(),
                    $order->getLocaleCode()
                ),
                'subtotal' => $this->moneyFormatter->format(
                    $item->getSubTotal(),
                    $order->getCurrencyCode(),
                    $order->getLocaleCode()
                ),
            ],
            'order' => [
                'total' => $this->moneyFormatter->format(
                    $order->getTotal(),
                    $order->getCurrencyCode(),
                    $order->getLocaleCode()
                ),
                'items-total' => $this->moneyFormatter->format(
                    $order->getItemsTotal(),
                    $order->getCurrencyCode(),
                    $order->getLocaleCode()
                ),
            ],
            'payments' => $this->getPaymentsTotals($order),
        ];
    }
319505
protected function renderEdges($indent)
    {
        $edgeString = '';
        foreach (array_unique($this->edges) as $edge) {
            $edgeString .= $this->formatLine($edge, $indent);
        }
        return $edgeString;
    }
1241027
private function getInstallmentText($installment)
    {
        return sprintf(
            "%s x de R$ %.2f %s juros",
            $installment->getQuantity(),
            $installment->getAmount(),
            $this->getInterestFreeText($installment->getInterestFree()));
    }
734693
private function _format($data) {
        $output_callback_function = '';
        
        // If data is in array format then set content-type
        // to application/json
        if (is_array($data) || is_object($data)) {
            $this->header('Content-type: application/json');
            // Convert to json
            $output_callback_function = json_encode($data);
        } else {
            // Default
            $output_callback_function = $data;
        }
        
        $output = $output_callback_function;
        
        // GZIP output compression
        if ($this->_compress) {
            // Set Content coding a gzip
            $this->header('Content-Encoding: gzip');
            
            // Set headers for gzip
            $output = "\x1f\x8b\x08\x00\x00\x00\x00\x00";
            $output .= gzcompress($output_callback_function);
        }
        
        return $output;
    }
1315955
def _output_format(out,
                   operation):
    '''
    
    '''
    return [s.split()[1:] for s in out
            if s.startswith(operation)]
883188
public function getTotalsRowHTML()
    {
        $output = [];
        foreach ($this->columns as $name => $column) {
            // if no totals plan, then show dash, but keep column formatting
            if (!isset($this->totals_plan[$name])) {
                $output[] = $column->getTag('foot', '-');
                continue;
            }

            // if totals plan is set as array, then show formatted value
            if (is_array($this->totals_plan[$name])) {
                // todo - format
                $field = $this->model->getElement($name);
                $output[] = $column->getTotalsCellHTML($field, $this->totals[$name]);
                continue;
            }

            // otherwise just show it, for example, "Totals:" cell
            $output[] = $column->getTag('foot', $this->totals_plan[$name]);
        }

        return implode('', $output);
    }