@param int $total
@param int $index
@param DataObject $record
@param array $attributes
@param string $content

@return string
972562
protected function newCell($total, $index, $record, $attributes, $content)
    {
        return HTML::createTag(
            'td',
            $attributes,
            $content
        );
    }
268948
public function addRecord($record)
    {
        if ((isset($this->DBFHeader)) && (is_array($this->DBFHeader))) {
            $record->updateDBFInfo($this->DBFHeader);
        }

        $this->fileLength += ($record->getContentLength() + 4);
        $this->records[] = $record;
        $this->records[count($this->records) - 1]->recordNumber = count($this->records);

        $this->updateBBox('x', $record->SHPData);
        $this->updateBBox('y', $record->SHPData);

        if (in_array($this->shapeType, [11, 13, 15, 18, 21, 23, 25, 28])) {
            $this->updateBBox('m', $record->SHPData);
        }

        if (in_array($this->shapeType, [11, 13, 15, 18])) {
            $this->updateBBox('z', $record->SHPData);
        }

        return count($this->records) - 1;
    }
128042
public function limit($total, $offset = 0)
    {
        $this->_limit = $total;
        $this->_offset = $offset;
        return $this;
    }
1374139
public function format($id, $recordObj)
    {
        if (!isset($recordObj->metadata)) {
            throw new \Exception("Unexpected missing record metadata.");
        }

        $raw = trim($recordObj->metadata->asXML());

        // Extract the actual metadata from inside the <metadata></metadata> tags;
        // there is probably a cleaner way to do this, but this simple method avoids
        // the complexity of dealing with namespaces in SimpleXML.
        //
        // We should also apply global search and replace at this time, if
        // applicable.
        $record = $this->performGlobalReplace(
            preg_replace('/(^<metadata[^\>]*>)|(<\/metadata>$)/m', '', $raw)
        );

        // Collect attributes (for proper namespace resolution):
        $metadataAttributes = $this->extractMetadataAttributes($raw, $record);

        // If we are supposed to inject any values, do so now inside the first
        // tag of the file:
        $insert = $this->getIdAdditions($id)
            . $this->getHeaderAdditions($recordObj->header);
        $xml = !empty($insert)
            ? preg_replace('/>/', '>' . $insert, $record, 1) : $record;

        // Build the final record:
        return trim(
            $this->fixNamespaces(
                $xml, $recordObj->getDocNamespaces(), $metadataAttributes
            )
        );
    }
162583
public static function tbody(
        string $content = null, 
        array $attributes = []
    ) : string
    {
        return self::tag("tbody", $content, $attributes);
    }
1117891
public final function getPager(int $totalRecords = null, string $startKey = null,
        string $stopKey = null): Pager
    {
        if ($totalRecords !== null) {
            $this->pager->run($totalRecords, $startKey, $stopKey);
        }

        return $this->pager;
    }
428813
private function queryRecords(int $total): array
    {
        $query = DB::table('families')
            ->select(['f_numchil AS total', 'f_id AS id'])
            ->where('f_file', '=', $this->tree->id())
            ->orderBy('total', 'desc')
            ->limit($total);

        return $query->get()->all();
    }
373412
public function format(array $record): string
    {
        if (!empty($this->hostname)) {
            $record["hostname"] = $this->hostname;
        }
        if (!empty($this->appname)) {
            $record["appname"] = $this->appname;
        }

        $record["@marker"] = static::MARKERS;

        return parent::format($record);
    }
974538
public function addRecord($id, $record)
    {
        $this->innerXML .= $record;
        if (false === $this->firstHarvestedId) {
            $this->firstHarvestedId = $id;
        }
    }
708548
public function partition($index, $total)
    {
        $index = (integer) $index;
        $total = (integer) $total;
        if (!$index || !$total || $index > $total) {
            throw new Exception("Invalid partition parameters: {$index}/{$total}");
        }

        $groups = [];
        $partitions = [];
        $partitionsTotal = [];

        for ($i = 0; $i < $total; $i++) {
            $partitions[$i] = [];
            $partitionsTotal[$i] = 0;
        }

        $children = $this->children();

        foreach ($children as $key => $child) {
            $groups[$key] = $child->stats()['normal'];
            $child->enabled(false);
        }
        asort($groups);

        foreach ($groups as $key => $value) {
            $i = array_search(min($partitionsTotal), $partitionsTotal);
            $partitions[$i][] = $key;
            $partitionsTotal[$i] += $groups[$key];
        }

        foreach ($partitions[$index - 1] as $key) {
            $children[$key]->enabled(true);
        }
    }
1002714
public function Configure($Offset, $Limit, $TotalRecords, $Url, $ForceConfigure = FALSE) {
      if ($this->_PropertiesDefined === FALSE || $ForceConfigure === TRUE) {
         $this->Url = $Url;

         $this->Offset = $Offset;         
         $this->Limit = is_numeric($Limit) && $Limit > 0 ? $Limit : $this->Limit;
         $this->TotalRecords = is_numeric($TotalRecords) ? $TotalRecords : 0;
         $this->_Totalled = ($this->TotalRecords >= $this->Limit) ? FALSE : TRUE;
         $this->_LastOffset = $this->Offset + $this->Limit;
         if ($this->_LastOffset > $this->TotalRecords)
            $this->_LastOffset = $this->TotalRecords;
               
         $this->_PropertiesDefined = TRUE;
      }
   }
741937
protected function getListItems($key, $total, $offset = 0)
	{
		$items = array();

		for ($i = $offset; $i < $total; $i++) {
			$items[$i] = $this->database->lindex($key, $i);
		}

		return $items;
	}
593979
private function getTotalCountFromSearchVideosResponse($response)
    {
        $response = json_decode($response, true);
        if (!is_array($response) || !array_key_exists('total', $response)) {
            throw new Exception('Response from search endpoint is missing the "total" key');
        }

        return (int) $response['total'];
    }
662067
public function results($total, $created, $updated, $deleted, $errors) {
        if ($this->outputmode == self::NO_OUTPUT) {
            return;
        }

        $message = array(
            get_string('coursestotal', 'tool_uploadcourse', $total),
            get_string('coursescreated', 'tool_uploadcourse', $created),
            get_string('coursesupdated', 'tool_uploadcourse', $updated),
            get_string('coursesdeleted', 'tool_uploadcourse', $deleted),
            get_string('courseserrors', 'tool_uploadcourse', $errors)
        );

        if ($this->outputmode == self::OUTPUT_PLAIN) {
            foreach ($message as $msg) {
                $this->buffer->output($msg);
            }
        } else if ($this->outputmode == self::OUTPUT_HTML) {
            $buffer = new progress_trace_buffer(new html_list_progress_trace());
            foreach ($message as $msg) {
                $buffer->output($msg);
            }
            $buffer->finished();
        }
    }
298274
private function buildContent(array $record): string
    {
        $dataArray = [
            'notify' => $this->notify ? 'true' : 'false',
            'message' => $record['formatted'],
            'message_format' => $this->format,
            'color' => $this->getAlertColor($record['level']),
        ];

        if (!$this->validateStringLength($dataArray['message'], static::MAXIMUM_MESSAGE_LENGTH)) {
            if (function_exists('mb_substr')) {
                $dataArray['message'] = mb_substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]';
            } else {
                $dataArray['message'] = substr($dataArray['message'], 0, static::MAXIMUM_MESSAGE_LENGTH).' [truncated]';
            }
        }

        // append the sender name if it is set
        // always append it if we use the v1 api (it is required in v1)
        if ($this->name !== null) {
            $dataArray['from'] = (string) $this->name;
        }

        return http_build_query($dataArray);
    }
999835
protected function sumTotalVolume(&$total, array &$item, array $order)
    {
        $product = &$item['product'];

        if (empty($product['width']) || empty($product['height']) || empty($product['length'])) {
            return null;
        }

        if ($product['size_unit'] !== $order['size_unit']) {

            try {
                $product['width'] = $this->convertor->convert($product['width'], $product['size_unit'], $order['size_unit']);
                $product['height'] = $this->convertor->convert($product['height'], $product['size_unit'], $order['size_unit']);
                $product['length'] = $this->convertor->convert($product['length'], $product['size_unit'], $order['size_unit']);

            } catch (Exception $ex) {
                return null;
            }

            $product['size_unit'] = $order['size_unit'];
        }

        $volume = (float) ($product['width'] * $product['height'] * $product['length']);
        $total += (float) ($volume * $item['quantity']);
        return null;
    }
840028
public function getRecord($recordId, $contentTypeName = null, DataDimensions $dataDimensions = null)
    {

        if ($contentTypeName == null)
        {
            $contentTypeName = $this->getCurrentContentTypeName();
        }

        if ($dataDimensions == null)
        {
            $dataDimensions = $this->getCurrentDataDimensions();
        }

        if ($this->hasContentType($contentTypeName))
        {
            if ($this->hasStashedRecord($contentTypeName, $recordId, $dataDimensions))
            {
                return $this->getStashedRecord($contentTypeName, $recordId, $dataDimensions, $this->getRecordClassForContentType($contentTypeName));
            }
            $url = 'content/' . $contentTypeName . '/record/' . $recordId . '/' . $dataDimensions->getWorkspace() . '?language=' . $dataDimensions->getLanguage() . '&view=' . $dataDimensions->getViewName() . '&timeshift=' . $dataDimensions->getTimeShift();;

            try
            {
                $response = $this->getClient()->get($url);
            }
            catch (ClientException $e)
            {
                if ($e->getCode() == 404)
                {
                    return false;
                }
                throw new AnyContentClientException ($e->getMessage());
            }

            $json = $response->json();

            $record = $this->getRecordFactory()
                           ->createRecordFromJSON($this->getContentTypeDefinition($contentTypeName), $json['record']);

            $this->stashRecord($record, $dataDimensions);

            return $record;
        }

        throw new AnyContentClientException ('Unknown content type ' . $contentTypeName);

    }