Returns a generated LI tag item
@param array $item the item configuration
@return string the resulting li tag
164345
public function renderItem($item)
    {
        $content = ArrayHelper::getValue($item, 'content', '');
        $caption = ArrayHelper::getValue($item, 'caption');

        if ($caption !== null) {
            $caption = \CHtml::tag('div', array('class' => Enum::ORBIT_CAPTION), $caption);
        }
        return \CHtml::tag('li', array(), $content . $caption);
    }
124716
public function fromItem(Item $item)
    {
        return Comment::createFromArray(array_filter([
            'id' => $item->getId(),
            'source' => $item->get('source'),
            'parent' => $item->get('parent'),
            'author_uuid' => $item->get('author_uuid'),
            'author_name' => $item->get('author_name'),
            'author_email' => $item->get('author_email'),
            'author_avatar' => $item->get('author_avatar'),
            'author_role' => $item->get('author_role'),
            'thumb' => $item->get('thumb'),
            'rating' => $item->get('rating'),
            'content' => $item->get('content'),
            'state' => $item->get('state'),
            'created_at' =>  $item->get('created_at'),
        ]));
    }
398249
protected function getType( $item )
    {
        $type = gettype( $item );
        if ( is_object( $item ) )
            $type .= "[" . get_class( $item ) . "]";

        return $type;
    }
521788
public function renderItem($item)
    {
        if (isset($item['header'])) {
            Html::addCssClass($item['options'], 'header');
            return Html::tag('div', $item['header'], $item['options']);
        } else {
            if (isset($item['url'])) {
                return Html::a($item['label'], Url::to($item['url']), $item['options']);
            } else {
                return Html::tag('div', $item['label'], $item['options']);
            }
        }
    }
221946
public function getAction($item)
    {
        $options = [
            'query' => [
                'item'      => $this->getItemId($item),
                'processor' => $this->getId(),
            ],
        ];
        if ($this->isLinkDialog()) {
            $options['attributes']['class'][] = 'use-ajax';
            $options['attributes']['class'][] = 'minidialog';
            $options['query']['minidialog'] = 1;
            $options['query'] += drupal_get_destination();
        }

        return new Action(
            $this->getLinkTitle(),
            'admin/calista/action-process',
            $options,
            $this->getLinkIcon(),
            $this->getLinkPriority(),
            $this->isLinkPrimary(),
            true,
            false,
            $this->getLinkGroup()
        );
    }
1360284
public function renderItem($item)
    {
        $sectionItem   = array();
        $sectionItem[] = \CHtml::tag(
            'p',
            array('class' => 'title', 'data-section-title' => 'data-section-title'),
            \CHtml::link(ArrayHelper::getValue($item, 'label', 'Section Title'), '#')
        );
        $options       = ArrayHelper::getValue($item, 'options', array());
        Html::addCssClass($options, 'content');
        ArrayHelper::addValue('data-section-content', 'data-section-content', $options);
        $sectionOptions = array();
        if (ArrayHelper::getValue($item, 'active')) {
            ArrayHelper::addValue('class', 'active', $sectionOptions);
        }
        $sectionItem[] = \CHtml::tag('div', $options, ArrayHelper::getValue($item, 'content', 'Section Content'));
        return \CHtml::tag('section', $sectionOptions, implode("\n", $sectionItem));
    }
1177268
protected function getItemLine($item)
    {
        $result = array();

        // @todo: add property source(s) for this item line.
        $this->addPropertySource('item', $item);

        $this->addProductInfo($result);
        $sign = $this->invoiceSource->getSign();

        // @todo: add other tags and available meta tags (* = required):
        // * quantity
        // * unitprice and/or unitpriceinc
        // * vat related tags:
        //     * vatrate and/or vatamount
        //     * vat range tags (call method getVatRangeTags()
        //     * vat rate source
        // - meta-unitprice-recalculate: if admin enters product prices inc vat
        //   (which is normal) then the product price ex vat may be imprecise.
        //   If the exact vat rate is not yet known, it may be recalculated in
        //   the Completor phase.
        // - line totals
        // Should result in something like this:

        // Check for cost price.
        $productPriceEx = $sign * $item->priceEx;
        $precisionEx = 0.01;
        $productVat = $sign * $item->productTax;
        $precisionVat = 0.01;
        $productPriceInc = $sign * $item->priceInc;
        $quantity = $item->quantity;

        // Check for cost price and margin scheme.
        if (!empty($line['costPrice']) && $this->allowMarginScheme()) {
            // Margin scheme:
            // - Do not put VAT on invoice: send price incl VAT as unitprice.
            // - But still send the VAT rate to Acumulus.
            $result[Tag::UnitPrice] = $productPriceInc;
        } else {
            $result += array(
                Tag::UnitPrice => $productPriceEx,
                Meta::UnitPriceInc => $productPriceInc,
                Meta::RecalculatePrice => $productPricesIncludeTax ? Tag::UnitPrice : Meta::UnitPriceInc,
            );
        }
        $result[Tag::Quantity] = $quantity;

        // Add tax info.
        $result += $this->getVatRangeTags($productVat, $productPriceEx, $precisionVat, $precisionEx);

        // @todo: remove property source(s) for this item line.
        $this->removePropertySource('item');

        return $result;
    }
695751
public function renderTitle($item)
    {
        $options = ArrayHelper::merge($this->titleOptions, ArrayHelper::getValue($item, 'titleOptions', []));

        $encode = ArrayHelper::getValue($options, 'encode', true);
        $title = Elements::icon('dropdown') . ($encode ? Html::encode($item['title']) : $item['title']);

        Html::addCssClass($options, 'title');
        if ($item['active']) {
            Html::addCssClass($options, 'active');
        }
        return Html::tag('div', $title, $options);
    }
1238379
public function removeStyle(Item $item)
    {
        $item->setIntro(preg_replace('/(<[^>]+) style=".*?"/i', '$1', $item->getIntro()));
        $item->setContent(preg_replace('/(<[^>]+) style=".*?"/i', '$1', $item->getContent()));

        return $item;
    }
500316
protected function renderItemLink($item)
    {
        $url = ArrayHelper::getValue($item, 'url', '#');
        $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
        $encodeLabel = ArrayHelper::getValue($item, 'encode', $this->encodeLabels);
        $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
        $items = ArrayHelper::getValue($item, 'items');

        $bTagHtml = '';
        if ($items !== null) {
            $bTagIcon = Html::tag('i','',['class'=>'fa fa-angle-left pull-right']);
            $bTagHtml = Html::tag('span', $bTagIcon, $this->defaultDropDownBTagOptions);

        }

        $iconHtml = $this->renderItemIcon($item);
        $label = Html::tag('span', $label, ['class' => 'menu-text']);
        return Html::a($iconHtml . $label . $bTagHtml, $url, $linkOptions);

    }
181554
protected function findOrCreateItem(array $item)
    {
        $object = null;
        // If the table was not truncated to begin with, find current object
        // first
        if (!$this->truncate) {
            if (!empty($this->lookupFields)) {
                $lookupConditions = array();
                foreach ($this->lookupFields as $fieldName) {
                    $lookupConditions[$fieldName] = $item[$fieldName];
                }

                $object = call_user_func($this->lookupMethod, $lookupConditions);
            } else {
                $object = $this->objectRepository->find(current($item));
            }
        }

        if (!$object) {
            return $this->getNewInstance();
        }

        return $object;
    }
509880
protected function getArrayItemsSeparator($item)
    {
        $cfg = $this->file->getRequire($this->configFile);

        if (!$cfg) {
            return $this->defaultSeparator;
        }

        $file = $this->getFileContents();

        $arr = array_get($cfg, $item);

        $lastItem = end($arr);
        $preLastItem = prev($arr);

        if (!$lastItem or !$preLastItem) {
            return $this->defaultSeparator;
        }

        preg_match('/\,/', $file, $matchStart, PREG_OFFSET_CAPTURE, strpos($file, $preLastItem));
        $start = array_get(reset($matchStart), 1);

        $searchEnd = preg_match('/[\'"]/', $file, $matchEnd, PREG_OFFSET_CAPTURE, $start);
        $end = array_get(reset($matchEnd), 1);

        $separator = substr($file, $start, $end - $start);

        // remove comments
        $separator = preg_replace('/\/\/.*/ui', '', $separator);
        $separator = preg_replace('/#.*/ui', '', $separator);
        $separator = preg_replace('/\/\*(.*)\*\//ui', '', $separator);

        return $separator;
    }
184979
public function writeItem(array $item)
    {
        $newNode = $this->xml->createElement($this->rowNodeName);

        //attributes
        if (isset($item['@attributes']) && is_array($item['@attributes'])) {
            foreach ($item['@attributes'] as $key => $value) {
                $attr = $this->xml->createAttribute($key);
                $attr->value = $value;
                $newNode->appendChild($attr);
            }
            unset($item['@attributes']);
        }

        //values
        foreach ($item as $key => $value) {
            $node = $this->xml->createElement($key);
            $node->nodeValue = $value;
            $newNode->appendChild($node);
        }

        $this->rootNode->appendChild($newNode);

        return $this;
    }
1310783
protected function getName($item): string
    {
        $name = $item->name();

        if ($item instanceof Command) {
            return \trim(\str_pad($name, $this->maxCmdName) . ' ' . $item->alias());
        }

        return $this->label($item);
    }
480634
protected function _merge(array $data, array $item) {
		if (!isset($item['id'])) {
			return $data;
		}
		$id = $item['id'];

		$defaults = [
			'ids' => [],
			'translated' => null,
			'flags' => [],
			'comments' => [],
			'occurrences' => []
		];
		$item += $defaults;

		if (isset($item['context']) && $item['context']) {
			$id .= '|' . $item['context'];
		}

		if (!isset($data[$id])) {
			$data[$id] = $item;
			return $data;
		}
		foreach (['ids', 'flags', 'comments', 'occurrences'] as $field) {
			$data[$id][$field] = array_merge($data[$id][$field], $item[$field]);
		}
		if (!isset($data[$id]['translated'])) {
			$data[$id]['translated'] = $item['translated'];
		} elseif (is_array($item['translated'])) {
			$data[$id]['translated'] = (array) $data[$id]['translated'] + $item['translated'];
		}
		return $data;
	}
512774
protected function getInvocation(array $item)
    {
        $invocation = '';

        if (isset($item['class']) && isset($item['type'])) {
            $invocation.= $item['class'].$item['type'];
        }

        $invocation.= $item['function'];
        $invocation.= '(';

        if (isset($item['args'])) {
            $args = [];

            foreach ($item['args'] as $arg) {
                $args[] = $this->varToString($arg);
            }

            $invocation.= implode(', ', $args);
        }

        $invocation.= ')';

        return $invocation;
    }
1074228
public function getItem($item)
	{
		return isset($this->items[$item]) ? $this->items[$item] : false;
	}