Returns the memory peak, readable or not
@param  boolean $raw    Whether the result must be human readable
@param  string  $format The format to display (printf format)
@return string|float
176335
public function getMemoryPeak($raw = false, $format = null)
    {
        $memory = memory_get_peak_usage(true);
        return $raw ? $memory : self::readableSize($memory, $format);
    }
336957
public function getFormatClass($format = '')
    {
        if ( ! empty($format)) {
            return $this->processContentType($format);
        }

        if (isset($_SERVER['CONTENT_TYPE'])) {
            $type = $this->processContentType($_SERVER['CONTENT_TYPE']);
            if ($type !== false) {
                return $type;
            }
        }

        if (isset($_SERVER['HTTP_CONTENT_TYPE'])) {
            $type = $this->processContentType($_SERVER['HTTP_CONTENT_TYPE']);
            if ($type !== false) {
                return $type;
            }
        }

        return 'Nathanmac\Utilities\Parser\Formats\JSON';
    }
558208
public function format(string $format)
    {
        $result = '';
        $length = \mb_strlen($format);

        $skip_next = false;

        // iterate for each character
        for ($index = 0; $index < $length; $index++) {
            $format_char = mb_substr($format, $index, 1);

            $result .= $this->getValueOfFormatCharacter($format_char, $skip_next);
        }

        // remove null bits if they exist
        return str_replace("\0", '', $result);
    }
1221809
protected function escapeUnapplicableFormatChars(string $format) : string
    {
        $validChars      = $this->getValidDateFormatChars();
        $validCharLookup = array_fill_keys($validChars, true);

        $escapedFormat = '';
        $isEscaped     = false;

        foreach (str_split($format) as $char) {
            if ($isEscaped) {
                $escapedFormat .= '\\' . $char;
                $isEscaped = false;
            } elseif ($char === '\\') {
                $isEscaped = true;
            } elseif (isset($validCharLookup[$char])) {
                $escapedFormat .= $char;
            } else {
                $escapedFormat .= '\\' . $char;
            }
        }

        return $escapedFormat;
    }
1281485
public function sha256($format = null, $raw_output = false)
	{
		return hash('sha256', parent::format($format === null ? static::$format : $format), $raw_output);
	}
151142
public function getSort($format = 'native')
    {
        if (!is_null($this->suppliedSort)) {
            $nativeSort = $this->suppliedSort;
        } elseif (!is_null($this->entitySort)) {
            $nativeSort = $this->entitySort;
        } else {
            // no explicit sort supplied, return false
            return false;
        }

        // convert to sql dialect if asked
        if ($format == 'sql') {
            // first_name,-last_name
            $sortFields = explode(',', $nativeSort);
            $parsedSorts = array(); // the final Phalcon friendly sort array

            foreach ($sortFields as $order) {
                if (substr($order, 0, 1) == '-') {
                    $subOrder = substr($order, 1);
                    if (!empty($subOrder)) {
                        $parsedSorts[] = $subOrder . " DESC";
                    }
                } else {
                    $parsedSorts[] = $order;
                }
            }
            $nativeSort = implode(',', $parsedSorts);
        }

        return $nativeSort;
    }
205288
public function getFormatInstance($format = null)
    {
        $format = $format ?: $this->format;

        if (!($format instanceof FormatInterface)) {
            if (!isset($this->formats[$format])) {
                $event = new NewFormatEvent($this, new $format($this));
                $this->trigger($event);
                $this->formats[$format] = $event->getFormat();
            }

            $format = $this->formats[$format];
        }

        return $format;
    }
767929
static function get($key = 'all', $format = false)
    {
        if (isset(self::$stop[$key])){
            if ($format){
                return array(
                    'time' => sprintf('%0.8f s', self::$stop[$key]['time']),
                    'memory' => sprintf('%0.3f Mb', self::$stop[$key]['memory'] / 1048576),
                    'memory_max' => sprintf('%0.3f Mb', self::$stop[$key]['memory_max'] / 1048576),
                );
            }else{
                return self::$stop[$key];
            }
        }
        return null;
    }
1317402
public function getParameters($format = self::FETCH_ASSOC) {

        if ( $format === self::FETCH_NUMERIC ) return array_values($this->signatures[$this->current_signature]["PARAMETERS"]);

        else return $this->signatures[$this->current_signature]["PARAMETERS"];

    }
829783
private function decode($format)
    {
        $data = $this->decoder->decode((string) $this->apiContext->getResponse()->getBody(), $format);

        if ($format === 'json' && isset($data['_embedded']['items'])) {
            $data = $data['_embedded']['items'];
        }

        if ($format === 'xml') {
            if (!empty($data) && isset($data['entry'])) {
                if (is_int(key($data['entry']))) {
                    $data = $data['entry'];
                } elseif (isset($data['entry']['@rel'])) {
                    $data = array_pop($data['entry']);
                } else {
                    $data = [$data['entry']];
                }
            } else {
                $data = [];
            }
        }

        return $data;
    }
1212787
public function getDataOcorrencia($format = 'd/m/Y')
    {
        return $this->dataOcorrencia instanceof Carbon
        ? $format === false ? $this->dataOcorrencia : $this->dataOcorrencia->format($format)
        : null;
    }
419749
public function getImage(string $format = null) : string
    {
        if (!$format) {
            $format = $this->instance->getImageFormat();
        }
        switch (strtolower($format)) {
            case 'jpg':
            case 'jpeg':
                $this->instance->setImageFormat('jpg');
                break;
            case 'bitmap':
            case 'bmp':
                $this->instance->setImageFormat('bmp');
                break;
            case 'png':
                $this->instance->setImageFormat('png');
                break;
            case 'gif':
                $this->instance->setImageFormat('gif');
                break;
            case 'webp':
                $this->instance->setImageFormat('webp');
                break;
            default:
                throw new ImageException('Unsupported format');
        }
        return $this->instance->getImageBlob();
    }
620180
public function read(string $format = null) : string
    {
        $input = array_shift($this->stack);
        if (isset($format, $input)) {
            $input = sprintf($format, $input);
        }
        return $input ?? '';
    }
66070
protected function getMaxUncompressionSpeedFormat(FormatInterface $format, array $methods)
    {
        $maxSpeed = MethodInterface::SPEED_LEVEL_LOWEST;

        foreach ($methods as $method) {
            if ($method->isSupported() && $method->isFormatSupported($format)) {
                $maxSpeed = max($maxSpeed, $method->getUncompressionSpeedLevel($format));
            }
        }

        if ($format instanceof ComposedFormatInterface) {
            $maxSpeedComposed = MethodInterface::SPEED_LEVEL_LOWEST;
            $subformats = $format->getComposedFormats();
            foreach ($subformats as $subformat) {
                $maxSpeedComposed = max($maxSpeedComposed, $this->getMaxUncompressionSpeedFormat($subformat, $methods) / count($subformats));
            }
        }

        return $maxSpeed;
    }
1031552
public function getToc($raw = false)
    {
        if ($raw === true)
            return ($this->_toc['sub']);
        $html = "<b>On this page:</b>" . $this->_getRenderedToc($this->_toc['sub']);
        return ($html);
    }
896026
public function getDateHumanReadable($column, $format = 'd-m-Y H:i:s', $maxDays = 3)
    {
        // Retrieve value of column
        $date = $this->{$column};

        // Make sure date is a Carbon object
        // otherwise just return untouched value
        if (! $date instanceof Carbon) {
            return $column;
        }

        // If date is older than $maxDays
        // we'll return the date and time
        $daysDifference = $date->diffInDays();
        if ($daysDifference > $maxDays) {
            return $date->format($format);
        }

        return $date->diffForHumans();
    }
1268979
function getSubjectDN($format = FILE_X509_DN_ARRAY)
    {
        switch (true) {
            case !empty($this->dn):
                return $this->getDN($format);
            case !isset($this->currentCert) || !is_array($this->currentCert):
                break;
            case isset($this->currentCert['tbsCertificate']):
                return $this->getDN($format, $this->currentCert['tbsCertificate']['subject']);
            case isset($this->currentCert['certificationRequestInfo']):
                return $this->getDN($format, $this->currentCert['certificationRequestInfo']['subject']);
        }

        return false;
    }