uid = $uid; $this->type = $type; $this->origin = $origin; $this->field = $field; $this->field_primary = $field_primary; $this->failCallback = $failCallback; $this->succCallback = $succCallback; $this->validateType(); } public function validateType() { switch ($this->type) { case "text": $this->storage = new MediaSecureText(); break; case "image": $this->storage = new MediaSecureImage(); break; case "voice": $this->storage = new MediaSecureVoice(); break; } } }