update php codegen with better naming convention

This commit is contained in:
William Cheng 2015-03-20 21:56:41 +08:00
parent 92e5574ec1
commit c36e5a96fe
13 changed files with 535 additions and 57 deletions

View File

@ -18,6 +18,9 @@ import org.slf4j.LoggerFactory;
import java.io.File; import java.io.File;
import java.util.*; import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class DefaultCodegen { public class DefaultCodegen {
Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class); Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class);
@ -1060,4 +1063,76 @@ public class DefaultCodegen {
opList.add(co); opList.add(co);
co.baseName = tag; co.baseName = tag;
} }
/* underscore and camelize are copied from Twitter elephant bird
* https://github.com/twitter/elephant-bird/blob/master/core/src/main/java/com/twitter/elephantbird/util/Strings.java
*/
/**
* Underscore the given word.
* @param word The word
* @return The underscored version of the word
*/
public static String underscore(String word) {
String firstPattern = "([A-Z]+)([A-Z][a-z])";
String secondPattern = "([a-z\\d])([A-Z])";
String replacementPattern = "$1_$2";
// Replace package separator with slash.
word = word.replaceAll("\\.", "/");
// Replace $ with two underscores for inner classes.
word = word.replaceAll("\\$", "__");
// Replace capital letter with _ plus lowercase letter.
word = word.replaceAll(firstPattern, replacementPattern);
word = word.replaceAll(secondPattern, replacementPattern);
word = word.replace('-', '_');
word = word.toLowerCase();
return word;
}
public static String camelize(String word) {
return camelize(word, false);
}
public static String camelize(String word, boolean lowercaseFirstLetter) {
// Replace all slashes with dots (package separator)
Pattern p = Pattern.compile("\\/(.?)");
Matcher m = p.matcher(word);
while (m.find()) {
word = m.replaceFirst("." + m.group(1)/*.toUpperCase()*/);
m = p.matcher(word);
}
// Uppercase the class name.
p = Pattern.compile("(\\.?)(\\w)([^\\.]*)$");
m = p.matcher(word);
if (m.find()) {
String rep = m.group(1) + m.group(2).toUpperCase() + m.group(3);
rep = rep.replaceAll("\\$", "\\\\\\$");
word = m.replaceAll(rep);
}
// Replace two underscores with $ to support inner classes.
p = Pattern.compile("(__)(.)");
m = p.matcher(word);
while (m.find()) {
word = m.replaceFirst("\\$" + m.group(2).toUpperCase());
m = p.matcher(word);
}
// Remove all underscores
p = Pattern.compile("(_)(.)");
m = p.matcher(word);
while (m.find()) {
word = m.replaceFirst(m.group(2).toUpperCase());
m = p.matcher(word);
}
if (lowercaseFirstLetter) {
word = word.substring(0, 1).toLowerCase() + word.substring(1);
}
return word;
}
} }

View File

@ -38,7 +38,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
reservedWords = new HashSet<String> ( reservedWords = new HashSet<String> (
Arrays.asList( Arrays.asList(
"int") "__halt_compiler", "abstract", "and", "array", "as", "break", "callable", "case", "catch", "class", "clone", "const", "continue", "declare", "default", "die", "do", "echo", "else", "elseif", "empty", "enddeclare", "endfor", "endforeach", "endif", "endswitch", "endwhile", "eval", "exit", "extends", "final", "for", "foreach", "function", "global", "goto", "if", "implements", "include", "include_once", "instanceof", "insteadof", "interface", "isset", "list", "namespace", "new", "or", "print", "private", "protected", "public", "require", "require_once", "return", "static", "switch", "throw", "trait", "try", "unset", "use", "var", "while", "xor")
); );
additionalProperties.put("invokerPackage", invokerPackage); additionalProperties.put("invokerPackage", invokerPackage);
@ -111,4 +111,42 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
public String toDefaultValue(Property p) { public String toDefaultValue(Property p) {
return "null"; return "null";
} }
@Override
public String toVarName(String name) {
// parameter name starting with number won't compile
// need to escape it by appending _ at the beginning
if (name.matches("^[0-9]")) {
name = "_" + name;
}
// return the name in underscore style
// PhoneNumber => phone_number
return underscore(name);
}
@Override
public String toParamName(String name) {
// should be the same as variable name
return toVarName(name);
}
@Override
public String toModelName(String name) {
// model name cannot use reserved keyword
if(reservedWords.contains(name))
escapeReservedWord(name); // e.g. return => _return
// camelize the model name
// phone_number => PhoneNumber
return camelize(name);
}
@Override
public String toModelFilename(String name) {
// should be the same as the model name
return toModelName(name);
}
} }

View File

@ -58,7 +58,7 @@ class PhpModelTest extends FlatSpec with Matchers {
vars.get(2).baseName should be ("createdAt") vars.get(2).baseName should be ("createdAt")
vars.get(2).complexType should be (null) vars.get(2).complexType should be (null)
vars.get(2).datatype should be ("DateTime") vars.get(2).datatype should be ("DateTime")
vars.get(2).name should be ("createdAt") vars.get(2).name should be ("created_at")
vars.get(2).defaultValue should be ("null") vars.get(2).defaultValue should be ("null")
vars.get(2).baseType should be ("DateTime") vars.get(2).baseType should be ("DateTime")
vars.get(2).hasMore should equal (null) vars.get(2).hasMore should equal (null)

View File

@ -224,12 +224,12 @@ class PetApi {
* getPetById * getPetById
* *
* Find pet by ID * Find pet by ID
* petId, int: ID of pet that needs to be fetched (required) * pet_id, int: ID of pet that needs to be fetched (required)
* *
* @return Pet * @return Pet
*/ */
public function getPetById($petId) { public function getPetById($pet_id) {
// parse inputs // parse inputs
$resourcePath = "/pet/{petId}"; $resourcePath = "/pet/{petId}";
@ -244,9 +244,9 @@ class PetApi {
// path params // path params
if($petId !== null) { if($pet_id !== null) {
$resourcePath = str_replace("{" . "petId" . "}", $resourcePath = str_replace("{" . "petId" . "}",
$this->apiClient->toPathValue($petId), $resourcePath); $this->apiClient->toPathValue($pet_id), $resourcePath);
} }
@ -276,14 +276,14 @@ class PetApi {
* updatePetWithForm * updatePetWithForm
* *
* Updates a pet in the store with form data * Updates a pet in the store with form data
* petId, string: ID of pet that needs to be updated (required) * pet_id, string: ID of pet that needs to be updated (required)
* * name, string: Updated name of the pet (required) * * name, string: Updated name of the pet (required)
* * status, string: Updated status of the pet (required) * * status, string: Updated status of the pet (required)
* *
* @return * @return
*/ */
public function updatePetWithForm($petId, $name, $status) { public function updatePetWithForm($pet_id, $name, $status) {
// parse inputs // parse inputs
$resourcePath = "/pet/{petId}"; $resourcePath = "/pet/{petId}";
@ -298,9 +298,9 @@ class PetApi {
// path params // path params
if($petId !== null) { if($pet_id !== null) {
$resourcePath = str_replace("{" . "petId" . "}", $resourcePath = str_replace("{" . "petId" . "}",
$this->apiClient->toPathValue($petId), $resourcePath); $this->apiClient->toPathValue($pet_id), $resourcePath);
} }
// form params // form params
if ($name !== null) { if ($name !== null) {
@ -331,12 +331,12 @@ class PetApi {
* *
* Deletes a pet * Deletes a pet
* api_key, string: (required) * api_key, string: (required)
* * petId, int: Pet id to delete (required) * * pet_id, int: Pet id to delete (required)
* *
* @return * @return
*/ */
public function deletePet($api_key, $petId) { public function deletePet($api_key, $pet_id) {
// parse inputs // parse inputs
$resourcePath = "/pet/{petId}"; $resourcePath = "/pet/{petId}";
@ -354,9 +354,9 @@ class PetApi {
$headerParams['api_key'] = $this->apiClient->toHeaderValue($api_key); $headerParams['api_key'] = $this->apiClient->toHeaderValue($api_key);
} }
// path params // path params
if($petId !== null) { if($pet_id !== null) {
$resourcePath = str_replace("{" . "petId" . "}", $resourcePath = str_replace("{" . "petId" . "}",
$this->apiClient->toPathValue($petId), $resourcePath); $this->apiClient->toPathValue($pet_id), $resourcePath);
} }
@ -380,14 +380,14 @@ class PetApi {
* uploadFile * uploadFile
* *
* uploads an image * uploads an image
* petId, int: ID of pet to update (required) * pet_id, int: ID of pet to update (required)
* * additionalMetadata, string: Additional data to pass to server (required) * * additional_metadata, string: Additional data to pass to server (required)
* * file, file: file to upload (required) * * file, file: file to upload (required)
* *
* @return * @return
*/ */
public function uploadFile($petId, $additionalMetadata, $file) { public function uploadFile($pet_id, $additional_metadata, $file) {
// parse inputs // parse inputs
$resourcePath = "/pet/{petId}/uploadImage"; $resourcePath = "/pet/{petId}/uploadImage";
@ -402,13 +402,13 @@ class PetApi {
// path params // path params
if($petId !== null) { if($pet_id !== null) {
$resourcePath = str_replace("{" . "petId" . "}", $resourcePath = str_replace("{" . "petId" . "}",
$this->apiClient->toPathValue($petId), $resourcePath); $this->apiClient->toPathValue($pet_id), $resourcePath);
} }
// form params // form params
if ($additionalMetadata !== null) { if ($additional_metadata !== null) {
$formParams['additionalMetadata'] = $this->apiClient->toFormValue($additionalMetadata); $formParams['additionalMetadata'] = $this->apiClient->toFormValue($additional_metadata);
}// form params }// form params
if ($file !== null) { if ($file !== null) {
$formParams['file'] = '@' . $this->apiClient->toFormValue($file); $formParams['file'] = '@' . $this->apiClient->toFormValue($file);

View File

@ -129,12 +129,12 @@ class StoreApi {
* getOrderById * getOrderById
* *
* Find purchase order by ID * Find purchase order by ID
* orderId, string: ID of pet that needs to be fetched (required) * order_id, string: ID of pet that needs to be fetched (required)
* *
* @return Order * @return Order
*/ */
public function getOrderById($orderId) { public function getOrderById($order_id) {
// parse inputs // parse inputs
$resourcePath = "/store/order/{orderId}"; $resourcePath = "/store/order/{orderId}";
@ -149,9 +149,9 @@ class StoreApi {
// path params // path params
if($orderId !== null) { if($order_id !== null) {
$resourcePath = str_replace("{" . "orderId" . "}", $resourcePath = str_replace("{" . "orderId" . "}",
$this->apiClient->toPathValue($orderId), $resourcePath); $this->apiClient->toPathValue($order_id), $resourcePath);
} }
@ -181,12 +181,12 @@ class StoreApi {
* deleteOrder * deleteOrder
* *
* Delete purchase order by ID * Delete purchase order by ID
* orderId, string: ID of the order that needs to be deleted (required) * order_id, string: ID of the order that needs to be deleted (required)
* *
* @return * @return
*/ */
public function deleteOrder($orderId) { public function deleteOrder($order_id) {
// parse inputs // parse inputs
$resourcePath = "/store/order/{orderId}"; $resourcePath = "/store/order/{orderId}";
@ -201,9 +201,9 @@ class StoreApi {
// path params // path params
if($orderId !== null) { if($order_id !== null) {
$resourcePath = str_replace("{" . "orderId" . "}", $resourcePath = str_replace("{" . "orderId" . "}",
$this->apiClient->toPathValue($orderId), $resourcePath); $this->apiClient->toPathValue($order_id), $resourcePath);
} }

View File

@ -25,27 +25,27 @@
class Order implements ArrayAccess { class Order implements ArrayAccess {
static $swaggerTypes = array( static $swaggerTypes = array(
'id' => 'int', 'id' => 'int',
'petId' => 'int', 'pet_id' => 'int',
'quantity' => 'int', 'quantity' => 'int',
'shipDate' => 'DateTime', 'ship_date' => 'DateTime',
'status' => 'string', 'status' => 'string',
'complete' => 'boolean' 'complete' => 'boolean'
); );
static $attributeMap = array( static $attributeMap = array(
'id' => 'id', 'id' => 'id',
'petId' => 'petId', 'pet_id' => 'petId',
'quantity' => 'quantity', 'quantity' => 'quantity',
'shipDate' => 'shipDate', 'ship_date' => 'shipDate',
'status' => 'status', 'status' => 'status',
'complete' => 'complete' 'complete' => 'complete'
); );
public $id; /* int */ public $id; /* int */
public $petId; /* int */ public $pet_id; /* int */
public $quantity; /* int */ public $quantity; /* int */
public $shipDate; /* DateTime */ public $ship_date; /* DateTime */
/** /**
* Order Status * Order Status
*/ */
@ -54,9 +54,9 @@ class Order implements ArrayAccess {
public function __construct(array $data) { public function __construct(array $data) {
$this->id = $data["id"]; $this->id = $data["id"];
$this->petId = $data["petId"]; $this->pet_id = $data["pet_id"];
$this->quantity = $data["quantity"]; $this->quantity = $data["quantity"];
$this->shipDate = $data["shipDate"]; $this->ship_date = $data["ship_date"];
$this->status = $data["status"]; $this->status = $data["status"];
$this->complete = $data["complete"]; $this->complete = $data["complete"];
} }

View File

@ -27,7 +27,7 @@ class Pet implements ArrayAccess {
'id' => 'int', 'id' => 'int',
'category' => 'Category', 'category' => 'Category',
'name' => 'string', 'name' => 'string',
'photoUrls' => 'array[string]', 'photo_urls' => 'array[string]',
'tags' => 'array[Tag]', 'tags' => 'array[Tag]',
'status' => 'string' 'status' => 'string'
); );
@ -36,7 +36,7 @@ class Pet implements ArrayAccess {
'id' => 'id', 'id' => 'id',
'category' => 'category', 'category' => 'category',
'name' => 'name', 'name' => 'name',
'photoUrls' => 'photoUrls', 'photo_urls' => 'photoUrls',
'tags' => 'tags', 'tags' => 'tags',
'status' => 'status' 'status' => 'status'
); );
@ -45,7 +45,7 @@ class Pet implements ArrayAccess {
public $id; /* int */ public $id; /* int */
public $category; /* Category */ public $category; /* Category */
public $name; /* string */ public $name; /* string */
public $photoUrls; /* array[string] */ public $photo_urls; /* array[string] */
public $tags; /* array[Tag] */ public $tags; /* array[Tag] */
/** /**
* pet status in the store * pet status in the store
@ -56,7 +56,7 @@ class Pet implements ArrayAccess {
$this->id = $data["id"]; $this->id = $data["id"];
$this->category = $data["category"]; $this->category = $data["category"];
$this->name = $data["name"]; $this->name = $data["name"];
$this->photoUrls = $data["photoUrls"]; $this->photo_urls = $data["photo_urls"];
$this->tags = $data["tags"]; $this->tags = $data["tags"];
$this->status = $data["status"]; $this->status = $data["status"];
} }

View File

@ -26,47 +26,47 @@ class User implements ArrayAccess {
static $swaggerTypes = array( static $swaggerTypes = array(
'id' => 'int', 'id' => 'int',
'username' => 'string', 'username' => 'string',
'firstName' => 'string', 'first_name' => 'string',
'lastName' => 'string', 'last_name' => 'string',
'email' => 'string', 'email' => 'string',
'password' => 'string', 'password' => 'string',
'phone' => 'string', 'phone' => 'string',
'userStatus' => 'int' 'user_status' => 'int'
); );
static $attributeMap = array( static $attributeMap = array(
'id' => 'id', 'id' => 'id',
'username' => 'username', 'username' => 'username',
'firstName' => 'firstName', 'first_name' => 'firstName',
'lastName' => 'lastName', 'last_name' => 'lastName',
'email' => 'email', 'email' => 'email',
'password' => 'password', 'password' => 'password',
'phone' => 'phone', 'phone' => 'phone',
'userStatus' => 'userStatus' 'user_status' => 'userStatus'
); );
public $id; /* int */ public $id; /* int */
public $username; /* string */ public $username; /* string */
public $firstName; /* string */ public $first_name; /* string */
public $lastName; /* string */ public $last_name; /* string */
public $email; /* string */ public $email; /* string */
public $password; /* string */ public $password; /* string */
public $phone; /* string */ public $phone; /* string */
/** /**
* User Status * User Status
*/ */
public $userStatus; /* int */ public $user_status; /* int */
public function __construct(array $data) { public function __construct(array $data) {
$this->id = $data["id"]; $this->id = $data["id"];
$this->username = $data["username"]; $this->username = $data["username"];
$this->firstName = $data["firstName"]; $this->first_name = $data["first_name"];
$this->lastName = $data["lastName"]; $this->last_name = $data["last_name"];
$this->email = $data["email"]; $this->email = $data["email"];
$this->password = $data["password"]; $this->password = $data["password"];
$this->phone = $data["phone"]; $this->phone = $data["phone"];
$this->userStatus = $data["userStatus"]; $this->user_status = $data["user_status"];
} }
public function offsetExists($offset) { public function offsetExists($offset) {

View File

@ -0,0 +1,60 @@
<?php
/**
* Copyright 2015 Reverb Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* $model.description$
*
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
*
*/
class category implements ArrayAccess {
static $swaggerTypes = array(
'id' => 'int',
'name' => 'string'
);
static $attributeMap = array(
'id' => 'id',
'name' => 'name'
);
public $id; /* int */
public $name; /* string */
public function __construct(array $data) {
$this->id = $data["id"];
$this->name = $data["name"];
}
public function offsetExists($offset) {
return isset($this->$offset);
}
public function offsetGet($offset) {
return $this->$offset;
}
public function offsetSet($offset, $value) {
$this->$offset = $value;
}
public function offsetUnset($offset) {
unset($this->$offset);
}
}

View File

@ -0,0 +1,79 @@
<?php
/**
* Copyright 2015 Reverb Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* $model.description$
*
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
*
*/
class order implements ArrayAccess {
static $swaggerTypes = array(
'id' => 'int',
'pet_id' => 'int',
'quantity' => 'int',
'ship_date' => 'DateTime',
'status' => 'string',
'complete' => 'boolean'
);
static $attributeMap = array(
'id' => 'id',
'pet_id' => 'petId',
'quantity' => 'quantity',
'ship_date' => 'shipDate',
'status' => 'status',
'complete' => 'complete'
);
public $id; /* int */
public $pet_id; /* int */
public $quantity; /* int */
public $ship_date; /* DateTime */
/**
* Order Status
*/
public $status; /* string */
public $complete; /* boolean */
public function __construct(array $data) {
$this->id = $data["id"];
$this->pet_id = $data["pet_id"];
$this->quantity = $data["quantity"];
$this->ship_date = $data["ship_date"];
$this->status = $data["status"];
$this->complete = $data["complete"];
}
public function offsetExists($offset) {
return isset($this->$offset);
}
public function offsetGet($offset) {
return $this->$offset;
}
public function offsetSet($offset, $value) {
$this->$offset = $value;
}
public function offsetUnset($offset) {
unset($this->$offset);
}
}

View File

@ -0,0 +1,79 @@
<?php
/**
* Copyright 2015 Reverb Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* $model.description$
*
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
*
*/
class pet implements ArrayAccess {
static $swaggerTypes = array(
'id' => 'int',
'category' => 'Category',
'name' => 'string',
'photo_urls' => 'array[string]',
'tags' => 'array[Tag]',
'status' => 'string'
);
static $attributeMap = array(
'id' => 'id',
'category' => 'category',
'name' => 'name',
'photo_urls' => 'photoUrls',
'tags' => 'tags',
'status' => 'status'
);
public $id; /* int */
public $category; /* Category */
public $name; /* string */
public $photo_urls; /* array[string] */
public $tags; /* array[Tag] */
/**
* pet status in the store
*/
public $status; /* string */
public function __construct(array $data) {
$this->id = $data["id"];
$this->category = $data["category"];
$this->name = $data["name"];
$this->photo_urls = $data["photo_urls"];
$this->tags = $data["tags"];
$this->status = $data["status"];
}
public function offsetExists($offset) {
return isset($this->$offset);
}
public function offsetGet($offset) {
return $this->$offset;
}
public function offsetSet($offset, $value) {
$this->$offset = $value;
}
public function offsetUnset($offset) {
unset($this->$offset);
}
}

View File

@ -0,0 +1,60 @@
<?php
/**
* Copyright 2015 Reverb Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* $model.description$
*
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
*
*/
class tag implements ArrayAccess {
static $swaggerTypes = array(
'id' => 'int',
'name' => 'string'
);
static $attributeMap = array(
'id' => 'id',
'name' => 'name'
);
public $id; /* int */
public $name; /* string */
public function __construct(array $data) {
$this->id = $data["id"];
$this->name = $data["name"];
}
public function offsetExists($offset) {
return isset($this->$offset);
}
public function offsetGet($offset) {
return $this->$offset;
}
public function offsetSet($offset, $value) {
$this->$offset = $value;
}
public function offsetUnset($offset) {
unset($this->$offset);
}
}

View File

@ -0,0 +1,87 @@
<?php
/**
* Copyright 2015 Reverb Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* $model.description$
*
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
*
*/
class user implements ArrayAccess {
static $swaggerTypes = array(
'id' => 'int',
'username' => 'string',
'first_name' => 'string',
'last_name' => 'string',
'email' => 'string',
'password' => 'string',
'phone' => 'string',
'user_status' => 'int'
);
static $attributeMap = array(
'id' => 'id',
'username' => 'username',
'first_name' => 'firstName',
'last_name' => 'lastName',
'email' => 'email',
'password' => 'password',
'phone' => 'phone',
'user_status' => 'userStatus'
);
public $id; /* int */
public $username; /* string */
public $first_name; /* string */
public $last_name; /* string */
public $email; /* string */
public $password; /* string */
public $phone; /* string */
/**
* User Status
*/
public $user_status; /* int */
public function __construct(array $data) {
$this->id = $data["id"];
$this->username = $data["username"];
$this->first_name = $data["first_name"];
$this->last_name = $data["last_name"];
$this->email = $data["email"];
$this->password = $data["password"];
$this->phone = $data["phone"];
$this->user_status = $data["user_status"];
}
public function offsetExists($offset) {
return isset($this->$offset);
}
public function offsetGet($offset) {
return $this->$offset;
}
public function offsetSet($offset, $value) {
$this->$offset = $value;
}
public function offsetUnset($offset) {
unset($this->$offset);
}
}