public function __construct($dataStore = null, \stdClass $properties = null, array $options = array())
 {
     parent::__construct($dataStore, $properties, $options);
     if ($properties != null) {
         $this->setProperty(self::NEW_ACCOUNT, $properties->newAccount);
         unset($properties->newAccount);
         $account = $this->getDataStore()->instantiate(Stormpath::ACCOUNT, $properties);
         $this->setProperty(self::ACCOUNT, $account);
     }
 }
 protected function setResourceProperty($name, Resource $resource)
 {
     $href = $resource->getHref();
     $properties = new \stdClass();
     $properties->href = $href;
     $this->setProperty($name, $properties);
 }
 public function __construct(InternalDataStore $dataStore = null, \stdClass $properties = null)
 {
     parent::__construct($dataStore, $properties);
     $this->setProperty(self::TYPE, 'basic');
 }
 private function toStdClass(Resource $resource, $customData = false)
 {
     if ($resource instanceof \Stormpath\Resource\CustomData) {
         $customData = true;
     }
     $propertyNames = $resource->getPropertyNames(true);
     $properties = new \stdClass();
     foreach ($propertyNames as $name) {
         $property = $resource->getProperty($name);
         $nameIsCustomData = $name == CustomData::CUSTOMDATA_PROP_NAME;
         if ($property instanceof \Stormpath\Resource\CustomData) {
             $property = $this->toStdClass($property, true);
         } else {
             if ($property instanceof \stdClass && $customData === false && !$nameIsCustomData) {
                 $property = $this->toSimpleReference($name, $property);
             } else {
                 if ($property instanceof \Stormpath\Resource\Resource) {
                     $property = $this->toStdClass($property);
                 }
             }
         }
         $properties->{$name} = $property;
     }
     return $properties;
 }