Gets replacements for the format method

@return array
13701
protected function getFormattedReplacements()
    {
        $time = $this->getMembers();

        $negative = $this->isNegative();

        return [
            self::HOUR_FORMAT          => sprintf('%02d', $time['hours']),
            self::MINUTE_FORMAT        => sprintf('%02d', $time['minutes']),
            self::SECOND_FORMAT        => sprintf('%02d', $time['seconds']),
            self::TOTAL_MINUTES_FORMAT => sprintf('%02d', $time['total_minutes']),
            self::SIGN_ANY             => $negative ? '-' : '+',
            self::SIGN_NEGATIVE        => $negative ? '-'  : '',
        ];
    }
312395
public function getFormatted(): string
    {
        return $this->format(
            [
                $this->getTitle(),
                $this->getFirstName(),
                $this->format($this->middleNames),
                $this->getLastName(),
                $this->getSuffix(),
            ]
        );
    }
1127363
private function buildReplacements()
    {
        if ($this->csvFormat->getEscape()) {
            $this->escapeChars = [
                $this->csvFormat->getEscape(), // escape escape first so that it doesn't re-escape later on
                $this->csvFormat->getDelimiter(),
                "\n",
                "\r",
                "\t",
            ];
            if ($this->csvFormat->hasQuote() && !$this->csvFormat->useDoubleQuotes()) {
                $this->escapeChars[] = $this->csvFormat->getQuote();
            }

            $this->escapeChars = array_unique($this->escapeChars);

            $this->replaceChars = array_map(function ($char) {
                return $this->csvFormat->getEscape() . $char;
            }, $this->escapeChars);
        }

        if ($this->csvFormat->hasQuote() && $this->csvFormat->useDoubleQuotes()) {
            $this->escapeChars[] = $this->csvFormat->getQuote();
            $this->replaceChars[] = str_repeat($this->csvFormat->getQuote(), 2);
        }
    }
44719
public function getFormatPattern()
    {
        static $kyr = self::KYR_CHARS;

        switch (true) {
            // X000XX77_OR_X000XX777
            case \preg_match("~^[{$kyr}]{1}\d{3}[{$kyr}]{2}\d{2,3}$~iu", $this->value) === 1:
                return self::FORMAT_PATTERN_1;

            // X000XX
            case \preg_match("~^[{$kyr}]{1}\d{3}[{$kyr}]{2}$~iu", $this->value) === 1:
                return self::FORMAT_PATTERN_2;

            // XX00077
            case \preg_match("~^[{$kyr}]{2}\d{3}\d{2}$~iu", $this->value) === 1:
                return self::FORMAT_PATTERN_3;

            // 0000XX77
            case \preg_match("~^\d{4}[{$kyr}]{2}\d{2}$~iu", $this->value) === 1:
                return self::FORMAT_PATTERN_4;

            // XX000077
            case \preg_match("~^[{$kyr}]{2}\d{4}\d{2}$~iu", $this->value) === 1:
                return self::FORMAT_PATTERN_5;

            // X000077
            case \preg_match("~^[{$kyr}]{1}\d{4}\d{2}$~iu", $this->value) === 1:
                return self::FORMAT_PATTERN_6;

            // 000X77
            case \preg_match("~^\d{3}[{$kyr}]{1}\d{2}$~iu", $this->value) === 1:
                return self::FORMAT_PATTERN_7;

            // 0000X77
            case \preg_match("~^\d{4}[{$kyr}]{1}\d{2}$~iu", $this->value) === 1:
                return self::FORMAT_PATTERN_8;
        }
    }
866830
protected function getCommonReplacements()
    {
        return [
            '{{sectionBaseName}}' => end($this->sectionSegments),
            '{{studlySectionBaseName}}' => end($this->sectionSegmentsStudly),
            '{{routeBaseAlias}}' => $this->section,
            '{{langBaseKey}}'    => ($this->langDir ? $this->langDir.'/' : '').implode('/', $this->sectionSegments),
            '{{viewBaseName}}'   => ($this->viewsDir ? $this->viewsDir.'.' : '').$this->section,
            '{{modelClass}}'     => $this->modelClass,
        ];
    }
810967
public static function getFormatos()
    {
        if (!self::$formatos) {
            $dir = dirname(__FILE__).'/Formatos';
            $formatos = scandir($dir);
            foreach($formatos as &$formato) {
                if ($formato[0]=='.')
                    continue;
                if (is_dir($dir.'/'.$formato)) {
                    $subformatos = scandir($dir.'/'.$formato);
                    foreach($subformatos as &$subformato) {
                        if ($subformato[0]=='.')
                            continue;
                        self::$formatos[] = $formato.'.'.substr($subformato, 0, -4);
                    }
                } else {
                    self::$formatos[] = substr($formato, 0, -4);
                }
            }
        }
        return self::$formatos;
    }
1033921
protected function getDefaultFormats()
    {
        return [
            [
                'type' => Token::TYPE_KEYWORD,
                'flags' => Token::FLAG_KEYWORD_RESERVED,
                'html' => 'class="sql-reserved"',
                'cli' => "\x1b[35m",
                'function' => 'strtoupper',
            ],
            [
                'type' => Token::TYPE_KEYWORD,
                'flags' => 0,
                'html' => 'class="sql-keyword"',
                'cli' => "\x1b[95m",
                'function' => 'strtoupper',
            ],
            [
                'type' => Token::TYPE_COMMENT,
                'flags' => 0,
                'html' => 'class="sql-comment"',
                'cli' => "\x1b[37m",
                'function' => '',
            ],
            [
                'type' => Token::TYPE_BOOL,
                'flags' => 0,
                'html' => 'class="sql-atom"',
                'cli' => "\x1b[36m",
                'function' => 'strtoupper',
            ],
            [
                'type' => Token::TYPE_NUMBER,
                'flags' => 0,
                'html' => 'class="sql-number"',
                'cli' => "\x1b[92m",
                'function' => 'strtolower',
            ],
            [
                'type' => Token::TYPE_STRING,
                'flags' => 0,
                'html' => 'class="sql-string"',
                'cli' => "\x1b[91m",
                'function' => '',
            ],
            [
                'type' => Token::TYPE_SYMBOL,
                'flags' => 0,
                'html' => 'class="sql-variable"',
                'cli' => "\x1b[36m",
                'function' => '',
            ],
        ];
    }
632906
public function format(Collection $replacement)
    {
        $replacement = $this->prepare($replacement);
        $messageLines = explode(PHP_EOL, $replacement['message']);
        
        foreach ($messageLines as &$messageLine) {
            $replacement['message'] = $messageLine;
            $messageLine = $this->replace($this->getFormat(), $replacement);
        }
        
        return implode(PHP_EOL, $messageLines);
    }
1124653
protected function getTermPlaceholders()
    {
        $placeholders = [];

        foreach ($this->repository as $field) {
            $placeholders[$field->getName()] = $field->getOption('placeholder');
        }

        return $placeholders;
    }
1148557
private static function ReplaceVars(){
            $oThis = self::CreateInstanceIfNotExists();

            $aP = array();
            $iOffset = 0;

            while(preg_match('/(\{\$(.*?)\})/i', $oThis->sBuffer, $aMatches, PREG_OFFSET_CAPTURE, $iOffset)){
                $mVar = $aMatches[2][0];

                if(Storage::Has($mVar)){
                    $mTo = Storage::Get($mVar);

                    if(is_bool($mTo))
                        $mTo = ($mTo) ? "true" : "false";

                    $mTo = html_entity_decode($mTo, ENT_NOQUOTES/*, Config::Read("l10n.charset")*/);
                    $oThis->sBuffer = str_replace($aMatches[0][0], $mTo, $oThis->sBuffer);
                }

                $iOffset = $aMatches[0][1]+strlen($aMatches[0][0]);
            }
        }
1190802
private function _replaceDelimiters ($s)
    {
        foreach ($this->getWordDelimiters() as $delimiter) {
            if ($delimiter == $this->getDelimiterReplacement()) {
                continue;
            }
            if (in_array($delimiter, $this->getNotReplacedChars())) {
                continue;
            }
            
            $s = str_replace($delimiter, $this->getDelimiterReplacement(), $s);
        }
        return $s;
    }
985803
public function getReplacements()
    {
        $replaces = [
            'extends' => $this->extends,
            'section' => $this->section,
            'content' => $this->content,
        ];

        return $this->customReplacements + $replaces;
    }
1181073
public function getAllTimeFormatFlat()
    {
        $aOut     = [];
        $aFormats = $this->getAllTimeFormat();

        foreach ($aFormats as $oFormat) {
            $aOut[$oFormat->slug] = $oFormat->label;
        }

        return $aOut;
    }
33078
public function getFormatter()
    {
        if ($this->formatterInstance === null) {
            $this->formatterInstance = Yii::createObject(
                [
                    'class' => '\yii\i18n\Formatter',
                    'decimalSeparator' => $this->decimal_separator,
                    'thousandSeparator' => $this->thousand_separator,
                    'numberFormatterOptions' => [
                        \NumberFormatter::MIN_FRACTION_DIGITS => $this->min_fraction_digits,
                        \NumberFormatter::MAX_FRACTION_DIGITS => $this->max_fraction_digits,
                    ]
                ]
            );
        }
        return $this->formatterInstance;
    }
1239128
protected function formatBoth()
    {
        $data = [];
        $index = 0;

        foreach ($this->getData() as $key => $value) {
            $data[$key] = $value;
            $data[$index] = $value;
            $index++;
        }

        return $data;
    }
947341
protected function _format($log)
    {
        $replaced = [];

        $replaced[':date'] = date('Y-m-d\TH:i:s', $log->timestamp) . sprintf('.%03d', ($log->timestamp - (int)$log->timestamp) * 1000);
        $replaced[':client_ip'] = $log->client_ip ?: '-';
        $replaced[':request_id'] = $log->request_id ?: '-';
        $replaced[':request_id16'] = $log->request_id ? substr($log->request_id, 0, 16) : '-';
        $replaced[':category'] = $log->category;
        $replaced[':location'] = "$log->file:$log->line";
        $replaced[':level'] = strtoupper($log->level);
        if ($log->category === 'exception') {
            $replaced[':message'] = '';
            /** @noinspection SuspiciousAssignmentsInspection */
            $replaced[':message'] = preg_replace('#[\\r\\n]+#', '\0' . strtr($this->_format, $replaced), $log->message) . PHP_EOL;
        } else {
            $replaced[':message'] = $log->message . PHP_EOL;
        }

        return strtr($this->_format, $replaced);
    }
368519
public function askForReplacements($child)
    {
        $replacements = [];

        if ($child) {
            $this->placeholders = array_merge($this->placeholders, $this->childPlaceholders);
        }

        foreach ($this->placeholders as $placeholder => $data) {
            $input = $this->climate->input($data['message']);

            $input->defaultTo($data['value']);

            $replacements[$placeholder] = addslashes($input->prompt());
        }

        return $replacements;
    }