insidesuki / valueobject
3.5.11
2024-03-25 17:02 UTC
Requires
- php: >=8.1
- phpunit/phpunit: >=9.5
Requires (Dev)
- symfony/var-dumper: ^5.4
- dev-main
- 3.5.11
- 3.5.10
- 3.5.9
- 3.5.8
- 3.5.7
- 3.5.6
- 3.5.5
- 3.5.4
- 3.5.3
- 3.5.2
- 3.5.1
- 3.5
- 3.4.1
- 3.4
- 3.3.6
- 3.3.5
- 3.3.4
- 3.3.3
- 3.3.2
- 3.3.1
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2
- 3.1.5
- 3.1.4
- 3.1.3
- 3.1.2
- 3.1.1
- 3.0.0
- 2.9.2
- 2.9.1
- 2.9
- 2.8
- 2.7
- 2.6
- 2.5
- 2.4
- 2.3
- 2.2
- 2.1
- 2.0
- 1.17
- 1.16
- 1.15
- 1.14.9
- 1.14.8
- 1.14.7
- 1.14.6
- 1.14.5
- 1.14.4
- 1.14.3
- 1.14.2
- 1.14.1
- 1.14
- 1.12
- 1.11
- 1.10.3
- 1.10.2
- 1.10.1
- 1.10.0
- 1.9.1
- 1.9
- 1.8
- 1.7.1
- 1.7
- 1.6.1
- 1.6.0
- 1.5.1
- 1.5.0
- 1.4.2
- 1.4.1
- 1.4
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3
- 1.2.19
- 1.2.18
- 1.2.17
- 1.2.16
- 1.2.15
- 1.2.14
- 1.2.13
- 1.2.12
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2
- 1.1
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.0.17
- 0.0.15
- 0.0.14
- 0.0.13
- 0.0.12
- 0.0.11
- 0.0.10
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
This package is auto-updated.
Last update: 2024-09-25 17:15:44 UTC
README
常用值对象。完整文档:https://gitlab.com/insidesuki/valueobject
1- DateValue
用于管理 DateTime 类型的简单值对象。
- 创建新的 DateValue
$startData = DateValue::create('31-10-2010');
- Exception on invalid date
> InvalidDateException
- Get Age
$date = DateValue::create('31-10-2010'); echo $date->age();
**2- DocumentNumber**
--
Spanish NIF/CIF/NIF. Support for Passport type(no validation available)
- Supported types:
enum DocumentType: string {
case nif = '10';
case passport = '20';
case nie = '60';
case cif = '90';
}
- To create a new DocumentNumber by DocumentType
```
// nif
$nif = DocumentNumber::createByType('90','Z3740746P');
在无效数字时抛出 InvalidDocumentNumberException
在无效文档类型时抛出 InvalidDocumentTypeException
- 创建不指定类型的新的 DocumentNumber
// number, documentType detected on execution time
$number = DocumentNumber::create('Z3740746P');
// to avoid validation, passport type returned
$numberWithoutValidatin = DocumentNumber::create('posduhsui',false);
- 使用指定类型更改 DocumentNumber
$nif->change('60','newNumber');
3- FullName
名字, 姓氏1, 姓氏2 姓氏2为可选
// lastname2 is optional
$name = ' james ';
$lastname = ' bond ';
$lastname1 = ' ';
$fullName = FullNameValue::create($name,$lastname,$lastname1);
4- Gender
通用性别,允许空字符串
- GenderTypes
enum GenderType:string
{
case Masculino = '1';
case Femenino = '2';
case Undefined = '';
}
- 创建
// Female Gender::create('2'); // Male Gender::create('1'); // Undefined Gender::create('');
- Exceptions
> InvalidGenderTypeException
**5- EmailValue**
--
Email value object, admits empty string
- 创建
// 有效 $email = EmailValue::create($emailString); // 空的 $email = EmailValue::createAllowEmpty('');
- Exceptions
> InvalidEmailException
**6- PhoneNumberValue**
--
PhoneNumber value object, admits empty string
- 创建
// 有效 $phone = PhoneValue::createPhone('987154362'); // 空的 $phoneEmpty = PhoneValue::createPhoneAllowEmpty('');
// 移动 $movil = PhoneValue::createMovilPhone('714652391'); // 空的 $movil = PhoneValue::createMovilPhoneAllowEmpty('714652391');
- Exceptions
> InvalidPhoneNumberException
> EmptyPhoneNumberException
**7- NivelEstudioValue**
--
FUNDAE nivel estudios
**8- CategoriaProfesionalValue**
--
FUNDAE categoria profesional.
**9- GrupoCotizacionValue**
--
FUNDAE grupo cotizacion
**10- CuentaCotizacionValue**
--
FUNDAE cuenta cotizacion
**11- TerrorismoValue**
--
FUNDAE afectados terrorismo.
**12- ViolenciaValue**
--
FUNDAE afectados violencia de genero
**14- DiscapacidadValue**
--
FUNDAE afectados discapacidad.
**15- Amount**
--