00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00024 final class CommonDoctypeDeclaration extends DoctypeDeclaration
00025 {
00026 private $organization = null;
00027
00028 private $type = null;
00029 private $subtype = null;
00030 private $version = null;
00031 private $variant = null;
00032 private $language = null;
00033
00037 public static function create()
00038 {
00039 return new self;
00040 }
00041
00045 public function setOrganization($organization)
00046 {
00047 $this->organization = $organization;
00048
00049 return $this;
00050 }
00051
00052 public function getOrganization()
00053 {
00054 return $this->organization;
00055 }
00056
00060 public function setType($type)
00061 {
00062 $this->type = $type;
00063
00064 return $this;
00065 }
00066
00067 public function getType()
00068 {
00069 return $this->type;
00070 }
00071
00075 public function setSubtype($subtype)
00076 {
00077 $this->subtype = $subtype;
00078
00079 return $this;
00080 }
00081
00082 public function getSubtype()
00083 {
00084 return $this->subtype;
00085 }
00086
00090 public function setVersion($version)
00091 {
00092 $this->version = $version;
00093
00094 return $this;
00095 }
00096
00097 public function getVersion()
00098 {
00099 return $this->version;
00100 }
00101
00105 public function setVariant($variant)
00106 {
00107 $this->variant = $variant;
00108
00109 return $this;
00110 }
00111
00112 public function getVariant()
00113 {
00114 return $this->variant;
00115 }
00116
00120 public function setLanguage($language)
00121 {
00122 $this->language = $language;
00123
00124 return $this;
00125 }
00126
00127 public function getLanguage()
00128 {
00129 return $this->language;
00130 }
00131
00135 public function setFpi($fpi)
00136 {
00137 parent::setFpi($fpi);
00138
00139 preg_match(
00140 '~^-
00141 .' ?([a-z]+)? ?(\d+\.\d+)?'.
00142 ' ?([a-z]+)?
00143 $fpi,
00144 $matches
00145 );
00146
00147 $this->organization = !empty($matches[1]) ? $matches[1] : null;
00148 $this->type = !empty($matches[2]) ? $matches[2] : null;
00149
00150 $this->subtype = !empty($matches[3]) ? $matches[3] : null;
00151 $this->version = !empty($matches[4]) ? $matches[4] : null;
00152 $this->variant = !empty($matches[5]) ? $matches[5] : null;
00153 $this->language = !empty($matches[6]) ? $matches[6] : null;
00154
00155 return $this;
00156 }
00157
00158 public function getFpi()
00159 {
00160 if (!$this->organization)
00161 return null;
00162
00163 return
00164 '-
00165 .($this->subtype ? ' '.$this->subtype : null)
00166 .($this->version ? ' '.$this->version : null)
00167 .($this->variant ? ' '.$this->variant : null)
00168 .'
00169 }
00170 }
00171 ?>