a-blog cms PHP API Reference

Twig extends Facade
in package

Table of Contents

Properties

$container  : Container
$instance  : mixed

Methods

__callStatic()  : mixed
addExtension()  : void
addFunction()  : void
addTemplatePath()  : void
clearCache()  : void
clearInstance()  : void
テスト用: ファサードがキャッシュしている解決済みインスタンスを破棄する。
getInstance()  : mixed
get service instance
load()  : void
registerExtension()  : void
registerFilter()  : void
registerFunction()  : void
render()  : string
renderTemplate()  : string
setContainer()  : void
swap()  : void
テスト用: サービスインスタンスをスタブ等へ差し替える。
getServiceAlias()  : string
getServiceInstance()  : mixed
isCache()  : bool

Properties

$instance

protected static mixed $instance

Methods

__callStatic()

public static __callStatic(string $method, array<string|int, mixed> $arguments) : mixed
Parameters
$method : string
$arguments : array<string|int, mixed>

addExtension()

public static addExtension(AbstractExtension $extension) : void

拡張機能を追加 (既存 API)

Parameters
$extension : AbstractExtension

addFunction()

public static addFunction(string $name, callable $function) : void

関数を追加 (既存 API)

Parameters
$name : string
$function : callable

addTemplatePath()

public static addTemplatePath(string $dir[, string|null $namespace = = 'null' ]) : void

拡張側のテンプレートディレクトリを名前空間付きで登録

Parameters
$dir : string
$namespace : string|null = = 'null'

clearCache()

public static clearCache() : void

Twig コンパイル済みキャッシュをクリア

clearInstance()

テスト用: ファサードがキャッシュしている解決済みインスタンスを破棄する。

public static clearInstance() : void

isCache() が true のファサードは解決済みインスタンスを静的プロパティ $instance に 保持するため、コンテナ側だけを差し替えても反映されない。本メソッドでキャッシュを 無効化し、次回アクセスでコンテナから再解決させる。

getInstance()

get service instance

public static getInstance() : mixed

load()

public static load(string $path, string $theme) : void

twigテンプレートをロード

Parameters
$path : string
$theme : string

registerExtension()

public static registerExtension(AbstractExtension $extension) : void

拡張側の Twig Extension を登録 (Environment 構築時に attach)

Parameters
$extension : AbstractExtension

registerFilter()

public static registerFilter(string $name, callable $callable[, array<string|int, mixed> $options = = '[]' ]) : void

拡張側の Filter を登録

Parameters
$name : string
$callable : callable
$options : array<string|int, mixed> = = '[]'

registerFunction()

public static registerFunction(string $name, callable $callable[, array<string|int, mixed> $options = = '[]' ]) : void

拡張側の Function を登録

Parameters
$name : string
$callable : callable
$options : array<string|int, mixed> = = '[]'

render()

public static render() : string

テンプレートをレンダリング

Return values
string

renderTemplate()

public static renderTemplate(string $name[, array<string|int, mixed> $context = = '[]' ]) : string

名前指定でテンプレートをレンダリング

Parameters
$name : string
$context : array<string|int, mixed> = = '[]'
Return values
string

swap()

テスト用: サービスインスタンスをスタブ等へ差し替える。

public static swap(object $instance) : void

DI コンテナのエイリアスを差し替えたうえで、ファサードがキャッシュしている解決済み インスタンス(isCache() が true の場合)を破棄し、次回アクセス時に差し替え後の インスタンスを再解決させる。テスト後は元のインスタンスを渡して再度呼び出し復元する。

Parameters
$instance : object

getServiceAlias()

protected static getServiceAlias() : string
Return values
string

getServiceInstance()

protected static getServiceInstance(string $alias) : mixed
Parameters
$alias : string

isCache()

protected static isCache() : bool
Return values
bool

        
On this page

Search results