public function testtoObject()
 {
     $sUT = new Property();
     $sUT->addProperty('test', new Property());
     $sUT->addItem('test', new Item());
     $this->assertInstanceOf('stdClass', $sUT->toObject());
 }
 /**
  * due to the fact that determining property will be so different between 
  * parser types we should probably just define this function here
  * In a JSON string it will be very simple.
  *   enter a string
  *   see what the string looks like
  *     check the maps of types 
  *     see if it fits some semantics  
  * 
  * @param object $property
  * @return Property
  */
 protected function determineProperty($property, $name)
 {
     $baseUrl = $this->configKeyExists('baseUrl') ? $this->getConfigSetting('baseUrl') : null;
     $requiredDefault = $this->configKeyExists('requiredDefault') ? $this->getConfigSetting('requiredDefault') : false;
     $type = StringMapper::map($property);
     if ($type == StringMapper::ARRAY_TYPE) {
         return $this->determineItem($property, $name);
     }
     $prop = new Property();
     $prop->setType($type)->setName($name)->setKey($name)->setRequired($requiredDefault);
     if ($baseUrl) {
         $prop->setId($baseUrl . '/' . $name);
     }
     // since this is an object get the properties of the sub objects
     if ($type == StringMapper::ARRAY_TYPE) {
         $prop->addItem($name, $this->determineItem($property, $name));
     } elseif ($type == StringMapper::OBJECT_TYPE) {
         foreach ($property as $key => $newProperty) {
             $prop->addProperty($key, $this->determineProperty($newProperty, $key));
         }
     }
     return $prop;
 }