Registers a new element to an enum.

@throws BadMethodCallException if the enum has already been loaded

@param string $name 			the name of the enum being registered
@param mixed  $ctors,... 	zero or more arguments to be passed to the enum's constructor
971542
protected static function register($name/* , ... $ctors */) {
			$key = get_called_class();

			if (static::isDone())
				throw new BadMethodCallException(sprintf('Registration has been halted for %s; cannot add %s to the enum list.',
					$key, $name));

			if (!array_key_exists($key, self::$types))
				self::$types[$key] = array();

			$ctors = func_get_args();
			array_shift($ctors);

			$refl = new ReflectionClass($key);
			$ctor = $refl->getConstructor();
			$ctor->setAccessible(true);

			/** @var Enum $inst */
			$inst = $refl->newInstanceWithoutConstructor();

			$ctor->invokeArgs($inst, $ctors);
			$ctor->setAccessible(false);

			$inst->setName($name);
			$inst->setOrdinal(sizeof(self::$types[$key]));

			self::$types[$key][$name] = $inst;
		}
536157
public function end_element($parser, $name)
    {
        // unset schema status
        if (/*preg_match('/types$/', $name) ||*/
        preg_match('/schema$/', $name)
        ) {
            $this->status = "";
            $this->appendDebug($this->currentSchema->getDebug());
            $this->currentSchema->clearDebug();
            $this->schemas[$this->currentSchema->schemaTargetNamespace][] = $this->currentSchema;
            $this->debug('Parsing WSDL schema done');
        }
        if ($this->status == 'schema') {
            $this->currentSchema->schemaEndElement($parser, $name);
        } else {
            // bring depth down a notch
            $this->depth--;
        }
        // end documentation
        if ($this->documentation) {
            //TODO: track the node to which documentation should be assigned; it can be a part, message, etc.
            //$this->portTypes[$this->currentPortType][$this->currentPortOperation]['documentation'] = $this->documentation;
            $this->documentation = false;
        }
    }
1323351
protected function initialize(string $name): void
    {
        $rawDefault = $this->loadCache('default.raw');
        if (!$rawDefault) {
            $rawDefault = new Endpoint(self::DEFAULT_ENDPOINT);

            foreach ($this->loaders as $loader) {
                $loader->loadDefinitions($rawDefault);
            }

            $this->saveCache('default.raw', $rawDefault);
        }

        if (!isset(self::$endpoints[$name])) {
            //copy from raw to specific endpoint
            self::$endpoints[$name] = new Endpoint($name);
            self::$endpoints[$name]->setTypes($rawDefault->allTypes());
            self::$endpoints[$name]->setMutations($rawDefault->allMutations());
            self::$endpoints[$name]->setQueries($rawDefault->allQueries());
            self::$endpoints[$name]->setSubscriptions($rawDefault->allSubscriptions());

            $this->compile(self::$endpoints[$name]);
        }

        $this->saveCache($name, self::$endpoints[$name]);
    }
1344696
public function setName($name)
    {
        if (in_array($name, MathFunctions::asArray())) {
            $this->name = $name;
        } else {
            $msg = "The name attribute must be a value from the MathFunctions enumeration, '" . $name . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }
1295763
protected function nullableEnum(string $name, array $values): Closure
    {
        $this->createEnum($name, $values);

        return $this->useEnum($name, $name, false);
    }
438152
public function registerResult($name)
    {
        $nodeActionCommand = new NodeActionCommand();
        if (!isset($this->nodeResults[$name])) {
            $this->nodeResults[$name] = array();
        }
        $this->nodeResults[$name][] = $nodeActionCommand;
        return $nodeActionCommand->whenNode($name);
    }
1191235
public static function createByName($name)
    {
        $constants = static::getConstantsByName();

        if (!array_key_exists($name, $constants)) {
            throw new UnexpectedValueException("Name '{$name}' is not exists in the enum constants list " . get_called_class());
        }

        return new static($constants[$name]);
    }
908362
protected function validateEnum ($name, $v)
  {
    $enum = $this->getEnumOf ($name);
    if (is_null ($v) && !$this->isRequired($name))
      return;
    if (array_search ($v, $enum) === false) {
      $list = implode ('</b>, <b>', $enum);
      throw new ComponentException ($this->component,
        "Invalid value for attribute/parameter <b>$name</b>.\nExpected: <b>$list</b>.");
    }
  }
472479
private function addElement($name, $parent = false, $ns = false)
    {
        if ($ns) {
            $el = $this->doc->createElementNS($ns, $name);
        } else {
            $el = $this->doc->createElement($name);
        }
        if ($parent) {
            $parent->appendChild($el);
        }

        return $el;
    }
1168274
protected function loadContext($name = null) {
		if ($name === null) {
			$parts = explode('\\', static::class);
			$name = strtolower(array_pop($parts));
		}

		$context = stream_context_get_options($this->context);
		if (isset($context[$name])) {
			$context = $context[$name];
		} else {
			throw new \BadMethodCallException('Invalid context, "' . $name . '" options not set');
		}
		return $context;
	}
357568
public function clickListElement(string $name): void
    {
        $this->context->getElementByText($name, $this->fields['listElement'])->click();
    }
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;
	}
1255380
public function registerConverter(string $name, ConverterInterface $converter): void
    {
        $this->converters[$name] = $converter;
    }
733925
public function registerPartial($name, $partial = false)
    {
        $partials = [];
        if (is_array($name)) {
            $partials = $name;
        } elseif (is_object($name)) {
            $partials = get_object_vars($name);
        }

        if (count($partials)) {
            $this->registerPhpArray('partial', $partials);
        } elseif ($partial === false) {
            $this->registerJavascriptObject('partial', $name);
        } else {
            $this->register('partial', $name, $partial);
        }
    }
188131
public static function registerPartial($name, $partial)
    {
        Argument::i()
            //Argument 1 must be a string
            ->test(1, 'string')
            //Argument 2 must be a string
            ->test(2, 'string');

        self::$partials[$name] = $partial;
    }
1330195
public function clickListElement(string $name, ?string $contentType = null): void
    {
        $pagination = ElementFactory::createElement($this->context, Pagination::ELEMENT_NAME);
        $elementPositionInTable = $this->getElementPositionInTable($name, $contentType);
        $isElementInTable = (bool) $elementPositionInTable;

        while (!$isElementInTable && $pagination->isNextButtonActive()) {
            $pagination->clickNextButton();
            $elementPositionInTable = $this->getElementPositionInTable($name, $contentType);
            $isElementInTable = (bool) $elementPositionInTable;
        }

        Assert::assertTrue($isElementInTable, sprintf('There\'s no subitem %s on Sub-item list', $name));

        $this->context->findElement(sprintf($this->fields['nthListElement'], $elementPositionInTable))->click();
    }
287378
public function set($name, $value)
    {
        if ($this->signature) {
            throw new \BadMethodCallException('You must unsign before make changes');
        }

        $this->claims[(string) $name] = $this->claimFactory->create($name, $value);

        return $this;
    }