php-laravel, enum models, nullable and default values (#12480)

* + support for enum models & separating mustache templates for enums and generics
+ extract property 'type' and 'default value' from a #ref to an enum model
+ support for `PascalCase` naming convention for PHP generators
+ use a default value for known basic types when they are not nullable
+ use 'null' as default value for nullable types when they do not specify the default value
+ use defined constant path as enum default value when found

* + sample output update

* + change model fields to be public and acessible from outside

* + sample output update

Co-authored-by: Mostafa Aghajani <mostafa.aghajani@virta.global>
This commit is contained in:
William Cheng 2022-05-27 11:16:26 +08:00 committed by GitHub
parent 5307a8dafd
commit 76eddeb713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
54 changed files with 427 additions and 165 deletions

View File

@ -408,6 +408,8 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg
// return the name in camelCase style
// phone_number => phoneNumber
name = camelize(name, true);
} else if ("PascalCase".equals(variableNamingConvention)) {
name = camelize(name, false);
} else { // default to snake case
// return the name in underscore style
// PhoneNumber => phone_number

View File

@ -18,12 +18,16 @@
package org.openapitools.codegen.languages;
import org.openapitools.codegen.CodegenOperation;
import org.openapitools.codegen.CodegenProperty;
import org.openapitools.codegen.CodegenType;
import org.openapitools.codegen.SupportingFile;
import org.openapitools.codegen.meta.features.*;
import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap;
import org.openapitools.codegen.utils.ModelUtils;
import io.swagger.v3.oas.models.media.Schema;
import java.io.File;
import java.util.*;
@ -296,4 +300,96 @@ public class PhpLaravelServerCodegen extends AbstractPhpCodegen {
return camelize(name, false) + "Controller";
}
@Override
protected String getEnumDefaultValue(String defaultValue, String dataType) {
return defaultValue;
}
@Override
public CodegenProperty fromProperty(String name, Schema p) {
CodegenProperty property = super.fromProperty(name, p);
Schema referencedSchema = ModelUtils.getReferencedSchema(this.openAPI, p);
//Referenced enum case:
if (!property.isEnum && referencedSchema.getEnum() != null && !referencedSchema.getEnum().isEmpty()) {
property.dataType = this.getSchemaType(referencedSchema);
property.defaultValue = this.toDefaultValue(referencedSchema);
List<Object> _enum = referencedSchema.getEnum();
Map<String, Object> allowableValues = new HashMap<>();
allowableValues.put("values", _enum);
if (allowableValues.size() > 0) {
property.allowableValues = allowableValues;
}
}
return property;
}
@Override
public String toDefaultValue(Schema p) {
if (ModelUtils.isBooleanSchema(p)) {
if (p.getDefault() != null) {
return p.getDefault().toString();
} else if (!Boolean.TRUE.equals(p.getNullable())) {
return "false";
}
} else if (ModelUtils.isDateSchema(p)) {
// TODO
} else if (ModelUtils.isDateTimeSchema(p)) {
// TODO
} else if (ModelUtils.isFileSchema(p)) {
// TODO
} else if (ModelUtils.isNumberSchema(p)) {
if (p.getDefault() != null) {
return p.getDefault().toString();
} else if (!Boolean.TRUE.equals(p.getNullable())) {
return "0";
}
} else if (ModelUtils.isIntegerSchema(p)) {
if (p.getDefault() != null) {
return p.getDefault().toString();
} else if (!Boolean.TRUE.equals(p.getNullable())) {
return "0";
}
} else if (ModelUtils.isStringSchema(p)) {
if (p.getDefault() != null) {
return "'" + p.getDefault() + "'";
} else if (!Boolean.TRUE.equals(p.getNullable())) {
return "\"\"";
}
} else if (ModelUtils.isArraySchema(p)) {
if (p.getDefault() != null) {
return p.getDefault().toString();
} else if (!Boolean.TRUE.equals(p.getNullable())) {
return "[]";
}
}
return null;
}
@Override
public String toEnumDefaultValue(String value, String datatype) {
return datatype + "::" + value;
}
@Override
public String toEnumVarName(String value, String datatype) {
if (value.length() == 0) {
return super.toEnumVarName(value, datatype);
}
// number
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
String varName = "NUMBER_" + value;
varName = varName.replaceAll("-", "MINUS_");
varName = varName.replaceAll("\\+", "PLUS_");
varName = varName.replaceAll("\\.", "_DOT_");
return varName;
}
return super.toEnumVarName(value, datatype);
}
}

View File

@ -1,21 +1,17 @@
<?php
{{#models}}{{#model}}/**
{{#models}}
{{#model}}
/**
* {{classname}}
*/
namespace {{modelPackage}};
/**
* {{classname}}
{{#description}}
* @description {{{.}}}
{{/description}}
*/
class {{classname}} {
{{#vars}}
/** @var {{{dataType}}} ${{name}} {{description}}*/
{{#deprecated}}
/** @deprecated */
{{/deprecated}}
private ${{name}};
{{/vars}}
}
{{/model}}{{/models}}
{{#isEnum}}{{>model_enum}}{{/isEnum}}{{^isEnum}}{{>model_generic}}{{/isEnum}}
{{/model}}
{{/models}}

View File

@ -0,0 +1,28 @@
class {{classname}}
{
/**
* Possible values of this enum
*/
{{#allowableValues}}
{{#enumVars}}
const {{{name}}} = {{{value}}};
{{/enumVars}}
{{/allowableValues}}
/**
* Gets allowable values of the enum
* @return string[]
*/
public static function getAllowableEnumValues()
{
return [
{{#allowableValues}}
{{#enumVars}}
self::{{{name}}}{{^-last}},
{{/-last}}
{{/enumVars}}
{{/allowableValues}}
];
}
}

View File

@ -0,0 +1,11 @@
class {{classname}} {
{{#vars}}
/** @var {{{dataType}}}{{#isNullable}}|null{{/isNullable}} ${{name}} {{description}}*/
{{#deprecated}}
/** @deprecated */
{{/deprecated}}
public ${{name}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}{{#isNullable}} = null{{/isNullable}}{{/defaultValue}};
{{/vars}}
}

View File

@ -10,9 +10,9 @@ namespace app\Models;
class AdditionalPropertiesClass {
/** @var array<string,string> $mapProperty */
private $mapProperty;
public $mapProperty;
/** @var array<string,array<string,string>> $mapOfMapProperty */
private $mapOfMapProperty;
public $mapOfMapProperty;
}

View File

@ -10,9 +10,9 @@ namespace app\Models;
class AllOfWithSingleRef {
/** @var string $username */
private $username;
public $username = "";
/** @var SingleRefType $singleRefType */
private $singleRefType;
/** @var SingleRefType|null $singleRefType */
public $singleRefType = null;
}

View File

@ -10,9 +10,9 @@ namespace app\Models;
class Animal {
/** @var string $className */
private $className;
public $className = "";
/** @var string $color */
private $color;
public $color = 'red';
}

View File

@ -10,12 +10,12 @@ namespace app\Models;
class ApiResponse {
/** @var int $code */
private $code;
public $code = 0;
/** @var string $type */
private $type;
public $type = "";
/** @var string $message */
private $message;
public $message = "";
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class ArrayOfArrayOfNumberOnly {
/** @var float[][] $arrayArrayNumber */
private $arrayArrayNumber;
public $arrayArrayNumber = [];
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class ArrayOfNumberOnly {
/** @var float[] $arrayNumber */
private $arrayNumber;
public $arrayNumber = [];
}

View File

@ -10,12 +10,12 @@ namespace app\Models;
class ArrayTest {
/** @var string[] $arrayOfString */
private $arrayOfString;
public $arrayOfString = [];
/** @var int[][] $arrayArrayOfInteger */
private $arrayArrayOfInteger;
public $arrayArrayOfInteger = [];
/** @var \app\Models\ReadOnlyFirst[][] $arrayArrayOfModel */
private $arrayArrayOfModel;
public $arrayArrayOfModel = [];
}

View File

@ -10,21 +10,21 @@ namespace app\Models;
class Capitalization {
/** @var string $smallCamel */
private $smallCamel;
public $smallCamel = "";
/** @var string $capitalCamel */
private $capitalCamel;
public $capitalCamel = "";
/** @var string $smallSnake */
private $smallSnake;
public $smallSnake = "";
/** @var string $capitalSnake */
private $capitalSnake;
public $capitalSnake = "";
/** @var string $sCAETHFlowPoints */
private $sCAETHFlowPoints;
public $sCAETHFlowPoints = "";
/** @var string $aTTNAME Name of the pet*/
private $aTTNAME;
public $aTTNAME = "";
}

View File

@ -10,12 +10,12 @@ namespace app\Models;
class Cat {
/** @var string $className */
private $className;
public $className = "";
/** @var string $color */
private $color;
public $color = 'red';
/** @var bool $declawed */
private $declawed;
public $declawed = false;
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class CatAllOf {
/** @var bool $declawed */
private $declawed;
public $declawed = false;
}

View File

@ -10,9 +10,9 @@ namespace app\Models;
class Category {
/** @var int $id */
private $id;
public $id = 0;
/** @var string $name */
private $name;
public $name = 'default-name';
}

View File

@ -6,10 +6,11 @@ namespace app\Models;
/**
* ClassModel
* @description Model for testing model with \"_class\" property
*/
class ClassModel {
/** @var string $class */
private $class;
public $class = "";
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class Client {
/** @var string $client */
private $client;
public $client = "";
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class DeprecatedObject {
/** @var string $name */
private $name;
public $name = "";
}

View File

@ -10,12 +10,12 @@ namespace app\Models;
class Dog {
/** @var string $className */
private $className;
public $className = "";
/** @var string $color */
private $color;
public $color = 'red';
/** @var string $breed */
private $breed;
public $breed = "";
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class DogAllOf {
/** @var string $breed */
private $breed;
public $breed = "";
}

View File

@ -10,9 +10,9 @@ namespace app\Models;
class EnumArrays {
/** @var string $justSymbol */
private $justSymbol;
public $justSymbol = "";
/** @var string[] $arrayEnum */
private $arrayEnum;
public $arrayEnum = [];
}

View File

@ -7,6 +7,27 @@ namespace app\Models;
/**
* EnumClass
*/
class EnumClass {
class EnumClass
{
/**
* Possible values of this enum
*/
const ABC = '_abc';
const EFG = '-efg';
const XYZ = '(xyz)';
/**
* Gets allowable values of the enum
* @return string[]
*/
public static function getAllowableEnumValues()
{
return [
self::ABC,
self::EFG,
self::XYZ
];
}
}

View File

@ -10,27 +10,27 @@ namespace app\Models;
class EnumTest {
/** @var string $enumString */
private $enumString;
public $enumString = "";
/** @var string $enumStringRequired */
private $enumStringRequired;
public $enumStringRequired = "";
/** @var int $enumInteger */
private $enumInteger;
public $enumInteger = 0;
/** @var double $enumNumber */
private $enumNumber;
public $enumNumber = 0;
/** @var \app\Models\OuterEnum $outerEnum */
private $outerEnum;
/** @var string|null $outerEnum */
public $outerEnum = null;
/** @var \app\Models\OuterEnumInteger $outerEnumInteger */
private $outerEnumInteger;
/** @var int $outerEnumInteger */
public $outerEnumInteger = \app\Models\OuterEnumInteger::NUMBER_0;
/** @var \app\Models\OuterEnumDefaultValue $outerEnumDefaultValue */
private $outerEnumDefaultValue;
/** @var string $outerEnumDefaultValue */
public $outerEnumDefaultValue = \app\Models\OuterEnumDefaultValue::PLACED;
/** @var \app\Models\OuterEnumIntegerDefaultValue $outerEnumIntegerDefaultValue */
private $outerEnumIntegerDefaultValue;
/** @var int $outerEnumIntegerDefaultValue */
public $outerEnumIntegerDefaultValue = \app\Models\OuterEnumIntegerDefaultValue::NUMBER_0;
}

View File

@ -6,10 +6,11 @@ namespace app\Models;
/**
* File
* @description Must be named `File` for test.
*/
class File {
/** @var string $sourceURI Test capitalization*/
private $sourceURI;
public $sourceURI = "";
}

View File

@ -10,9 +10,9 @@ namespace app\Models;
class FileSchemaTestClass {
/** @var \app\Models\File $file */
private $file;
public $file;
/** @var \app\Models\File[] $files */
private $files;
public $files = [];
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class Foo {
/** @var string $bar */
private $bar;
public $bar = 'bar';
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class FooGetDefaultResponse {
/** @var \app\Models\Foo $string */
private $string;
public $string;
}

View File

@ -10,51 +10,51 @@ namespace app\Models;
class FormatTest {
/** @var int $integer */
private $integer;
public $integer = 0;
/** @var int $int32 */
private $int32;
public $int32 = 0;
/** @var int $int64 */
private $int64;
public $int64 = 0;
/** @var float $number */
private $number;
public $number = 0;
/** @var float $float */
private $float;
public $float = 0;
/** @var double $double */
private $double;
public $double = 0;
/** @var float $decimal */
private $decimal;
public $decimal = "";
/** @var string $string */
private $string;
public $string = "";
/** @var string $byte */
private $byte;
public $byte = "";
/** @var \SplFileObject $binary */
private $binary;
public $binary;
/** @var \DateTime $date */
private $date;
public $date;
/** @var \DateTime $dateTime */
private $dateTime;
public $dateTime;
/** @var string $uuid */
private $uuid;
public $uuid = "";
/** @var string $password */
private $password;
public $password = "";
/** @var string $patternWithDigits A string that is a 10 digit number. Can have leading zeros.*/
private $patternWithDigits;
public $patternWithDigits = "";
/** @var string $patternWithDigitsAndDelimiter A string starting with &#39;image_&#39; (case insensitive) and one to three digits following i.e. Image_01.*/
private $patternWithDigitsAndDelimiter;
public $patternWithDigitsAndDelimiter = "";
}

View File

@ -10,9 +10,9 @@ namespace app\Models;
class HasOnlyReadOnly {
/** @var string $bar */
private $bar;
public $bar = "";
/** @var string $foo */
private $foo;
public $foo = "";
}

View File

@ -6,10 +6,11 @@ namespace app\Models;
/**
* HealthCheckResult
* @description Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.
*/
class HealthCheckResult {
/** @var string $nullableMessage */
private $nullableMessage;
/** @var string|null $nullableMessage */
public $nullableMessage = null;
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class InlineResponseDefault {
/** @var \app\Models\Foo $string */
private $string;
public $string;
}

View File

@ -10,15 +10,15 @@ namespace app\Models;
class MapTest {
/** @var array<string,array<string,string>> $mapMapOfString */
private $mapMapOfString;
public $mapMapOfString;
/** @var array<string,string> $mapOfEnumString */
private $mapOfEnumString;
public $mapOfEnumString;
/** @var array<string,bool> $directMap */
private $directMap;
public $directMap;
/** @var array<string,bool> $indirectMap */
private $indirectMap;
public $indirectMap;
}

View File

@ -10,12 +10,12 @@ namespace app\Models;
class MixedPropertiesAndAdditionalPropertiesClass {
/** @var string $uuid */
private $uuid;
public $uuid = "";
/** @var \DateTime $dateTime */
private $dateTime;
public $dateTime;
/** @var array<string,\app\Models\Animal> $map */
private $map;
public $map;
}

View File

@ -6,13 +6,14 @@ namespace app\Models;
/**
* Model200Response
* @description Model for testing model name starting with number
*/
class Model200Response {
/** @var int $name */
private $name;
public $name = 0;
/** @var string $class */
private $class;
public $class = "";
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class ModelList {
/** @var string $_123list */
private $_123list;
public $_123list = "";
}

View File

@ -6,10 +6,11 @@ namespace app\Models;
/**
* ModelReturn
* @description Model for testing reserved words
*/
class ModelReturn {
/** @var int $return */
private $return;
public $return = 0;
}

View File

@ -6,19 +6,20 @@ namespace app\Models;
/**
* Name
* @description Model for testing model name same as property name
*/
class Name {
/** @var int $name */
private $name;
public $name = 0;
/** @var int $snakeCase */
private $snakeCase;
public $snakeCase = 0;
/** @var string $property */
private $property;
public $property = "";
/** @var int $_123number */
private $_123number;
public $_123number = 0;
}

View File

@ -9,40 +9,40 @@ namespace app\Models;
*/
class NullableClass {
/** @var int $integerProp */
private $integerProp;
/** @var int|null $integerProp */
public $integerProp = null;
/** @var float $numberProp */
private $numberProp;
/** @var float|null $numberProp */
public $numberProp = null;
/** @var bool $booleanProp */
private $booleanProp;
/** @var bool|null $booleanProp */
public $booleanProp = null;
/** @var string $stringProp */
private $stringProp;
/** @var string|null $stringProp */
public $stringProp = null;
/** @var \DateTime $dateProp */
private $dateProp;
/** @var \DateTime|null $dateProp */
public $dateProp = null;
/** @var \DateTime $datetimeProp */
private $datetimeProp;
/** @var \DateTime|null $datetimeProp */
public $datetimeProp = null;
/** @var object[] $arrayNullableProp */
private $arrayNullableProp;
/** @var object[]|null $arrayNullableProp */
public $arrayNullableProp = null;
/** @var object[] $arrayAndItemsNullableProp */
private $arrayAndItemsNullableProp;
/** @var object[]|null $arrayAndItemsNullableProp */
public $arrayAndItemsNullableProp = null;
/** @var object[] $arrayItemsNullable */
private $arrayItemsNullable;
public $arrayItemsNullable = [];
/** @var array<string,object> $objectNullableProp */
private $objectNullableProp;
/** @var array<string,object>|null $objectNullableProp */
public $objectNullableProp = null;
/** @var array<string,object> $objectAndItemsNullableProp */
private $objectAndItemsNullableProp;
/** @var array<string,object>|null $objectAndItemsNullableProp */
public $objectAndItemsNullableProp = null;
/** @var array<string,object> $objectItemsNullable */
private $objectItemsNullable;
public $objectItemsNullable;
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class NumberOnly {
/** @var float $justNumber */
private $justNumber;
public $justNumber = 0;
}

View File

@ -10,18 +10,18 @@ namespace app\Models;
class ObjectWithDeprecatedFields {
/** @var string $uuid */
private $uuid;
public $uuid = "";
/** @var float $id */
/** @deprecated */
private $id;
public $id = 0;
/** @var \app\Models\DeprecatedObject $deprecatedRef */
/** @deprecated */
private $deprecatedRef;
public $deprecatedRef;
/** @var string[] $bars */
/** @deprecated */
private $bars;
public $bars = [];
}

View File

@ -10,21 +10,21 @@ namespace app\Models;
class Order {
/** @var int $id */
private $id;
public $id = 0;
/** @var int $petId */
private $petId;
public $petId = 0;
/** @var int $quantity */
private $quantity;
public $quantity = 0;
/** @var \DateTime $shipDate */
private $shipDate;
public $shipDate;
/** @var string $status Order Status*/
private $status;
public $status = "";
/** @var bool $complete */
private $complete;
public $complete = false;
}

View File

@ -10,12 +10,12 @@ namespace app\Models;
class OuterComposite {
/** @var float $myNumber */
private $myNumber;
public $myNumber = 0;
/** @var string $myString */
private $myString;
public $myString = "";
/** @var bool $myBoolean */
private $myBoolean;
public $myBoolean = false;
}

View File

@ -7,6 +7,27 @@ namespace app\Models;
/**
* OuterEnum
*/
class OuterEnum {
class OuterEnum
{
/**
* Possible values of this enum
*/
const PLACED = 'placed';
const APPROVED = 'approved';
const DELIVERED = 'delivered';
/**
* Gets allowable values of the enum
* @return string[]
*/
public static function getAllowableEnumValues()
{
return [
self::PLACED,
self::APPROVED,
self::DELIVERED
];
}
}

View File

@ -7,6 +7,27 @@ namespace app\Models;
/**
* OuterEnumDefaultValue
*/
class OuterEnumDefaultValue {
class OuterEnumDefaultValue
{
/**
* Possible values of this enum
*/
const PLACED = 'placed';
const APPROVED = 'approved';
const DELIVERED = 'delivered';
/**
* Gets allowable values of the enum
* @return string[]
*/
public static function getAllowableEnumValues()
{
return [
self::PLACED,
self::APPROVED,
self::DELIVERED
];
}
}

View File

@ -7,6 +7,27 @@ namespace app\Models;
/**
* OuterEnumInteger
*/
class OuterEnumInteger {
class OuterEnumInteger
{
/**
* Possible values of this enum
*/
const NUMBER_0 = 0;
const NUMBER_1 = 1;
const NUMBER_2 = 2;
/**
* Gets allowable values of the enum
* @return string[]
*/
public static function getAllowableEnumValues()
{
return [
self::NUMBER_0,
self::NUMBER_1,
self::NUMBER_2
];
}
}

View File

@ -7,6 +7,27 @@ namespace app\Models;
/**
* OuterEnumIntegerDefaultValue
*/
class OuterEnumIntegerDefaultValue {
class OuterEnumIntegerDefaultValue
{
/**
* Possible values of this enum
*/
const NUMBER_0 = 0;
const NUMBER_1 = 1;
const NUMBER_2 = 2;
/**
* Gets allowable values of the enum
* @return string[]
*/
public static function getAllowableEnumValues()
{
return [
self::NUMBER_0,
self::NUMBER_1,
self::NUMBER_2
];
}
}

View File

@ -9,7 +9,7 @@ namespace app\Models;
*/
class OuterObjectWithEnumProperty {
/** @var \app\Models\OuterEnumInteger $value */
private $value;
/** @var int $value */
public $value = \app\Models\OuterEnumInteger::NUMBER_0;
}

View File

@ -10,21 +10,21 @@ namespace app\Models;
class Pet {
/** @var int $id */
private $id;
public $id = 0;
/** @var \app\Models\Category $category */
private $category;
public $category;
/** @var string $name */
private $name;
public $name = "";
/** @var string[] $photoUrls */
private $photoUrls;
public $photoUrls = [];
/** @var \app\Models\Tag[] $tags */
private $tags;
public $tags = [];
/** @var string $status pet status in the store*/
private $status;
public $status = "";
}

View File

@ -10,9 +10,9 @@ namespace app\Models;
class ReadOnlyFirst {
/** @var string $bar */
private $bar;
public $bar = "";
/** @var string $baz */
private $baz;
public $baz = "";
}

View File

@ -7,6 +7,24 @@ namespace app\Models;
/**
* SingleRefType
*/
class SingleRefType {
class SingleRefType
{
/**
* Possible values of this enum
*/
const ADMIN = 'admin';
const USER = 'user';
/**
* Gets allowable values of the enum
* @return string[]
*/
public static function getAllowableEnumValues()
{
return [
self::ADMIN,
self::USER
];
}
}

View File

@ -10,6 +10,6 @@ namespace app\Models;
class SpecialModelName {
/** @var int $specialPropertyName */
private $specialPropertyName;
public $specialPropertyName = 0;
}

View File

@ -10,9 +10,9 @@ namespace app\Models;
class Tag {
/** @var int $id */
private $id;
public $id = 0;
/** @var string $name */
private $name;
public $name = "";
}

View File

@ -10,27 +10,27 @@ namespace app\Models;
class User {
/** @var int $id */
private $id;
public $id = 0;
/** @var string $username */
private $username;
public $username = "";
/** @var string $firstName */
private $firstName;
public $firstName = "";
/** @var string $lastName */
private $lastName;
public $lastName = "";
/** @var string $email */
private $email;
public $email = "";
/** @var string $password */
private $password;
public $password = "";
/** @var string $phone */
private $phone;
public $phone = "";
/** @var int $userStatus User Status*/
private $userStatus;
public $userStatus = 0;
}