/** * 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(); }
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); }