public function get($name, array $vars = [])
	{
		$name = BBCode::normalizeName($name);
		$node = $this->xpath->query('//bbcode[@name="' . $name . '"]')->item(0);
		if (!($node instanceof DOMElement))
		{
			throw new RuntimeException("Could not find '" . $name . "' in repository");
		}

		// Clone the node so we don't end up modifying the node in the repository
		$node = $node->cloneNode(true);

		// Replace all the <var> descendants if applicable
		$this->replaceVars($node, $vars);

		// Now we can parse the BBCode usage and prepare the template.
		// Grab the content of the <usage> element then use BBCodeMonkey to parse it
		$usage    = $this->xpath->evaluate('string(usage)', $node);
		$template = $this->xpath->evaluate('string(template)', $node);
		$config   = $this->bbcodeMonkey->create($usage, $template);

		// Set the optional tag name
		if ($node->hasAttribute('tagName'))
		{
			$config['bbcode']->tagName = $node->getAttribute('tagName');
		}

		// Set the rules
		$this->addRules($node, $config['tag']);

		return $config;
	}
public function get($name, array $vars = [])
	{
		$name = BBCode::normalizeName($name);
		$node = $this->xpath->query('//bbcode[@name="' . $name . '"]')->item(0);
		if (!($node instanceof DOMElement))
		{
			throw new RuntimeException("Could not find '" . $name . "' in repository");
		}

		// Clone the node so we don't end up modifying the node in the repository
		$node = $node->cloneNode(true);

		// Replace all the <var> descendants if applicable
		$this->replaceVars($node, $vars);

		// Now we can parse the BBCode usage and prepare the template.
		// Grab the content of the <usage> element then use BBCodeMonkey to parse it
		$usage    = $this->xpath->evaluate('string(usage)', $node);
		$template = $this->xpath->evaluate('string(template)', $node);
		$config   = $this->bbcodeMonkey->create($usage, $template);

		// Set the optional tag name
		if ($node->hasAttribute('tagName'))
		{
			$config['bbcode']->tagName = $node->getAttribute('tagName');
		}

		// Set the rules
		$this->addRules($node, $config['tag']);

		return $config;
	}
public function get ( $ name , array $ vars = [ ] ) { $ name = BBCode :: normalizeName ( $ name ) ; $ node = $ this -> xpath -> query ( '//bbcode[@name="' . $ name . '"]' ) -> item ( 0 ) ; if ( ! ( $ node instanceof DOMElement ) ) { throw new RuntimeException ( "Could not find '" . $ name . "' in repository" ) ; } // Clone the node so we don't end up modifying the node in the repository $ node = $ node -> cloneNode ( true ) ; // Replace all the <var> descendants if applicable $ this -> replaceVars ( $ node , $ vars ) ; // Now we can parse the BBCode usage and prepare the template. // Grab the content of the <usage> element then use BBCodeMonkey to parse it $ usage = $ this -> xpath -> evaluate ( 'string(usage)' , $ node ) ; $ template = $ this -> xpath -> evaluate ( 'string(template)' , $ node ) ; $ config = $ this -> bbcodeMonkey -> create ( $ usage , $ template ) ; // Set the optional tag name if ( $ node -> hasAttribute ( 'tagName' ) ) { $ config [ 'bbcode' ] -> tagName = $ node -> getAttribute ( 'tagName' ) ; } // Set the rules $ this -> addRules ( $ node , $ config [ 'tag' ] ) ; return $ config ; }
Get a BBCode and its associated tag from this repository

@param  string $name Name of the entry in the repository
@param  array  $vars Replacement variables
@return array        Array with three elements: "bbcode", "name" and "tag"
Get a BBCode and its associated tag from this repository