PeServer

PluginApiInformationLogic extends ApiLogicBase
in package

コントローラから呼び出されるロジック基底処理。

Table of Contents

Constants

SESSION_ALL_CLEAR  = \PeServer\Core\Text::EMPTY
VALIDATE_JSON_PROPERTY_INT  = 3
VALIDATE_JSON_PROPERTY_NON_EMPTY_TEXT  = 2
VALIDATE_JSON_PROPERTY_TEXT  = 1
VALIDATE_JSON_PROPERTY_TIMESTAMP_UTC  = 4

Properties

$beginTimestamp  : DateTimeImmutable
ロジック開始日時。
$environment  : Environment
$logger  : ILogger
ロガー。
$result  : array<string, mixed>
コントローラ内結果データ。
$stores  : Stores
$validator  : Validator
検証処理。
$auditUserInfo  : IAuditUserInfo|null
$content  : DataContent|null
応答データ。
$databaseConnection  : IDatabaseConnection
$dbCache  : AppDatabaseCache
$errors  : array<string, array<string|int, string>>
検証エラー。
$httpResponseStatus  : HttpStatus
HTTPステータスコード。
$keys  : array<string|int, non-empty-string>
要素設定がなされている場合に応答データのキーをこの項目に固定。
$request  : HttpRequest
$responseHeaders  : array<non-empty-string, array<string|int, string>>
応答ヘッダ。
$values  : array<non-empty-string, mixed>
応答データ。

Methods

__construct()  : mixed
生成。
addResponseHeader()  : void
応答HTTPヘッダ追加。
equalsResult()  : bool
ロジック結果の指定キー項目が指定値に一致するか。
getContent()  : DataContent
応答データ取得。
getHttpStatus()  : HttpStatus
HTTP応答ステータスコードの取得。
getResponseHeaders()  : array<non-empty-string, array<string|int, string>>
応答ヘッダの取得。
getViewData()  : TemplateParameter
View表示用データの取得。
receiveErrorKind()  : void
検証結果の失敗受領。
receiveErrorMessage()  : void
エラーメッセージを受領。
run()  : bool
ロジック処理。
tryGetResult()  : bool
ロジック結果に指定キー項目が存在するか。
addCommonError()  : void
addError()  : void
cancelSession()  : void
cleanup()  : void
clearErrors()  : void
executeImpl()  : void
実行ロジック実装。
existsSession()  : bool
getAuditUserInfo()  : IAuditUserInfo|null
監査ログ用ユーザー情報の取得。
getCookie()  : string
Cookie を取得。
getFile()  : UploadedFile
getRequest()  : string
要求データの取得。
getRequestContent()  : Binary
要求本文の生データを取得。
getRequestJson()  : array<string|int, mixed>
要求本文から JSON を取得。
getSession()  : mixed
hasError()  : bool
検証エラーが存在するか。
openDatabase()  : DatabaseContext
データベース接続処理。
peekTemporary()  : mixed
popTemporary()  : mixed
pushTemporary()  : void
registerParameterKeys()  : void
パラメータキーの設定。
removeCookie()  : void
Cookie を削除。
removeError()  : void
removeSession()  : void
removeTemporary()  : void
requireSession()  : mixed
restartSession()  : void
setContent()  : void
応答データ設定。
setCookie()  : void
Cookie を設定。
setDownloadContent()  : void
ダウンロードデータ応答。
setFileContent()  : void
ファイルを応答として設定。
setHttpStatus()  : void
HTTP応答ステータスコードの設定。
setJsonContent()  : void
JSON応答データ設定。
setResponseJson()  : void
setSession()  : void
setTextContent()  : void
setValue()  : void
応答データとして設定。
shutdownSession()  : void
startup()  : void
validateImpl()  : void
検証ロジック実装。
validateJsonProperty()  : bool
JSONプロパティ型判定処理。
validation()  : void
キーに対する一括検証処理。
writeAuditLogCurrentUser()  : int
現在ログインユーザーの監査ログ出力。
writeAuditLogTargetUser()  : int
対象ユーザーとして監査ログ出力。
execute()  : void
実行ロジック。
validate()  : void
検証ロジック実装。
writeAuditLogCore()  : int
監査ログ出力内部処理。

Constants

SESSION_ALL_CLEAR

protected mixed SESSION_ALL_CLEAR = \PeServer\Core\Text::EMPTY

VALIDATE_JSON_PROPERTY_INT

protected mixed VALIDATE_JSON_PROPERTY_INT = 3

VALIDATE_JSON_PROPERTY_NON_EMPTY_TEXT

protected mixed VALIDATE_JSON_PROPERTY_NON_EMPTY_TEXT = 2

VALIDATE_JSON_PROPERTY_TEXT

protected mixed VALIDATE_JSON_PROPERTY_TEXT = 1

VALIDATE_JSON_PROPERTY_TIMESTAMP_UTC

protected mixed VALIDATE_JSON_PROPERTY_TIMESTAMP_UTC = 4

Properties

$beginTimestamp read-only

ロジック開始日時。

protected DateTimeImmutable $beginTimestamp

$result

コントローラ内結果データ。

protected array<string, mixed> $result = []

$errors

検証エラー。

private array<string, array<string|int, string>> $errors = []

$keys

要素設定がなされている場合に応答データのキーをこの項目に固定。

private array<string|int, non-empty-string> $keys = []

$responseHeaders

応答ヘッダ。

private array<non-empty-string, array<string|int, string>> $responseHeaders = []

$values

応答データ。

private array<non-empty-string, mixed> $values = []

Methods

addResponseHeader()

応答HTTPヘッダ追加。

public addResponseHeader(non-empty-string $name, string $value) : void
Parameters
$name : non-empty-string
$value : string

equalsResult()

ロジック結果の指定キー項目が指定値に一致するか。

public equalsResult(string $key, mixed $value) : bool
Parameters
$key : string
$value : mixed
Tags
template

TValue

phpstan-param

TValue $value

Return values
bool

getResponseHeaders()

応答ヘッダの取得。

public getResponseHeaders() : array<non-empty-string, array<string|int, string>>
Return values
array<non-empty-string, array<string|int, string>>

receiveErrorKind()

検証結果の失敗受領。

public receiveErrorKind(string $key, int $kind, array<string|int, mixed> $parameters) : void
Parameters
$key : string
$kind : int
$parameters : array<string|int, mixed>

receiveErrorMessage()

エラーメッセージを受領。

public receiveErrorMessage(string $key, string $message) : void
Parameters
$key : string
$message : string

tryGetResult()

ロジック結果に指定キー項目が存在するか。

public tryGetResult(string $key, mixed &$result) : bool
Parameters
$key : string
$result : mixed
Tags
template

TValue

phpstan-param

TValue $result

Return values
bool

addCommonError()

protected addCommonError(string $message) : void
Parameters
$message : string

addError()

protected addError(string $key, string $message) : void
Parameters
$key : string
$message : string

cancelSession()

protected cancelSession() : void

clearErrors()

protected clearErrors() : void

existsSession()

protected existsSession(string $key) : bool
Parameters
$key : string
Return values
bool

getAuditUserInfo()

監査ログ用ユーザー情報の取得。

protected getAuditUserInfo() : IAuditUserInfo|null

ドメインロジックで明示的に使用しない想定。

Return values
IAuditUserInfo|null

getCookie()

Cookie を取得。

protected getCookie(string $key[, string $fallbackValue = Text::EMPTY ]) : string
Parameters
$key : string

キー。

$fallbackValue : string = Text::EMPTY

取得失敗時の値。

Return values
string

getRequest()

要求データの取得。

protected getRequest(string $key[, string $fallbackValue = Text::EMPTY ][, bool $trim = true ]) : string
Parameters
$key : string

要求キー。

$fallbackValue : string = Text::EMPTY

要求キーに存在しない場合の戻り値。

$trim : bool = true

取得データをトリムするか。

Return values
string

要求データ。

getRequestContent()

要求本文の生データを取得。

protected getRequestContent() : Binary
Return values
Binary

getRequestJson()

要求本文から JSON を取得。

protected getRequestJson() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSession()

protected getSession(string $key[, mixed $fallbackValue = null ]) : mixed
Parameters
$key : string
$fallbackValue : mixed = null

hasError()

検証エラーが存在するか。

protected hasError() : bool
Return values
bool

peekTemporary()

protected peekTemporary(string $key[, mixed $fallbackValue = null ]) : mixed
Parameters
$key : string
$fallbackValue : mixed = null

popTemporary()

protected popTemporary(string $key[, mixed $fallbackValue = null ]) : mixed
Parameters
$key : string
$fallbackValue : mixed = null

pushTemporary()

protected pushTemporary(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

registerParameterKeys()

パラメータキーの設定。

protected registerParameterKeys(array<string|int, non-empty-string> $keys, bool $overwrite[, bool $initialize = true ]) : void
Parameters
$keys : array<string|int, non-empty-string>
$overwrite : bool

キー項目を要求データで上書きするか

$initialize : bool = true

キー情報を初期化するか

removeCookie()

Cookie を削除。

protected removeCookie(string $key) : void
Parameters
$key : string

キー。

removeError()

protected removeError(string $key) : void
Parameters
$key : string

removeSession()

protected removeSession(string $key) : void
Parameters
$key : string

removeTemporary()

protected removeTemporary(string $key) : void
Parameters
$key : string

requireSession()

protected requireSession(string $key) : mixed
Parameters
$key : string

restartSession()

protected restartSession() : void

setContent()

応答データ設定。

protected setContent(non-empty-string $mime, string|array<string|int, mixed>|Binary $data) : void
Parameters
$mime : non-empty-string
$data : string|array<string|int, mixed>|Binary
Tags
phpstan-param

non-empty-string|\PeServer\Core\Mime::* $mime

setCookie()

Cookie を設定。

protected setCookie(string $key, string $value[, CookieOptions|DateInterval, secure: ?bool, httpOnly: ?bool, sameSite: ?string}|null $options = null ]) : void
Parameters
$key : string

キー。

$value : string

設定値。

$options : CookieOptions|DateInterval, secure: ?bool, httpOnly: ?bool, sameSite: ?string}|null = null

オプション。

setDownloadContent()

ダウンロードデータ応答。

protected final setDownloadContent(non-empty-string $mime, string $fileName, Binary $data) : void
Parameters
$mime : non-empty-string
$fileName : string
$data : Binary
Tags
phpstan-param

non-empty-string|\PeServer\Core\Mime::* $mime

setFileContent()

ファイルを応答として設定。

protected setFileContent(string|null $mime, string $path) : void
Parameters
$mime : string|null
$path : string
Tags
phpstan-param

Mime::*|null $mime

setHttpStatus()

HTTP応答ステータスコードの設定。

protected setHttpStatus(HttpStatus $httpStatus) : void
Parameters
$httpStatus : HttpStatus

HTTPステータスコード。

setJsonContent()

JSON応答データ設定。

protected final setJsonContent(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

setSession()

protected setSession(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

setTextContent()

protected final setTextContent(string $data) : void
Parameters
$data : string

setValue()

応答データとして設定。

protected setValue(non-empty-string $key, mixed $value) : void
Parameters
$key : non-empty-string
$value : mixed
Tags
throws
ArgumentException

入力データとして未登録の場合に投げられる。

shutdownSession()

protected shutdownSession() : void

validateJsonProperty()

JSONプロパティ型判定処理。

protected validateJsonProperty(array<string, mixed> $json, string $key, int $validateJsonProperty[, string|null $parent = null ]) : bool
Parameters
$json : array<string, mixed>
$key : string
$validateJsonProperty : int
$parent : string|null = null
Return values
bool

validation()

キーに対する一括検証処理。

protected validation(string $key, callable(string, string): void $callback[, array{default?: string, trim?: bool}|null $options = null ]) : void
Parameters
$key : string
$callback : callable(string, string): void
$options : array{default?: string, trim?: bool}|null = null

オプション

  • default: 取得失敗時の値。
  • trim: 値をトリムするか。

writeAuditLogCurrentUser()

現在ログインユーザーの監査ログ出力。

protected writeAuditLogCurrentUser(string $event[, mixed $info = null ][, IDatabaseContext|null $context = null ]) : int

※DBじゃなくてテキストファイルでいいかも

Parameters
$event : string
$info : mixed = null
$context : IDatabaseContext|null = null
Return values
int

writeAuditLogTargetUser()

対象ユーザーとして監査ログ出力。

protected writeAuditLogTargetUser(string $userId, string $event[, array<string|int, mixed>|null $info = null ][, IDatabaseContext|null $context = null ]) : int
Parameters
$userId : string
$event : string
$info : array<string|int, mixed>|null = null
$context : IDatabaseContext|null = null
Return values
int

writeAuditLogCore()

監査ログ出力内部処理。

private writeAuditLogCore(string $userId, string $event, mixed|null $info, IDatabaseContext|null $context[, ISerializer|null $serializer = null ]) : int
Parameters
$userId : string
$event : string
$info : mixed|null
$context : IDatabaseContext|null
$serializer : ISerializer|null = null
Return values
int

        
On this page

Search results