Get HTTP query length.

@param (bool) $mb

@since 3.0.0

@return int
502963
public function getQueryLength($mb = true)
    {
        return ($mb) ? mb_strlen($this->query) : strlen($this->query);
    }
449687
public function do_length($topic, $priority = null)
    {
        /** @var \ManaPHP\DbInterface $db */
        $db = $this->_di->getShared($this->_db);

        if ($priority === null) {
            return $db->query($this->_source)->where(['topic' => $topic, 'deleted_time' => 0])->count();
        } else {
            return $db->query($this->_source)->where(['topic' => $topic, 'deleted_time' => 0, 'priority' => $priority])->count();
        }
    }
422975
protected function getLimit(Request $request)
    {
        return min(
            $this->getMaxLimit($request),
            $request->query->get(
                'length',
                $this->getDefaultLimit($request)
            )
        );
    }
150102
public function size() : int
    {
        if ($this->bufSize == null) {
            $this->bufSize = strlen($this->buf);
        }
        return $this->bufSize;
    }
172305
public function write(string $data): int
    {
        $length = fputs($this->resource, $data, strlen($data));
        if (false === $length) {
            if (stream_get_meta_data($this->resource)['timed_out']) {
                throw new Timeout(
                        'Writing of ' . strlen($data) . ' bytes failed:'
                        . ' timeout of ' . $this->timeout . ' seconds exceeded'
                );
            }

            throw new ConnectionFailure(
                    'Writing of ' . strlen($data) . ' bytes failed.'
            );
        }

        return $length;
    }
1257292
public static function lengths($value, $length)
    {
        if (is_array($length)) {
            foreach ($length as $strlen) {
                if (mb_strlen($value) === $strlen) {
                    return true;
                }
            }

            return false;
        }

        return mb_strlen($value) === $length;
    }
1363709
private function getSizeFromMetadata()
    {
        foreach ($this->stream->getMetadata('wrapper_data') as $value) {
            if (substr($value, 0, 15) == "Content-Length:") {
                return (int) substr($value, 16);
            }
        }
        return 0;
    }
303318
public function getMaxLength()
    {
        if ($this->isString() && isset($this->methodParams[0])) {
            return intval($this->methodParams[0]);
        }

        return null;
    }
545272
private function getHostLength()
    {
        $hostLength = strpos($this->url, '/');
        $hostLength = (false === $hostLength) ? strlen($this->url) : $hostLength;

        return $hostLength;
    }
317984
protected static function getRequestSize($header, $method)
    {
        if($method === 'GET' || $method === 'OPTIONS' || $method === 'HEAD') {
            return strlen($header) + 4;
        }
        $match = array();
        if (preg_match("/\r\nContent-Length: ?(\d+)/i", $header, $match)) {
            $content_length = isset($match[1]) ? $match[1] : 0;
            return $content_length + strlen($header) + 4;
        }
        return $method === 'DELETE' ? strlen($header) + 4 : 0;
    }
1185792
public function count(
        $query = [],
        $limit = null,
        $skip = null,
        $timeout = 2000
    ) {
        $this->getContext()->getLog()->profileStart($this->profileName . __FUNCTION__);
        $options = [
            'socketTimeoutMS' => $timeout
        ];
        if (!is_null($limit)) {
            $options['limit'] = $limit;
        }
        if (!is_null($skip)) {
            $options['skip'] = $skip;
        }
        $out = $this->mongoCollection->count($query, $options);
        if ($out === null) {
            return 0;
        }
        $this->getContext()->getLog()->profileEnd($this->profileName . __FUNCTION__);

        return $out;
    }
73629
protected function byteLength($string): int
    {
        if (self::$isMbStringOverload) {
            return mb_strlen($string, '8bit');
        }

        return strlen((binary) $string);
    }
1228597
public function writeLine(string $bytes): int
    {
        $isAcceptable = $this->predicate;
        if ($isAcceptable($bytes)) {
            return $this->outputStream->writeLine($bytes);
        }

        return 0;
    }
1007856
public function read($length = 1024)
    {
        if (!$this->connected) {
            if (!$this->connect()) {
                return false;
            }
        }

        if (!feof($this->connection)) {
            return fread($this->connection, $length);
        } else {
            return false;
        }
    }
433248
protected function getImageSize($url)
    {
        $request = $this->http->get($url, [
            'Range' => 'bytes=0-32768'
        ]);

        if (!$request->success) {
            return false;
        }

        return getimagesizefromstring($request->data);
    }
696460
protected function getByteSize($size)
    {
        if (! preg_match('/(\d+)\s*([tgkmbi]{1,3})/i', $size, $result)) {
            return $size;
        }

        $mapping = $this->mapping[strtolower($result[2])];
        return pow($mapping[0], $mapping[1]) * $result[1];
    }
393815
public function length($min, $max = PHP_INT_MAX)
    {
        return $this->markErrorIf(strlen($this->value) < $min || strlen($this->value) > $max);
    }