Return an instantiated class of HTML
@param string[] $options
@return \mpf\web\request\HTML
2236
public static function get($options = array())
    {
        if (!isset(self::$_instances[md5(serialize($options))])) {
            return new HTML($options);
        }

        return self::$_instances[md5(serialize($options))];
    }
844843
public function render(array $options = array())
    {
        $url = $this->service->generateEmbedUrl($this);
        $options = array_replace(array(
            'width' => 560,
            'height' => 315,
            'frameborder' => 0,
            'allowfullscreen' => ''
        ), $options);

        $html = <<<HTML
<iframe src="$url" width="{$options['width']}" height="{$options['height']}" frameborder="{$options['frameborder']}" {$options['allowfullscreen']}></iframe>
HTML;
        return $html;
    }
1362193
private function getInfoTextLine($options)
    {
        $htmlForm = '';

        if (isset($options['info'])) {
            $class = isset($options['info']['class']) ? $options['info']['class'] : 'info';
            $htmlForm .= '<p class="text-'.$class.' small">'.$options['info']['text'].'</p>';
        }

        return $htmlForm;
    }
919491
public function create(array $options = [])
    {
        $printer = new PrettyPrinter();

        $parser = $this->getParser();

        $options = array_merge(['dir' => true, 'file' => true, 'skip' => false, 'strict' => false], $options);

        $traverser = $this->getTraverser($options['dir'], $options['file'], $options['skip'], $options['strict']);

        return new ClassPreloader($printer, $parser, $traverser);
    }
473991
public static function factory( array $options = null )
    {
        if ( ! empty( $options['type'] ) &&
             empty( $options['subType'] ) &&
             $type = strstr( $options['type'], '.', true ) )
        {
            $options['subType'] = substr( $options['type'], strlen( $type ) + 1 );
            $options['type']    = $type;
        }

        return parent::factory( $options );
    }
371431
public static function ul( $items, $options = [] ) {
		$tag         = ArrayHelper::remove( $options, 'tag', 'ul');
		$encode      = ArrayHelper::remove( $options, 'encode', FALSE );
		$formatter   = ArrayHelper::remove( $options, 'item');
		$separator   = ArrayHelper::remove( $options, 'separator', "\n");
		$itemOptions = ArrayHelper::remove( $options, 'itemOptions', []);
		$classFor    = ArrayHelper::remove( $itemOptions, 'class_for', null );

		if ( empty( $items ) ) {
			return static::tag( $tag, '', $options );
		}
		$results = [];
		foreach ( $items as $i => $item ) {
			if ( $formatter !== NULL ) {
				$results[] = call_user_func( $formatter, $item, $i );
			} else {
				$_itemOptions = $itemOptions;
				if ( isset( $classFor ) && array_key_exists( $i, $classFor ) ) {
					static::addCssClass( $_itemOptions, $classFor[ $i ] );
				}
				$results[] = static::tag('li', $encode ? static::encode( $item ) : $item, $_itemOptions );
			}
		}

		return static::tag( $tag, $separator . join( $separator, $results ) . $separator, $options );
	}
1264459
protected function createForm($options = null)
    {
        $form = parent::createForm($options);

        $form->activateJQuery();

        return $form;
    }
269201
public function open($options = [])
    {
        $attributes = [];

        if ($this->isMode(self::MODE_EDIT)) {
            $this->addHiddenField((new Hidden('_method'))->value('PUT'));
        }

        $this->addRedirectUrlField();

        $attributes['action'] = $this->getAction();
        $attributes['method'] = Arr::get($options, 'method', 'post');
        $attributes['accept-charset'] = 'UTF-8';

        $attributes['class'] = Arr::get($options, 'class');

        if ($this->hasFile()) {
            $attributes['enctype'] = 'multipart/form-data';
        }

        $html = [];
        foreach ($attributes as $name => $value) {
            $html[] = "$name=\"$value\"";
        }

        return '<form '.implode(' ', $html).' pjax-container>';
    }
1124456
public function getSenderClass($options)
	{
		if (empty($options['sender'])) {
			if (function_exists('extension_loaded') && extension_loaded('curl') && PHP_VERSION_ID >= 50300) {
				return /**/
					'Consumerr\Sender\CurlSender' /**/ /*5.2*'Consumerr_CurlSender'*/
					;
			} else {
				return /**/
					'Consumerr\Sender\PhpSender' /**/ /*5.2*'Consumerr_PhpSender'*/
					;
			}
		} else {
			if (isset($this->senderAlias[$options['sender']])) {
				return $this->senderAlias[$options['sender']];
			} else {
				if (!class_exists($options['sender'])) {
					throw new AssertionException("Sender class {$options['sender']} was not found.");
				}

				return $options['sender'];
			}
		}
	}
1073939
public function get($className , array $options = array())  {
        
        $Query = $this->getServiceLocator()->get($className);
        if($this->isValidClass($Query)) {
            return $Query->setServiceLocator($this->getServiceLocator())->setOptions($options);
        }
    }
809317
private function getNodeChildren(array $options)
    {
        /** @noinspection PhpUnusedParameterInspection */
        $options = (new OptionsResolver)->setDefaults([
            'depth'           => 1,
            'refName'         => null,
            'parent'          => null,
            'lang'            => $this->currentLocale->getCurrentLocale(),
            'include_root'    => false,
            'include_hidden'  => false,
            'include_offline' => false,
            'flatten'         => false,
            'limit'           => 0,
        ])
            ->setNormalizer('refName', function ($options, $value) {
                return $value ? (array)$value : [];
            })
            ->setAllowedTypes('parent', ['null', Node::class])
            ->setAllowedTypes('depth', 'integer')
            ->setAllowedTypes('limit', 'integer')
            ->setAllowedTypes('include_root', 'bool')
            ->setAllowedTypes('include_hidden', 'bool')
            ->setAllowedTypes('flatten', 'bool')
            ->resolve($options);

        $qb = $this->nodeRepository
            ->createQueryBuilder('node')
            ->leftJoin('node.nodeTranslations', 'nt', Join::WITH, 'nt.node = node and nt.lang = :lang')
            ->leftJoin('nt.publicNodeVersion', 'nv')
            ->leftJoin('node.parent', 'parent')
            ->select('parent.id as parentId', 'node.id', 'nt.title', 'nt.url', 'nt.lang', 'nv.refId', 'nv.refEntityName', 'node.internalName')
            ->where('nt.lang = :lang')
            ->andWhere('node.deleted = 0')
            ->orderBy('node.lvl, nt.weight')
            ->setParameter('lang', $options['lang']);

        if ($options['limit']) {
            $qb->setMaxResults($options['limit']);
        }

        if (false === $options['include_hidden']) {
            $qb->andWhere('node.hiddenFromNav = 0');
        }

        if (false === $options['include_offline']) {
            $qb->andWhere('nt.online = 1');
        }

        if ($options['refName']) {
            $qb
                ->andWhere('node.refEntityName in (:refName)')
                ->setParameter('refName', $options['refName']);
        }

        $level = 0;
        $nodeId = null;
        if ($options['parent']) {
            /** @var Node $parent */
            $parent = $options['parent'];
            $nodeId = $parent->getId();
            $level = $parent->getLevel();


            $qb->andWhere('node.lft >= :minLeft')
                ->andWhere('node.rgt <= :maxRight')
                ->setParameter('minLeft', $parent->getLeft())
                ->setParameter('maxRight', $parent->getRight());

            if (false === $options['include_root']) {
                $qb->andWhere('node.id != :nodeId')
                    ->setParameter('nodeId', $nodeId);
            }
        }

        if ($options['depth']) {
            $qb->andWhere('node.lvl <= :maxLevel')
                ->setParameter('maxLevel', $level + $options['depth']);
        }

        $children = $qb->getQuery()->getResult();

        $flatten = $options['flatten'];

        /** @noinspection PhpInternalEntityUsedInspection */
        return array_reduce($children, function (TreeBuilder $treeBuilder, $item) use ($nodeId, $flatten) {
            $branch = new Branch($item['title'], $item['id'], $item['url'], $item['lang'], $item['refId'], $item['refEntityName'], $item['internalName']);

            if ($branch->getNodeId() === $nodeId) {
                $item['parentId'] = null;
            } elseif ($flatten) {
                $item['parentId'] = $nodeId;
            }

            return $treeBuilder->add($item['parentId'], $branch);
        }, new TreeBuilder)->getRoot();

    }
654591
public function build($options)
    {
        $container = $this->container;
        $objType = isset($options['type']) ? $options['type'] : self::DEFAULT_TYPE;

        $obj = $this->factory->create($objType, [
            'logger' => $container['logger'],
            'view'   => $container['view']
        ]);
        $obj->setData($options);

        return $obj;
    }
700956
protected static function getColClasses($htmlOptions)
    {
        // todo: why would you want to do this
        $colClasses = array();
        if (isset($htmlOptions['class']) && !empty($htmlOptions['class'])) {
            $classes = explode(' ', $htmlOptions['class']);
            foreach ($classes as $class) {
                if (substr($class, 0, 4) == 'col-') {
                    $colClasses[] = $class;
                }
            }
        }
        return implode(' ', array_unique($colClasses));
    }
962565
public function getOutputFromHtml($html, array $options = array())
    {
        $this->log('Get output from html.');

        $html = $this->getCssConverter()->convertToString($html);
        $html = $this->getJSConverter()->convertToString($html);

        return $this->getGenerator()->getOutputFromHtml($html, $options);
    }
929924
public function getClient(array $options = [])
    {
        if ($this->client) {
            return $this->client;
        }

        $this->client = new Client(
            [
                'base_url' => $this->baseUrl,
                'defaults' => [
                    'headers' => [
                        'Authorization' => 'Bearer ' . $this->accessToken,
                    ]
                ]
            ]
        );

        return $this->client;
    }
134870
public function class($classes): Htmlable
    {
        if ($classes instanceof Collection) {
            $classes = $classes->toArray();
        }

        $attributes = new Attributes();
        $attributes->addClass($classes);

        return new HtmlString(
            $attributes->render()
        );
    }
340497
public static function getInstance(array $scope = [], $options = self::ACTION_ALL)
    {
        if (!is_object(self::$instance)) {
            self::$instance = new static($scope, $options);
        }

        return self::$instance;
    }