Exemplo n.º 1
0
 /**
  * Opens the Tag.
  *
  * @return string|null
  */
 public function open()
 {
     $this->isOpened = true;
     // If self closing, put value as attribute
     foreach ($this->injectProperties() as $attribute => $property) {
         if (!$this->isSelfClosing && $attribute == 'value') {
             continue;
         }
         if (is_null($property) && !is_empty($property)) {
             continue;
         }
         $this->attributes[$attribute] = $property;
     }
     // Invisible tags
     if (!$this->element) {
         return;
     }
     return '<' . $this->element . Helpers::parseAttributes($this->attributes) . $this->getTagCloser();
 }
Exemplo n.º 2
0
 public function testCanIgnoreNullAttributesWhenNecessary()
 {
     $attributes = array('min' => 0, 'max' => 0, 'value' => 0, 'required' => 0);
     $attributes = Helpers::parseAttributes($attributes);
     $this->assertEquals(' min="0" max="0" value="0"', $attributes);
 }