a-blog cms PHP API Reference

Field
in package

PHP8.2対応以前にシリアライズされたFieldオブジェクトをデシリアライズすると、 PHP8.2以上の環境でエラーが発生するため、 #[\AllowDynamicProperties] を付与している。

Attributes
#[AllowDynamicProperties]

Table of Contents

Properties

$_aryChild  : array<string, Field>
$_aryField  : array<string, array<string|int, mixed>>
$_aryMeta  : array<string, array<string|int, mixed>>

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を指定しない場合は、指定したフィールド名のメタ情報すべてを配列で返す
isChildExists()  : bool
指定した名前の子フィールドが存在するかどうかを判定する 名前を指定しない場合は、子フィールドが一つも存在しない場合にtrueを返す
isExists()  : bool
指定した名前のフィールドが存在するかどうかを判定する
isGroup()  : bool
指定したフィールド名のフィールドがフィールドグループかどうかを判定する
isNull()  : bool
指定したフィールド名のフィールドがnullかどうかを判定する $fdにnullを指定した場合は、フィールドが一つも存在しない場合にtrueを返す
listChildren()  : array<string|int, string>
子フィールド名を列挙する
listFields()  : array<string|int, string>
フィールド名を列挙する
overload()  : void
オブジェクトを上書きする
parse()  : void
フィールドクエリを解析する
removeChild()  : true
指定した名前の子フィールドを削除する
reset()  : true
retouchCustomUnit()  : void
カスタムユニットのフィールド名と値を調整します。
serialize()  : string
シリアライズされた文字列を返す
set()  : bool
フィールドの値を設定する
setField()  : bool
フィールドの値を設定する
setMeta()  : true
指定したフィールド名のフィールドにメタ情報を設定する
singleton()  : Field
シングルトンパターンでオブジェクトを生成する

Properties

$_aryChild

public array<string, Field> $_aryChild = []

$_aryField

public array<string, array<string|int, mixed>> $_aryField = []

$_aryMeta

public array<string, array<string|int, mixed>> $_aryMeta = []

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
bool

addChild()

指定した名前の子フィールドを設定する

public addChild(string $name, Field &$Field) : true
Parameters
$name : string
$Field : Field
Return values
true

addField()

指定したフィールド名のフィールドに値を追加する

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
bool

cloneWith()

指定したフィールドをコピーして、新しいオブジェクトを生成します。

public cloneWith(array<string|int, string> $fieldNames) : static
Parameters
$fieldNames : array<string|int, string>
Return values
static

delete()

alias for deleteField

public delete(string $fd) : bool
Parameters
$fd : string
Return values
bool

deleteField()

指定したフィールド名のフィールドを削除する

public deleteField(string $fd) : bool
Parameters
$fd : string
Return values
bool

dig()

指定されたスコープ名に基づいてフィールド構造を深掘りし、関連するフィールドデータを整理します。

public & dig([string $scp = 'field' ]) : Field

指定されたスコープ名の子フィールドを生成または取得し、 そのスコープ内で定義されているフィールドの値を元フィールドから新しい子フィールドに追加します。 返り値として、新しい子フィールドを返します。

Parameters
$scp : string = 'field'

スコープ名

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
template
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
Field

getMeta()

指定したフィールド名のフィールドに設定されたメタ情報を取得する $keyを指定しない場合は、指定したフィールド名のメタ情報すべてを配列で返す

public getMeta(string $fd[, T $key = null ]) : T is non-empty-string ? string|null : array)
Parameters
$fd : string

フィールド名

$key : T = null

メタ情報のキー

Tags
template
Return values
T is non-empty-string ? string|null : array)

isChildExists()

指定した名前の子フィールドが存在するかどうかを判定する 名前を指定しない場合は、子フィールドが一つも存在しない場合にtrueを返す

public isChildExists([string|null $name = null ]) : bool
Parameters
$name : string|null = null
Return values
bool

isExists()

指定した名前のフィールドが存在するかどうかを判定する

public isExists(string $fd[, int|null $i = null ]) : bool
Parameters
$fd : string
$i : int|null = null
Return values
bool

isGroup()

指定したフィールド名のフィールドがフィールドグループかどうかを判定する

public isGroup(string $fd) : bool
Parameters
$fd : string
Return values
bool

isNull()

指定したフィールド名のフィールドがnullかどうかを判定する $fdにnullを指定した場合は、フィールドが一つも存在しない場合にtrueを返す

public isNull([string|null $fd = null ][, int $i = 0 ]) : bool
Parameters
$fd : string|null = null
$i : int = 0
Return values
bool

listChildren()

子フィールド名を列挙する

public listChildren() : array<string|int, string>
Return values
array<string|int, string>

listFields()

フィールド名を列挙する

public listFields() : array<string|int, string>
Return values
array<string|int, string>

overload()

オブジェクトを上書きする

public overload(Field|array<string, mixed>|string $Field[, bool $isDeep = false ]) : void
Parameters
$Field : Field|array<string, mixed>|string
$isDeep : bool = false

parse()

フィールドクエリを解析する

public parse(string $query) : void
Parameters
$query : string

removeChild()

指定した名前の子フィールドを削除する

public removeChild(mixed $name) : true
Parameters
$name : mixed
Return values
true

reset()

public reset([bool $isDeep = false ]) : true
Parameters
$isDeep : bool = false

非推奨の引数です。使用しないでください。

Return values
true

retouchCustomUnit()

カスタムユニットのフィールド名と値を調整します。

public retouchCustomUnit([string $id = '' ]) : void

フィールド名と値のペアを走査し、フィールド名に指定されたIDが含まれている場合に、 そのIDを除去して新しいフィールド名として設定します。IDがフィールド値にも含まれている場合(フィールド名が'@'で始まる場合)、 値に対しても同様の処理を行います。

処理の結果、フィールド名からIDが除去された新しい配列が_aryFieldプロパティに設定されます。 また、メタデータを格納する_aryMetaプロパティは空の配列にリセットされます。

Parameters
$id : string = ''

ユニットID。デフォルトは空文字列です。

serialize()

シリアライズされた文字列を返す

public serialize() : string
Return values
string

set()

フィールドの値を設定する

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
bool

setField()

フィールドの値を設定する

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
bool

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
true

singleton()

シングルトンパターンでオブジェクトを生成する

public static & singleton(string $key[, null|Field $Field = null ]) : Field
Parameters
$key : string
$Field : null|Field = null
Tags
static
Return values
Field

        
On this page

Search results