Private/Polyfony/Element.php
public function set($attribute, $value=null) :self {
		// array is passed
		if(is_array($attribute)) {
			// for each associative value in the array
			foreach($attribute as $single_attribute => $single_value) {
				// recurse with a single pair or attribute/value
				$this->set($single_attribute, $single_value);
			}
			// return self
			return($this);
		}
		// specific case of text
		if($attribute == 'text') {
			// use the setter
			$this->setText($value);
		}
		// specific case of html
		elseif($attribute == 'html') {
			// use the setter
			$this->setHtml($value);
		}
		// specific case of style
		elseif($attribute == 'style' && is_array($value)) {
			// use the setter
			$this->setStyle($value);
		}
		// specific case of value
		elseif($attribute == 'value') {
			// use the setter
			$this->setValue($value);
		}
		// any normal attribute
		else {
			// if the value is an array we assemble its content or we set directly
			$this->attributes[$attribute] = is_array($value) ? implode(' ', $value) : $value;
		}
		// return self
		return($this);
	}
public function set($attribute, $value=null) :self {
		// array is passed
		if(is_array($attribute)) {
			// for each associative value in the array
			foreach($attribute as $single_attribute => $single_value) {
				// recurse with a single pair or attribute/value
				$this->set($single_attribute, $single_value);
			}
			// return self
			return($this);
		}
		// specific case of text
		if($attribute == 'text') {
			// use the setter
			$this->setText($value);
		}
		// specific case of html
		elseif($attribute == 'html') {
			// use the setter
			$this->setHtml($value);
		}
		// specific case of style
		elseif($attribute == 'style' && is_array($value)) {
			// use the setter
			$this->setStyle($value);
		}
		// specific case of value
		elseif($attribute == 'value') {
			// use the setter
			$this->setValue($value);
		}
		// any normal attribute
		else {
			// if the value is an array we assemble its content or we set directly
			$this->attributes[$attribute] = is_array($value) ? implode(' ', $value) : $value;
		}
		// return self
		return($this);
	}
public function set ( $ attribute , $ value = null ) : self { // array is passed if ( is_array ( $ attribute ) ) { // for each associative value in the array foreach ( $ attribute as $ single_attribute => $ single_value ) { // recurse with a single pair or attribute/value $ this -> set ( $ single_attribute , $ single_value ) ; } // return self return ( $ this ) ; } // specific case of text if ( $ attribute == 'text' ) { // use the setter $ this -> setText ( $ value ) ; } // specific case of html elseif ( $ attribute == 'html' ) { // use the setter $ this -> setHtml ( $ value ) ; } // specific case of style elseif ( $ attribute == 'style' && is_array ( $ value ) ) { // use the setter $ this -> setStyle ( $ value ) ; } // specific case of value elseif ( $ attribute == 'value' ) { // use the setter $ this -> setValue ( $ value ) ; } // any normal attribute else { // if the value is an array we assemble its content or we set directly $ this -> attributes [ $ attribute ] = is_array ( $ value ) ? implode ( ' ' , $ value ) : $ value ; } // return self return ( $ this ) ; }
set everything, mostly attribute but also content
set everything mostly attribute but also content