Creates a detailed pairing (key + value)

@staticvar int $count
@param string $label
@param string $value
@return string
424462
protected function backup_detail_pair($label, $value) {
        static $count = 0;
        $count ++;
        $html  = html_writer::start_tag('div', array('class' => 'detail-pair'));
        $html .= html_writer::tag('label', $label, array('class' => 'detail-pair-label', 'for' => 'detail-pair-value-'.$count));
        $html .= html_writer::tag('div', $value, array('class' => 'detail-pair-value pl-2', 'name' => 'detail-pair-value-'.$count));
        $html .= html_writer::end_tag('div');
        return $html;
    }
472884
public function merge(string $variable = null, array $labels = []): self
    {
        $query = new self;
        $query->clauses = $this->clauses->add(
            new Clause\MergeClause(
                Clause\Expression\Path::startWithNode($variable, $labels)
            )
        );

        return $query;
    }
217174
protected function getLabel($key, $value)
    {
        
        if ($this->labelsCache === null) { 
            $this->prepareCacheLabels();
        }
        
        return $this->labelsCache[$key]($value);
    }
500858
protected final function add_response($count, $label = null, $required = false) {
        if ($label === null) {
            $label = get_string('response', 'lesson');
        }
        $this->_form->addElement('editor', 'response_editor['.$count.']', $label,
                 array('rows' => '4', 'columns' => '80'),
                 array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $this->_customdata['maxbytes']));
        $this->_form->setType('response_editor['.$count.']', PARAM_RAW);
        $this->_form->setDefault('response_editor['.$count.']', array('text' => '', 'format' => FORMAT_HTML));

        if ($required) {
            $this->_form->addRule('response_editor['.$count.']', get_string('required'), 'required', null, 'client');
        }
    }
1023358
private function pushValue($value, &$result, $countCol)
    {
        $buildRow = function (&$list, $itemId, $row) use ($countCol) {
            for ($i = count($list); $i < $countCol; $i++) {
                $list[$i] = [
                    'tstamp'  => 0,
                    'value'   => '',
                    'att_id'  => $this->get('id'),
                    'row'     => $row,
                    'col'     => $i,
                    'item_id' => $itemId,
                ];
            }
        };

        $itemId = $value['item_id'];
        if (!isset($result[$itemId])) {
            $result[$itemId] = [];
        }

        // Prepare all rows up until to this item.
        $row = count($result[$itemId]);
        while ($row <= $value['row']) {
            if (!isset($result[$itemId][$row])) {
                $result[$itemId][$row] = [];
            }
            $buildRow($result[$itemId][$row], $itemId, $row);
            $row++;
        }
        $result[$itemId][(int) $value['row']][(int) $value['col']] = $value;
    }
1234169
public static function lowerLabel($value, array $labels)
    {
        ksort($labels);

        foreach ($labels as $max => $label) {
            if ($value <= $max) {
                return $label;
            }
        }

        return end($labels);
    }
104661
public function addMultiField($label = null, $meta = array())
    {
        if (!array_key_exists("dynamic", $meta)) {
            $meta["dynamic"] = $this->__dynamic;
        }

        // *** Overwrite dynamic settings. We cannot have a dynamic multifield inside a dynamic area.
        if ($this->__dynamic) {
            $meta["dynamic"] = $this->__dynamic;
            $meta["dynamicLabel"] = "";
        }

        $objField = new MultiField($label, $meta);

        $objField->setRequiredStyle($this->__requiredstyle);
        $objField->setMeta("parent", $this, true);

        $this->__fields->addObject($objField);

        return $objField;
    }
118655
protected final function add_answer($count, $label = null, $required = false, $format= '') {
        if ($label === null) {
            $label = get_string('answer', 'lesson');
        }

        if ($format == LESSON_ANSWER_HTML) {
            $this->_form->addElement('editor', 'answer_editor['.$count.']', $label,
                    array('rows' => '4', 'columns' => '80'),
                    array('noclean' => true, 'maxfiles' => EDITOR_UNLIMITED_FILES, 'maxbytes' => $this->_customdata['maxbytes']));
            $this->_form->setType('answer_editor['.$count.']', PARAM_RAW);
            $this->_form->setDefault('answer_editor['.$count.']', array('text' => '', 'format' => FORMAT_HTML));
        } else {
            $this->_form->addElement('text', 'answer_editor['.$count.']', $label,
                    array('size' => '50', 'maxlength' => '200'));
            $this->_form->setType('answer_editor['.$count.']', PARAM_TEXT);
        }

        if ($required) {
            $this->_form->addRule('answer_editor['.$count.']', get_string('required'), 'required', null, 'client');
        }
    }
519600
public function addSecondaryField(string $label, string $value): self
    {
        $this->secondaryFields[] = $this->setLabelValue($label, $value);

        return $this;
    }
889443
public function criteriaSummaryText(&$label, &$value)
    {
        $label = "";
        $value = "";
        $name = $this->query_name;

        if (isset($this->criteria_summary) && $this->criteria_summary) {
            $label = $this->deriveAttribute("column_title", $this->query_name);
            $value = $this->criteria_summary;
        } else {
            if (ReporticoUtility::getRequestItem($this->query_name . "_FROMDATE_DAY", "")) {
                $label = $this->deriveAttribute("column_title", $this->query_name);
                $label = ReporticoLang::translate($label);
                $mth = ReporticoUtility::getRequestItem($name . "_FROMDATE_MONTH", "") + 1;
                $value = ReporticoUtility::getRequestItem($name . "_FROMDATE_DAY", "") . "/" .
                $mth . "/" .
                ReporticoUtility::getRequestItem($name . "_FROMDATE_YEAR", "");
                if (ReporticoUtility::getRequestItem($name . "_TODATE_DAY", "")) {
                    $mth = ReporticoUtility::getRequestItem($name . "_TODATE_MONTH", "") + 1;
                    $value .= "-";
                    $value .= ReporticoUtility::getRequestItem($name . "_TODATE_DAY", "") . "/" .
                    $mth . "/" .
                    ReporticoUtility::getRequestItem($name . "_TODATE_YEAR", "");
                }
            } else if (ReporticoUtility::getRequestItem("MANUAL_" . $name . "_FROMDATE", "")) {
                $label = $this->deriveAttribute("column_title", $this->query_name);
                $label = ReporticoLang::translate($label);
                $value = ReporticoUtility::getRequestItem("MANUAL_" . $name . "_FROMDATE", "");
                if (ReporticoUtility::getRequestItem("MANUAL_" . $name . "_TODATE", "")) {
                    $value .= "-";
                    $value .= ReporticoUtility::getRequestItem("MANUAL_" . $name . "_TODATE");
                }

            } else if (ReporticoUtility::getRequestItem("HIDDEN_" . $name . "_FROMDATE", "")) {
                $label = $this->deriveAttribute("column_title", $this->query_name);
                $label = ReporticoLang::translate($label);
                $value = ReporticoUtility::getRequestItem("HIDDEN_" . $name . "_FROMDATE", "");
                if (ReporticoUtility::getRequestItem("HIDDEN_" . $name . "_TODATE", "")) {
                    $value .= "-";
                    $value .= ReporticoUtility::getRequestItem("HIDDEN_" . $name . "_TODATE");
                }

            } else if (ReporticoUtility::getRequestItem("EXPANDED_" . $name, "")) {
                $label = $this->deriveAttribute("column_title", $this->query_name);
                $label = ReporticoLang::translate($label);
                $value .= implode(ReporticoUtility::getRequestItem("EXPANDED_" . $name, ""), ",");
            } else if (ReporticoUtility::getRequestItem("MANUAL_" . $name, "")) {
                $label = $this->deriveAttribute("column_title", $this->query_name);
                $label = ReporticoLang::translate($label);
                $value .= ReporticoUtility::getRequestItem("MANUAL_" . $name, "");
            }
        }
    }
710103
protected function addAttr($label, $value, &$attr)
    {
        if (!isset($attr[$label])) {
            $attr[$label] = '';
        } else {
            $attr[$label] .= ' ';
        }
        $attr[$label] .= $value;

        return $this;
    }
300477
public static function appendLabel($uri, $label)
    {
        $host = new Host(self::filterUri($uri)->getHost());
        if ($host->isDomain()) {
            return $uri->withHost((string) (new Domain($host))->append($label));
        }

        if ($host->isIpv4()) {
            $label = ltrim((string) new Host($label), '.');

            return $uri->withHost((string) $host->withContent($host->getContent().'.'.$label));
        }

        throw new SyntaxError(sprintf('The URI host %s can not be appended', (string) $host));
    }
1338872
public static function count($count, array $options = []) {

        // TODO: Refactor the options to a dedicated config file.
        $classes = Arr::get($options, 'classes', [
            'positive' => 'label label-info',
            'zero'     => 'label label-default',
            'negative' => 'label label-danger',
        ]);

        return static::generate($count, [
            'class' => $count > 0 ? $classes['positive'] : ($count < 0 ? $classes['negative'] : $classes['zero'])
        ]);
    }
1184689
private function addItem($value, $label, $parentKey = null)
    {
        if ($parentKey) {
            $this->items[$parentKey][$value] = $label;
        } else {
            $this->items[$value] = $label;
        }
    }
188123
public function count($folder, $label = null, $read = 1)
    {
        return $this->repository
            ->pushCriteria(new MessageResourceCriteria($folder, $label, $read))
            ->mailCount();
    }
195803
public function createLink($label, $href = null)
    {
        $link = new Link($label, $href);

        if ( ! $this->links instanceof ArrayIterator) {
            $this->links = new ArrayIterator();
        }

        $this->links->push($link);
    }
508674
public function label($label = null)
    {
        if (null === $label) {
            return $this->label;
        }
        $this->label = $label;

        return $this;
    }