Returns a new Street from native PHP string name and number.

@param string $name
@param string $number
@param string $elements
@return Street
@throws \BadFunctionCallException
488973
public static function fromNative()
    {
        $args = func_get_args();

        if (\count($args) < 2) {
            throw new \BadMethodCallException('You must provide from 2 to 4 arguments: 1) street name, 2) street number, 3) elements, 4) format (optional)');
        }

        $nameString     = $args[0];
        $numberString   = $args[1];
        $elementsString = isset($args[2]) ? $args[2] : null;
        $formatString   = isset($args[3]) ? $args[3] : null;

        $name     = new StringLiteral($nameString);
        $number   = new StringLiteral($numberString);
        $elements = $elementsString ? new StringLiteral($elementsString) : null;
        $format   = $formatString ? new StringLiteral($formatString) : null;

        return new self($name, $number, $elements, $format);
    }
377882
public function getElement($name)
    {
        $elements = $this->getElements();

        return isset($elements[$name]) ? $elements[$name] : null;
    }
747641
public function getElement($name) {
		if (isset($this->elements[$name])) {
			return $this->elements[$name];
		}
		
		$class = 'ZExt\Mvc\View\Helpers\Head\Element' . ucfirst($name);
		
		$element = new $class(
			$this->getBaseStaticPath(),
			$this->getBaseStaticUrl(),
			$this->getMetadataManager()
		);

		if ($this->isStaticHashAppend() && method_exists($element, 'setHashAppend')) {
			$element->setHashAppend();
		}

		$this->elements[$name] = $element;
		return $element;
	}
53775
static function createElementNodeFromArray( $name, $array )
    {
        $dom = new DOMDocument( '1.0', 'utf-8' );
        $node = $dom->createElement( $name );
        $dom->appendChild( $node );

        foreach ( $array as $arrayKey => $value )
        {
            if ( is_array( $value ) and
                 count( $valueKeys = array_keys( $value ) ) > 0 )
            {
                if ( is_int( $valueKeys[0] ) )
                {
                    foreach( $value as $child )
                    {
                        unset( $childNode );
                        unset( $importedChildNode );
                        $childNode = eZContentObjectPackageHandler::createElementNodeFromArray( $arrayKey, $child );
                        $importedChildNode = $dom->importNode( $childNode, true );
                        $node->appendChild( $importedChildNode );
                    }
                }
                else
                {
                        unset( $valueNode );
                        unset( $importedValueNode );
                        $valueNode = eZContentObjectPackageHandler::createElementNodeFromArray( $arrayKey, $value );
                        $importedValueNode = $dom->importNode( $valueNode, true );
                        $node->appendChild( $importedValueNode );
                }
            }
            else
            {
                $node->setAttribute( $arrayKey, $value );
            }
        }
        return $node;
    }
763691
private function buildElement(string $type, string $name): ElementInterface
    {
        if (class_exists($type)) {
            $element = new $type($name);

            if (! $element instanceof ElementInterface) {
                throw new InvalidClassException(
                    sprintf(
                        'The given type "%s" does not implement %s.',
                        $type,
                        ElementInterface::class
                    )
                );
            }

            return $element;
        }

        if (isset($this->typeToElement[$type])) {
            return new $this->typeToElement[$type]($name);
        }

        throw new UnknownTypeException(
            sprintf(
                'The given type "%s" will not create a valid class which implements "%s"',
                $type,
                ElementInterface::class
            )
        );
    }
887390
public function getReservation($name)
    {
        if (array_key_exists($name, $this->reservations)) {
            return $this->reservations[$name];
        }

        throw new InvalidElementException("Element '{$name}' does not exist");
    }
1100545
public function addElement(FieldsetInterface &$form, $name, $data)
    {
        if ($data['type'] == 'fieldset') {
            $fieldset = new Fieldset(['name' => $name]);
            foreach ($data['elements'] as $key => $def) {
                $this->addElement($fieldset, $key, $def);
            }
            $form->add($fieldset);
        } else {
            if (array_key_exists($data['type'], static::$_elementAlias)) {
                $class = static::$_elementAlias[$data['type']];
            } else if (
                is_subclass_of($data['type'], 'Slick\Form\ElementInterface')
            ) {
                $class = $data['type'];
            } else {
                throw new Exception\UnknownElementException(
                    "'{$data['type']}' is not a known alias or an implementation of " .
                    "Slick\\Form\\ElementInterface interface"
                );
            }

            /** @var Element $element */
            $element = new $class(['name' => $name]);

            if (isset($data['input'])) {
                $element->input = InputFilterFactory::createInput(
                    $data['input'],
                    $element->getName()
                );
            }

            if (!empty($data['validate'])) {
                $this->addValidation($element, $data['validate']);
            }

            foreach (array_keys($this->_elementProperties) as $key) {
                if (isset($data[$key])) {
                    $element->$key = $data[$key];
                }
            }

            $form->add($element);
        }
    }
1021843
static function laraform($name) {
        $el = new ElementSwitchTwbs($name);
        $el->addClass('js-bootstrap-switch')
            ->setOffClass('danger')
            ->setOffLabel('Нет')
            ->setOnClass('success')
            ->setOnLabel('Да')
            ->setSizeSmall();

        return $el;
    }
1048667
public static function __callstatic($name, $params)
    {

        $matches = static::isBackgroundCall($name);

        if (null === $matches) {
            throw new Exception("Unknown background color function name $name");
        }

        $colorName   = $matches[2];
        $knownColors = static::getKnownColors();
        $colorID     = $knownColors[$colorName];

        if (!$colorID) {
            throw new Exception("Unknown background color name $name");
        }

        $color = static::color($colorID);

        // target string is expected to be:
        $targetString = $params[0][0];

        $element = new TextElement($targetString);
        $element->setBackgroundColor($color);

        return $element->render();
    }
60175
public function element($name, array $data = [])
    {
        $view = new View();
        $view->type(self::VIEW_TYPE_ELEMENT);
        $view->set(array_merge($this->viewVars, $data));
        return $view->render($name);
    }
1276941
public function newInstance($name)
    {
        $name = ltrim($name, '\\');
        if (! $this->has($name)) {
            throw new UnexpectedValueException($name);
        }
        return call_user_func($this->callables[$name], $this);
    }
1256322
public function bus($name)
    {
        if ($this->name != 'default') {
            return $this->root->bus($name);
        }

        if (!isset($this->buses[$name])) {
            throw new OutOfBoundsException("Bus '$name' not found.");
        }

        return $this->buses[$name];
    }
339833
public function addElement($element, $name = null, $options = null)
	{
		parent::addElement($element, $name, $options);

		if(!$element instanceof Zend_Form_Element && $name != null)
		{
			$element = $this->getElement($name);
		}
		// An existing instance of a form element was added to the form
		// We need to reset its decorators
		else
		{
			$element->clearDecorators();
			$element->setDecorators($this->_getElementDecorators());
		}

		if($element instanceof Zend_Form_Element_File)
		{
			$decorators = $this->_getElementDecorators();
			$decorators[0] = "File";
			$element->setDecorators($decorators);
		}

		// Special style for Zend
		if($element instanceof Zend_Form_Element_Submit
			|| $element instanceof Zend_Form_Element_Reset
			|| $element instanceof Zend_Form_Element_Button)
		{
			$class = "";

			if($element instanceof Zend_Form_Element_Submit
				&& !($element instanceof Zend_Form_Element_Reset)
			 	&& !($element instanceof Zend_Form_Element_Button))
			{
				$class = "btn-primary";
			}

			$element->setAttrib("class", trim("btn $class " . $element->getAttrib("class")));
			$element->removeDecorator("Label");
			$element->removeDecorator("outerwrapper");
			$element->removeDecorator("innerwrapper");

			$this->_addActionsDisplayGroupElement($element);

			//$element->addDecorator(array(
				//"outerwrapper" => "HtmlTag"), array("tag" => "div", "class" => "actions")
			//);
		}

		if($element instanceof Zend_Form_Element_Checkbox)
		{
			$element->setDecorators(array(
				array(array("labelopening" => "HtmlTag"), array("tag" => "label", "class" => "checkbox", "id" => $element->getId()."-label", "for" => $element->getName(), "openOnly" => true)),
				"ViewHelper",
				array("Checkboxlabel"),
				array(array("labelclosing" => "HtmlTag"), array("tag" => "label", "closeOnly" => true)),
				array("Errors", array("placement" => "append")),
				array("Description", array("tag" => "span", "class" => "help-block")),
				array(array("innerwrapper" => "HtmlTag"), array("tag" => "div", "class" => "controls")),
				array(array("outerwrapper" => "HtmlTag"), array("tag" => "div", "class" => "control-group"))
			));
		}

		if($element instanceof Zend_Form_Element_Radio
			|| $element instanceof Zend_Form_Element_MultiCheckbox)
		{
			$multiOptions = array();
			foreach($element->getMultiOptions() as $value => $label)
			{
				$multiOptions[$value] = " ".$label;
			}

			$element->setMultiOptions($multiOptions);

			$element->setAttrib("labelclass", "checkbox");

			if($element->getAttrib("inline"))
			{
				$element->setAttrib("labelclass", "checkbox inline");
			}

			if ($element instanceof Zend_Form_Element_Radio)
			{
				$element->setAttrib("labelclass", "radio");
			}

			if($element->getAttrib("inline"))
			{
				$element->setAttrib("labelclass", "radio inline");
			}

			$element->setOptions(array("separator" => ""));
			$element->setDecorators(array(
				"ViewHelper",
				array("Errors", array("placement" => "append")),
				array("Description", array("tag" => "span", "class" => "help-block")),
				array(array("innerwrapper" => "HtmlTag"), array("tag" => "div", "class" => "controls")),
				array("Label", array("class" => "control-label")),
				array(array("outerwrapper" => "HtmlTag"), array("tag" => "div", "class" => "control-group"))
			));
		}

		if($element instanceof Zend_Form_Element_Hidden)
		{
			$element->setDecorators(array("ViewHelper"));
		}
		
		if($element instanceof Zend_Form_Element_Textarea && !$element->getAttrib('rows'))
		{
			$element->setAttrib('rows', '3');
		}
		
		if($element instanceof Zend_Form_Element_Captcha)
		{
			$element->removeDecorator("viewhelper");
		}

        return $this;
	}
759184
public function getElement( $name, $prefix = null )
	{
		return $this->hasElement( $name, $prefix )
			? $this->elements[ is_null( $prefix ) ? $name : "$prefix:$name" ]
			: false;
	}
392789
public function addElement($col, $name = null) {
		// Width
		if (is_int($col)) {
			$col = new TableCol([self::ATTR_WIDTH => $col . '%']);
		}
		// Attributes or class
		else if (is_array($col) || is_string($col)) {
			$col = new TableCol($col);
		}
		// Instance
		else if (! $col instanceof TableCol) {
			throw new Exception('Element must be an instance of the TableCol or a array or a string');
		}
		
		return parent::addElement($col, $name);
	}
448263
static function laraform($name, $attributes = null, array $data = []) {
        $el = new ElementSelectTwbs($name, $attributes, $data);
        $el->addClass('form-control');
        return $el;
    }
677603
public function insert($name, $element, $priority)
    {
        return $this->getInstance($name)->insert($element, $priority);
    }