public function set ($name, $val, $validate = TRUE)
	{
		
		// If the attribute doesn't exists
		
		if (!$this->attributeExists ($name))
		{
			throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
		}
		
		// If attribute setter isn't set or is disabled
		
		if (!$this->attributeSet ($name))
		{
			throw new Exception (get_called_class () . '->' . $name . ' attribute set is disabled!');
		}
		
		// If we're validating the value
		
		if ($validate)
		{
			
			// Set friendly name if one exists
			
			$friendlyName	= isset (static::$attributes[$name]['name'])? static::$attributes[$name]['name'] : $name;
			
			// Validate it using the parser method
			
			$this->parser->Validate ($friendlyName, static::$attributes[$name], $val);
			
		}
		
		// Set the attribute value
		
		$this->attributeValues[$name]	= $val;
		
	}
public function set ($name, $val, $validate = TRUE)
	{
		
		// If the attribute doesn't exists
		
		if (!$this->attributeExists ($name))
		{
			throw new Exception (get_called_class () . '->' . $name . ' attribute does not exist!');
		}
		
		// If attribute setter isn't set or is disabled
		
		if (!$this->attributeSet ($name))
		{
			throw new Exception (get_called_class () . '->' . $name . ' attribute set is disabled!');
		}
		
		// If we're validating the value
		
		if ($validate)
		{
			
			// Set friendly name if one exists
			
			$friendlyName	= isset (static::$attributes[$name]['name'])? static::$attributes[$name]['name'] : $name;
			
			// Validate it using the parser method
			
			$this->parser->Validate ($friendlyName, static::$attributes[$name], $val);
			
		}
		
		// Set the attribute value
		
		$this->attributeValues[$name]	= $val;
		
	}
public function set ( $ name , $ val , $ validate = TRUE ) { // If the attribute doesn't exists if ( ! $ this -> attributeExists ( $ name ) ) { throw new Exception ( get_called_class ( ) . '->' . $ name . ' attribute does not exist!' ) ; } // If attribute setter isn't set or is disabled if ( ! $ this -> attributeSet ( $ name ) ) { throw new Exception ( get_called_class ( ) . '->' . $ name . ' attribute set is disabled!' ) ; } // If we're validating the value if ( $ validate ) { // Set friendly name if one exists $ friendlyName = isset ( static :: $ attributes [ $ name ] [ 'name' ] ) ? static :: $ attributes [ $ name ] [ 'name' ] : $ name ; // Validate it using the parser method $ this -> parser -> Validate ( $ friendlyName , static :: $ attributes [ $ name ] , $ val ) ; } // Set the attribute value $ this -> attributeValues [ $ name ] = $ val ; }
Set an attribute value if allowed by attribute setter
@param string $name Attribute name
@param mixed $val Attribute value
@param boolean $validate Whether to validate the value
@throws Exception|Parser\Exception
@return void
Set an attribute value if allowed by attribute setter