original_string: public function listing($contents = array(), $attributes = array(), $element = 'ul', $childElement = 'li')
  		{
  
  			// Create list
  			$list = \HtmlObject\Element::$element('', $attributes);
  
  			// Array?
  			if (!is_null($contents) && !is_array($contents)) {
  				$contents = array($contents);
  			}
  
  			// Loop contents
  			foreach ($contents as $li)  {
  
  				// Is it an element?
  				if (is_string($li)) {
  
  					// Create li containing that...
  					$realLi = \HtmlObject\Element::$childElement($li);
  					$list->addChild($realLi);
  
  				} elseif (is_subclass_of($li, "\\HtmlObject\\Traits\\Tag")) {
  
  					// An li tag?
  					if ($li->getTag() !== $childElement) {
  
  						// Wrap it!
  						$realLi = \HtmlObject\Element::$childElement($li);
  						$list->addChild($realLi);
  
  					} else {
  
  						// Add it as it is
  						$list->addChild($li);
  
  					}
  
  				} else {
  
  					// Not good.
  					throw new \Exception("Invalid contents for listing. ", 1);					
  
  				}
  
  			}
  
  
  
  			return $list;
  
  		}
code: public function listing($contents = array(), $attributes = array(), $element = 'ul', $childElement = 'li')
  		{
  
  			// Create list
  			$list = \HtmlObject\Element::$element('', $attributes);
  
  			// Array?
  			if (!is_null($contents) && !is_array($contents)) {
  				$contents = array($contents);
  			}
  
  			// Loop contents
  			foreach ($contents as $li)  {
  
  				// Is it an element?
  				if (is_string($li)) {
  
  					// Create li containing that...
  					$realLi = \HtmlObject\Element::$childElement($li);
  					$list->addChild($realLi);
  
  				} elseif (is_subclass_of($li, "\\HtmlObject\\Traits\\Tag")) {
  
  					// An li tag?
  					if ($li->getTag() !== $childElement) {
  
  						// Wrap it!
  						$realLi = \HtmlObject\Element::$childElement($li);
  						$list->addChild($realLi);
  
  					} else {
  
  						// Add it as it is
  						$list->addChild($li);
  
  					}
  
  				} else {
  
  					// Not good.
  					throw new \Exception("Invalid contents for listing. ", 1);					
  
  				}
  
  			}
  
  
  
  			return $list;
  
  		}
code_tokens: public function listing ( $ contents = array ( ) , $ attributes = array ( ) , $ element = 'ul' , $ childElement = 'li' ) { // Create list $ list = \ HtmlObject \ Element :: $ element ( '' , $ attributes ) ; // Array? if ( ! is_null ( $ contents ) && ! is_array ( $ contents ) ) { $ contents = array ( $ contents ) ; } // Loop contents foreach ( $ contents as $ li ) { // Is it an element? if ( is_string ( $ li ) ) { // Create li containing that... $ realLi = \ HtmlObject \ Element :: $ childElement ( $ li ) ; $ list -> addChild ( $ realLi ) ; } elseif ( is_subclass_of ( $ li , "\\HtmlObject\\Traits\\Tag" ) ) { // An li tag? if ( $ li -> getTag ( ) !== $ childElement ) { // Wrap it! $ realLi = \ HtmlObject \ Element :: $ childElement ( $ li ) ; $ list -> addChild ( $ realLi ) ; } else { // Add it as it is $ list -> addChild ( $ li ) ; } } else { // Not good. throw new \ Exception ( "Invalid contents for listing. " , 1 ) ; } } return $ list ; }
docstring: Create a new listing
  
  **Simple list**
  <code>
  $this->html->listing(array('item 1', 'item 2', 'item 3'));
  </code>
  <code>
  $this->html->ul(array('item 1', 'item 2', 'item 3'));
  </code>
  <code>
  <ul>
  <li>item 1</li>
  <li>item 2</li>
  <li>item 3</li>
  </ul>
  </code>
  <br>
  
  **Ordered list**
  <code>
  $this->html->listing(array('item 1', 'item 2', 'item 3'), array(), 'ol');
  </code>
  <code>
  $this->html->ol(array('item 1', 'item 2', 'item 3'));
  </code>
  <code>
  <ol>
  <li>item 1</li>
  <li>item 2</li>
  <li>item 3</li>
  </ol>
  </code>
  <br>
  
  **Custom list**
  <code>
  $this->html->listing(array('item 1', 'item 2', 'item 3'), array('class' => 'listing'), 'div', 'span');
  </code>
  <code>
  <div class="listing">
  <span>item 1</span>
  <span>item 2</span>
  <span>item 3</span>
  </div>
  </code>
  
  
  @param  array  		Array of strings or elements to add as list items.
  @param  array  		Attributes to add the to the listing element
  @param  string 		The HTML element to use for the listing.
  @param  string 		The HTML element to use for the list items.
  @return \HtmlObject\Element 	The created element.
docstring_tokens: Create a new listing