StructureSchema.php
Go to the documentation of this file.
00001 <?php 00002 00005 00026 class StructureSchema 00027 { 00029 public $version; 00030 00032 public $propertyX = array(); 00033 00035 public $typeX = array(); 00036 00037 function __construct() { } 00038 00039 function __destruct() { } 00040 00051 public function setVersion($version) 00052 { 00053 $this->version = $version; 00054 } 00055 00070 public function setPropertyX($property, $type, $format, $equivalentPropertyTo, $subPropertyOf) 00071 { $this->addProperty($this->propertyX[$property], $type, $format, $equivalentPropertyTo, $subPropertyOf); } 00072 00073 00086 public function setTypeX($type, $equivalentTypeTo, $subTypeOf) 00087 { $this->addType($this->typeX[$type], $equivalentTypeTo, $subTypeOf); } 00088 00089 private function addProperty(&$property, $type, $format, $equivalentPropertyTo, $subPropertyOf) 00090 { 00091 if(!is_array($property)) 00092 { 00093 $property = array( array ("type" => $type, "format" => $format, "equivalentPropertyTo" => $equivalentPropertyTo, 00094 "subPropertyOf" => $subPropertyOf) ); 00095 } 00096 else 00097 { 00098 array_push($property, 00099 array ("type" => $type, "format" => $format, "equivalentPropertyTo" => $equivalentPropertyTo, 00100 "subPropertyOf" => $subPropertyOf)); 00101 } 00102 } 00103 00104 private function addType(&$type, $equivalentTypeTo, $subTypeOf) 00105 { 00106 if(!is_array($type)) 00107 { 00108 $type = array( array ("equivalentPropertyTo" => $equivalentPropertyTo, "subPropertyOf" => $subPropertyOf) ); 00109 } 00110 else 00111 { 00112 array_push($type, array ("equivalentPropertyTo" => $equivalentPropertyTo, "subPropertyOf" => $subPropertyOf)); 00113 } 00114 } 00115 00116 public function getPropertyTypes($property) 00117 { 00118 // Only one type which is not an array in JSON. 00119 if(!is_array($this->propertyX[$property][0]["type"]) && $this->propertyX[$property][0]["type"] != "") 00120 { 00121 return array( $this->propertyX[$property][0]["type"] ); 00122 } 00123 00124 if(count($this->propertyX[$property][0]["type"]) > 0) 00125 { 00126 return ($this->propertyX[$property][0]["type"]); 00127 } 00128 00129 return (FALSE); 00130 } 00131 } 00132 00134 00135 ?>
