Field_Validation
extends Field
in package
PHP8.2対応以前にシリアライズされたFieldオブジェクトをデシリアライズすると、 PHP8.2以上の環境でエラーが発生するため、 #[\AllowDynamicProperties] を付与している。
Table of Contents
Properties
- $_aryChild : array<string, Field>
- $_aryField : array<string, array<string|int, mixed>>
- $_aryGroup : array<string, string>
- $_aryMeta : array<string, array<string|int, mixed>>
- $_aryMethod : array<string, array<string, mixed>>
- $_aryV : array<string, array<string, array<int, bool>>>
Methods
- __construct() : mixed
- constructor
- add() : bool
- alias for addField
- addChild() : true
- 指定した名前の子フィールドを設定する
- addField() : bool
- 指定したフィールド名のフィールドに値を追加する
- cloneWith() : static
- 指定したフィールドをコピーして、新しいオブジェクトを生成します。
- delete() : bool
- alias for deleteField
- deleteField() : bool
- 指定したフィールド名のフィールドを削除する
- dig() : Field
- 指定されたスコープ名に基づいてフィールド構造を深掘りし、関連するフィールドデータを整理します。
- get() : T is string ? string : false)
- 指定したフィールド名の値を取得する フィールド名に文字列以外を指定した場合はfalseを返す
- getArray() : array<string|int, mixed>
- 指定したフィールド名の値を配列で取得する
- getChild() : Field
- 指定した名前の子フィールドを取得する
- getMeta() : T is non-empty-string ? string|null : array)
- 指定したフィールド名のフィールドに設定されたメタ情報を取得する $keyを指定しない場合は、指定したフィールド名のメタ情報すべてを配列で返す
- getMethods() : array<string|int, string>
- ailas for listMethods
- isChildExists() : bool
- 指定した名前の子フィールドが存在するかどうかを判定する 名前を指定しない場合は、子フィールドが一つも存在しない場合にtrueを返す
- isExists() : bool
- 指定した名前のフィールドが存在するかどうかを判定する
- isGroup() : bool
- 指定したフィールド名のフィールドがフィールドグループに属するフィールドかどうかを判定する
- isNull() : bool
- 指定したフィールド名のフィールドがnullかどうかを判定する $fdにnullを指定した場合は、フィールドが一つも存在しない場合にtrueを返す
- isValid() : bool
- 指定したフィールド名のフィールドの指定したバリデーションメソッドによる検証結果を判定する $fdを指定しない場合は、すべてのフィールドに対するバリデーションメソッドによる検証結果を判定する
- isValidAll() : bool
- 子フィールドも含めすべてのフィールドに対するバリデーションメソッドによる検証結果を判定する
- listChildren() : array<string|int, string>
- 子フィールド名を列挙する
- listFields() : array<string|int, string>
- $validatorがtrueの場合は、バリデーションの値を含めたフィールド名を返す
- listMethods() : array<string|int, string>
- 指定したフィールド名のフィールドに対するバリデーションメソッドを配列で取得する
- overload() : void
- オブジェクトを上書きする
- parse() : void
- フィールドクエリを解析する
- removeChild() : true
- 指定した名前の子フィールドを削除する
- reset() : true
- バリデーションをリセットする
- retouchCustomUnit() : void
- カスタムユニットのフィールド名と値を調整します。
- serialize() : string
- シリアライズされた文字列を返す
- set() : bool
- フィールドの値を設定する
- setField() : bool
- フィールドの値を設定する
- setGroup() : void
- 指定したフィールド名のフィールドをフィールドグループに属するフィールドとして設定する
- setMeta() : true
- 指定したフィールド名のフィールドにメタ情報を設定する
- setMethod() : mixed
- バリデーションメソッドを設定する
- setValidator() : bool
- 指定したフィールド名のフィールドに対するバリデーションメソッドのバリデーション結果を設定する
- singleton() : Field_Validation
- シングルトンパターンでオブジェクトを生成する
- validate() : true
- すべてのフィールドに対して、バリデーションメソッドによる検証を実行する
Properties
$_aryChild
public
array<string, Field>
$_aryChild
= []
$_aryField
public
array<string, array<string|int, mixed>>
$_aryField
= []
$_aryGroup
public
array<string, string>
$_aryGroup
= []
$_aryMeta
public
array<string, array<string|int, mixed>>
$_aryMeta
= []
$_aryMethod
public
array<string, array<string, mixed>>
$_aryMethod
= []
$_aryV
public
array<string, array<string, array<int, bool>>>
$_aryV
= []
Methods
__construct()
constructor
public
final __construct([Field|array<string, mixed>|string|null $Field = null ][, bool $isDeep = false ]) : mixed
Parameters
- $Field : Field|array<string, mixed>|string|null = null
- $isDeep : bool = false
add()
alias for addField
public
add(string $fd, array<string|int, mixed>|string|int|float|null $vals) : bool
Parameters
- $fd : string
-
フィールド名
- $vals : array<string|int, mixed>|string|int|float|null
Return values
booladdChild()
指定した名前の子フィールドを設定する
public
addChild(string $name, Field &$Field) : true
Parameters
- $name : string
- $Field : Field
Return values
trueaddField()
指定したフィールド名のフィールドに値を追加する
public
addField(string $fd, array<string|int, mixed>|string|int|float|null $vals) : bool
Parameters
- $fd : string
-
フィールド名
- $vals : array<string|int, mixed>|string|int|float|null
Return values
boolcloneWith()
指定したフィールドをコピーして、新しいオブジェクトを生成します。
public
cloneWith(array<string|int, mixed> $fieldNames) : static
Parameters
- $fieldNames : array<string|int, mixed>
Tags
Return values
staticdelete()
alias for deleteField
public
delete(mixed $fd) : bool
Parameters
- $fd : mixed
Tags
Return values
booldeleteField()
指定したフィールド名のフィールドを削除する
public
deleteField(string $fd) : bool
Parameters
- $fd : string
Return values
booldig()
指定されたスコープ名に基づいてフィールド構造を深掘りし、関連するフィールドデータを整理します。
public
& dig([mixed $scp = 'field' ]) : Field
Parameters
- $scp : mixed = 'field'
-
スコープ名
Tags
Return values
Field —新たに生成された子フィールドの参照を返す
get()
指定したフィールド名の値を取得する フィールド名に文字列以外を指定した場合はfalseを返す
public
get(T $fd[, string|int|null $def = null ][, int $i = 0 ]) : T is string ? string : false)
Parameters
- $fd : T
- $def : string|int|null = null
- $i : int = 0
Tags
Return values
T is string ? string : false)getArray()
指定したフィールド名の値を配列で取得する
public
getArray(string $fd[, bool $strict = false ]) : array<string|int, mixed>
Parameters
- $fd : string
- $strict : bool = false
-
falseの場合、空文字、null、フィールドグループを削除した配列を返す。デフォルトはfalse
Return values
array<string|int, mixed>getChild()
指定した名前の子フィールドを取得する
public
& getChild(string $name) : Field
Parameters
- $name : string
Return values
FieldgetMeta()
指定したフィールド名のフィールドに設定されたメタ情報を取得する $keyを指定しない場合は、指定したフィールド名のメタ情報すべてを配列で返す
public
getMeta(string $fd[, T $key = null ]) : T is non-empty-string ? string|null : array)
Parameters
- $fd : string
-
フィールド名
- $key : T = null
-
メタ情報のキー
Tags
Return values
T is non-empty-string ? string|null : array)getMethods()
ailas for listMethods
public
getMethods(string $fd) : array<string|int, string>
Parameters
- $fd : string
Return values
array<string|int, string>isChildExists()
指定した名前の子フィールドが存在するかどうかを判定する 名前を指定しない場合は、子フィールドが一つも存在しない場合にtrueを返す
public
isChildExists([string|null $name = null ]) : bool
Parameters
- $name : string|null = null
Return values
boolisExists()
指定した名前のフィールドが存在するかどうかを判定する
public
isExists(string $fd[, int|null $i = null ]) : bool
Parameters
- $fd : string
- $i : int|null = null
Return values
boolisGroup()
指定したフィールド名のフィールドがフィールドグループに属するフィールドかどうかを判定する
public
isGroup(string $fd) : bool
Parameters
- $fd : string
Return values
boolisNull()
指定したフィールド名のフィールドがnullかどうかを判定する $fdにnullを指定した場合は、フィールドが一つも存在しない場合にtrueを返す
public
isNull([string|null $fd = null ][, int $i = 0 ]) : bool
Parameters
- $fd : string|null = null
- $i : int = 0
Return values
boolisValid()
指定したフィールド名のフィールドの指定したバリデーションメソッドによる検証結果を判定する $fdを指定しない場合は、すべてのフィールドに対するバリデーションメソッドによる検証結果を判定する
public
isValid([string|null $fd = null ][, string|null $method = null ][, int|null $i = null ]) : bool
Parameters
- $fd : string|null = null
- $method : string|null = null
- $i : int|null = null
Return values
boolisValidAll()
子フィールドも含めすべてのフィールドに対するバリデーションメソッドによる検証結果を判定する
public
isValidAll() : bool
Return values
boollistChildren()
子フィールド名を列挙する
public
listChildren() : array<string|int, string>
Return values
array<string|int, string>listFields()
$validatorがtrueの場合は、バリデーションの値を含めたフィールド名を返す
public
listFields([bool $validator = false ]) : array<string|int, string>
Parameters
- $validator : bool = false
Return values
array<string|int, string>listMethods()
指定したフィールド名のフィールドに対するバリデーションメソッドを配列で取得する
public
listMethods(string $fd) : array<string|int, string>
Parameters
- $fd : string
Return values
array<string|int, string>overload()
オブジェクトを上書きする
public
overload(mixed $Field[, mixed $isDeep = false ]) : void
Parameters
- $Field : mixed
- $isDeep : mixed = false
Tags
parse()
フィールドクエリを解析する
public
parse(string $query) : void
Parameters
- $query : string
removeChild()
指定した名前の子フィールドを削除する
public
removeChild(mixed $name) : true
Parameters
- $name : mixed
Return values
truereset()
バリデーションをリセットする
public
reset([bool $isDeep = false ]) : true
Parameters
- $isDeep : bool = false
-
非推奨の引数です。使用しないでください。
Return values
trueretouchCustomUnit()
カスタムユニットのフィールド名と値を調整します。
public
retouchCustomUnit([string $id = '' ]) : void
フィールド名と値のペアを走査し、フィールド名に指定されたIDが含まれている場合に、 そのIDを除去して新しいフィールド名として設定します。IDがフィールド値にも含まれている場合(フィールド名が'@'で始まる場合)、 値に対しても同様の処理を行います。
処理の結果、フィールド名からIDが除去された新しい配列が_aryFieldプロパティに設定されます。
また、メタデータを格納する_aryMetaプロパティは空の配列にリセットされます。
Parameters
- $id : string = ''
-
ユニットID。デフォルトは空文字列です。
serialize()
シリアライズされた文字列を返す
public
serialize() : string
Return values
stringset()
フィールドの値を設定する
public
set(string $fd[, array<string|int, mixed>|string|int|float|null $vals = null ]) : bool
Parameters
- $fd : string
-
フィールド名
- $vals : array<string|int, mixed>|string|int|float|null = null
Return values
boolsetField()
フィールドの値を設定する
public
setField(string $fd[, array<string|int, mixed>|string|int|float|null $vals = null ]) : bool
Parameters
- $fd : string
-
フィールド名
- $vals : array<string|int, mixed>|string|int|float|null = null
Return values
boolsetGroup()
指定したフィールド名のフィールドをフィールドグループに属するフィールドとして設定する
public
setGroup([string|null $fd = null ][, string|null $group = null ]) : void
Parameters
- $fd : string|null = null
- $group : string|null = null
setMeta()
指定したフィールド名のフィールドにメタ情報を設定する
public
setMeta(string $fd[, string|null $key = null ][, mixed $val = null ]) : true
Parameters
- $fd : string
-
フィールド名
- $key : string|null = null
-
メタ情報のキー
- $val : mixed = null
-
メタ情報の値
Return values
truesetMethod()
バリデーションメソッドを設定する
public
setMethod([string|null $fd = null ][, string|null $name = null ][, mixed $arg = null ]) : mixed
Parameters
- $fd : string|null = null
- $name : string|null = null
- $arg : mixed = null
setValidator()
指定したフィールド名のフィールドに対するバリデーションメソッドのバリデーション結果を設定する
public
setValidator(string $fd[, string $method = null ][, bool $validation = null ][, int $i = 0 ]) : bool
Parameters
- $fd : string
- $method : string = null
- $validation : bool = null
- $i : int = 0
Return values
boolsingleton()
シングルトンパターンでオブジェクトを生成する
public
static & singleton(string $key[, null|Field $Field = null ]) : Field_Validation
Parameters
- $key : string
- $Field : null|Field = null
Tags
Return values
Field_Validationvalidate()
すべてのフィールドに対して、バリデーションメソッドによる検証を実行する
public
validate([ACMS_Validator|null $V = null ]) : true
Parameters
- $V : ACMS_Validator|null = null