Horde_Icalendar::setVersion PHP Метод

setVersion() публичный Метод

Sets the version of this component.
public setVersion ( string $version )
$version string A float-like version string.
    public function setVersion($version)
    {
        $this->_oldFormat = $version < 2;
        $this->_version = $version;
    }

Usage Example

Пример #1
0
 /**
  * Sets the value of an attribute.
  *
  * @param string $name     The name of the attribute.
  * @param string $value    The value of the attribute.
  * @param array $params    Array containing any addition parameters for
  *                         this attribute.
  * @param boolean $append  True to append the attribute, False to replace
  *                         the first matching attribute found.
  * @param array $values    Array representation of $value.  For
  *                         comma/semicolon seperated lists of values.  If
  *                         not set use $value as single array element.
  */
 public function setAttribute($name, $value, $params = array(), $append = true, $values = false)
 {
     // Make sure we update the internal format version if
     // setAttribute('VERSION', ...) is called.
     if ($name == 'VERSION') {
         $this->setVersion($value);
         if ($this->_container !== false) {
             $this->_container->setVersion($value);
         }
     }
     if (!$values) {
         $values = array($value);
     }
     $found = false;
     if (!$append) {
         foreach (array_keys($this->_attributes) as $key) {
             if ($this->_attributes[$key]['name'] == Horde_String::upper($name)) {
                 $this->_attributes[$key]['params'] = $params;
                 $this->_attributes[$key]['value'] = $value;
                 $this->_attributes[$key]['values'] = $values;
                 $found = true;
                 break;
             }
         }
     }
     if ($append || !$found) {
         $this->_attributes[] = array('name' => Horde_String::upper($name), 'params' => $params, 'value' => $value, 'values' => $values);
     }
 }