IriToUri
@param object $item
@return string
18479
public static function IriToUri( $item )
	{
		if ( $item instanceof Undefined )
		    return "";

		$string = $item . "";

		// This code is taken from https://github.com/rmccue/Requests/blob/master/library/Requests/IRI.php
		if ( ! is_string( $string ) ) {
			return "";
		}
		static $non_ascii;
		if ( ! $non_ascii )
		{
			$non_ascii = implode( '', range( "\x80", "\xFF" ) );
			$non_ascii .= "<> \"{}|\^`\n";
		}
		$position = 0;
		$strlen = strlen( $string );
		while ( ( $position += strcspn( $string, $non_ascii, $position ) ) < $strlen )
		{
			$string = substr_replace( $string, sprintf( '%%%02X', ord( $string[ $position ] ) ), $position, 1 );
			$position += 3;
			$strlen += 2;
		}

		return $string;
	}
992926
public function getCatalogItem(array $item)
    {
        $sources = [$this->browser->getHost().$item['url']];
        if (!empty($item['world_art_id'])) {
            $sources[] = str_replace('#ID#', $item['world_art_id'], self::WORLD_ART_URL);
        }
        if (!empty($item['myanimelist_id'])) {
            $sources[] = str_replace('#ID#', $item['myanimelist_id'], self::MY_ANIME_LIST_URL);
        }
        if (!empty($item['ani_db_id'])) {
            $sources[] = str_replace('#ID#', $item['ani_db_id'], self::ANI_DB_URL);
        }
        /* @var $source \AnimeDb\Bundle\CatalogBundle\Entity\Source|null */
        $source = $this->repository->findOneBy(['url' => $sources]);
        if ($source instanceof Source) {
            return $source->getItem();
        }
        return null;
    }
632931
private function getProductType($item)
    {
        $type = '';
        if ($item instanceof OrderItem) {
            $type = $item->getInternalOrderInfo()->getItemType();
        } elseif ($item instanceof Product) {
            $type = $item->getTypeId();
        } elseif ($item instanceof QuoteItem) {
            $type = $item->getProduct()->getTypeId();
        }

        if (empty($type)) {
            throw new \Exception('Did not recognize the passed object: ' . get_class($item));
        }

        return $type;
    }
1173332
protected function prepareItem($item)
    {
        if (!isset($item["type"])) {
            return $item;
        }

        if (isset($item["children"])) {
            $item["children"] = $this->prepareItems($item["children"]);
        }

        switch ($item['type']) {
            case 'select':
                if (isset($item['sql'])) {
                    $connectionName = isset($item['connection']) ? $item['connection'] : 'default';
                    $sql            = $item['sql'];
                    $options        = isset($item["options"]) ? $item["options"] : array();

                    unset($item['sql']);
                    unset($item['connection']);
                    /** @var Connection $connection */
                    $connection = $this->container->get("doctrine.dbal.{$connectionName}_connection");
                    $all        = $connection->fetchAll($sql);
                    foreach ($all as $option) {
                        $options[] = array(reset($option), end($option));
                    }
                    $item["options"] = $options;
                }

                if (isset($item['service'])) {
                    $serviceInfo = $item['service'];
                    $serviceName = isset($serviceInfo['serviceName']) ? $serviceInfo['serviceName'] : 'default';
                    $method      = isset($serviceInfo['method']) ? $serviceInfo['method'] : 'get';
                    $args        = isset($serviceInfo['args']) ? $item['args'] : '';
                    $service     = $this->container->get($serviceName);
                    $options     = $service->$method($args);

                    $item['options'] = $options;
                }

                if (isset($item['dataStore'])) {
                    $dataStoreInfo = $item['dataStore'];
                    $dataStore     = $this->container->get('data.source')->get($dataStoreInfo["id"]);
                    $options       = array();
                    foreach ($dataStore->search() as $dataItem) {
                        $options[ $dataItem->getId() ] = $dataItem->getAttribute($dataStoreInfo["text"]);
                    }
                    if (isset($item['dataStore']['popupItems'])) {
                        $item['dataStore']['popupItems'] = $this->prepareItems($item['dataStore']['popupItems']);
                    }
                    $item['options'] = $options;
                }
                break;
        }
        return $item;
    }
394777
protected function getItemOptions($item)
    {
        $options = '';
        if ($orderOptions = $this->getItemOrderOptions($item)) {
            foreach ($orderOptions as $_option) {
                if (strlen($options) > 0) {
                    $options .= ', ';
                }
                $options .= $_option['label'].': '.$_option['value'];
            }
        }
        return $options;
    }
427484
protected function renderItemIcon($item)
    {
        $iconClass = ArrayHelper::getValue($item, 'icon');
        if ($iconClass !== null) {
            $class = [$this->iconClass];
            Html::addCssClass($class, $iconClass);
            return Html::tag('i', '', ['class' => $class]);
        } else {
            return '';
        }
    }
1211317
protected function renderItem($item)
    {
        $item['label'] = $this->encodeLabels ? Html::encode($item['label']) : $item['label'];

        $options = ArrayHelper::getValue($item, 'options', $this->itemOptions);
        Html::addCssClass($options, 'section');

        if (isset($item['url'])) {
            $link = Html::a($item['label'], $item['url'], $options);
        } else {
            Html::addCssClass($options, 'active');
            $link = Html::tag('div', $item['label'], $options);
        }
        return $link;
    }
290061
public function addItem($item){
		$itemO=$this->getItemToAdd($item);
		$this->addContent($itemO);
		return $itemO;
	}
772517
public function getUrlFor($item)
    {
        $routeGenerator = $this->routerGenerator;
        if (is_callable($routeGenerator)) {
            return $routeGenerator($item);
        }

        return null;
    }
677174
public function getEditUrlFor($item)
    {
        $params = array('id' => $item->getId(), 'popup' => $this->getPopupId());
        $params = array_merge($params, $this->getExtraParameters());

        return array(
            'path' => 'kunstmaanleadgenerationbundle_admin_rule_abstractrule_edit',
            'params' => $params,
        );
    }
225116
public static function menuLink($item)
    {
        $app = \JFactory::getApplication();
        $menu = $app->getMenu();
        $item = $menu->getItem($item);

        return \JRoute::_($item->link . '&Itemid=' . $item->id);
    }
476837
public function __item($item = null)
    {
        $result = parent::__item($item);
        $result['content'] = true;
        return $result;
    }
728318
public static function writeArrayItem($item)
    {
        $str = '';
        try {
            $str .= serialize($item);
        } catch (\Exception $e) {
            if (is_object($item)) {
                $str .= get_class($item).'#';
            }
            $str .= spl_object_hash($item);
        }
        return $str;
    }
824324
protected function implicitKey(DataObject $item)
    {
        if ($item instanceof ChangeSetItem) {
            return $item->ObjectClass . '.' . $item->ObjectID;
        }
        return $item->baseClass() . '.' . $item->ID;
    }
280667
public function renderItem( $item ) {

        $label      = null;
        $url        = isset( $item[ 'url' ] ) ? $item[ 'url' ] : null;
		$urlOptions	= isset( $item[ 'urlOptions' ] ) ? $item[ 'urlOptions' ] : null;
        $options    = [];

		// Check whether label is required
		if( $this->label ) {

	        if( !isset( $item[ 'label' ] ) ) {

	            throw new InvalidConfigException( "The 'label' option is required." );
	        }

	        $label = $item[ 'label' ];
		}

		// Check whether icon is required
		if( $this->icon ) {

	        if( !isset( $item[ 'icon' ] ) ) {

	            throw new InvalidConfigException( "The 'icon' option is required." );
	        }

			$icon	= Html::tag( 'i', null, [ 'class' =>  $item[ 'icon' ] ] );
			$label	= "<span class='wrap-icon'>$icon</span><span class='wrap-text'>$label</span>";
		}

		if( isset( $item[ 'options' ] ) ) {

			$options = $item[ 'options' ];
		}

		if( isset( $url ) ) {

			$link = Html::a( $label, $url, $urlOptions );
		}

		// Custom Links
		if( isset( $options[ 'action' ] ) ) {

			$urlOptions[ 'link' ] = $url;

			$link = Html::tag( 'span', $label, $urlOptions );
		}

		// Custom HTML
		if( isset( $options[ 'html' ] ) ) {

			$link = $options[ 'html' ];

			unset( $options[ 'html' ] );
		}

        return Html::tag( 'li', $link, $options );
    }
615502
public function render($item = -1)
	{
		if (!$this->isEnabled()) {
			return;
		}

		return $this->view->make('googlmapper::mapper')
			->withView($this->view)
			->withOptions($this->generateRenderOptions($item))
			->withItems($item > -1 ? [$item => $this->getItem($item)] : $this->getItems())
			->render();
	}
293020
public function getViewUrlFor($item)
    {
        if (is_object($item)) {
            $id = $item->getid();
        } else {
            $id = $item['id'];
        }
        $params = ['id' => $id];
        $params = array_merge($params, $this->getExtraParameters());

        return [
            'path' => $this->getPathByConvention($this::SUFFIX_VIEW),
            'params' => $params,
        ];
    }