NoraBear Package API Documentation

SchemeMapping
in package

Read onlyYes
FinalYes

Scheme Mapping Configuration

スキーム名とリソース名前空間のマッピングを定義します。

Tags
example
// api スキームを Endpoint 名前空間にマッピング
$mapping = new SchemeMapping([
    'api' => 'Endpoint',
    'page' => 'Page',
]);

// api://self/users → {AppName}\Resource\Endpoint\Users
// page://self/users → {AppName}\Resource\Page\Users
example
// 必要なスキームだけを定義
$mapping = new SchemeMapping([
    'api' => 'Endpoint',
]);

// api スキームのみ利用可能

Table of Contents

Properties

$mappings  : array<string|int, mixed>

Methods

__construct()  : mixed
createDefault()  : self
デフォルトのマッピングを生成
getNamespace()  : string|null
指定されたスキームのリソース名前空間を取得
getSchemes()  : array<string|int, string>
登録されているすべてのスキーム名を取得
has()  : bool
指定されたスキームが登録されているか確認
toArray()  : array<string, string>
すべてのマッピングを取得

Properties

Methods

__construct()

public __construct(array<string, string> $mappings) : mixed
Parameters
$mappings : array<string, string>

スキーム名 => リソース名前空間のマッピング

createDefault()

デフォルトのマッピングを生成

public static createDefault() : self

api, page, app スキームをそれぞれの名前空間にマッピングします。

Return values
self

デフォルトマッピング

getNamespace()

指定されたスキームのリソース名前空間を取得

public getNamespace(string $scheme) : string|null
Parameters
$scheme : string

スキーム名

Return values
string|null

リソース名前空間(見つからない場合はnull)

getSchemes()

登録されているすべてのスキーム名を取得

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

スキーム名の配列

has()

指定されたスキームが登録されているか確認

public has(string $scheme) : bool
Parameters
$scheme : string

スキーム名

Return values
bool

登録されている場合はtrue

toArray()

すべてのマッピングを取得

public toArray() : array<string, string>
Return values
array<string, string>

スキーム名 => リソース名前空間のマッピング


        
On this page

Search results