dhii / output-renderer-interface
用于执行渲染的对象的接口。
v0.4-alpha1
2021-02-22 07:17 UTC
Requires
- php: ^7.1 | ^8.0
Requires (Dev)
- phpunit/phpunit: ^6.0 | ^7.0 | ^8.0 | ^9.0
- psr/container: ^1.0
- slevomat/coding-standard: ^6.0
- symfony/polyfill-php80: ^1.19
- vimeo/psalm: ^3.11.7 | ^4
Suggests
- psr/container: To use PSR-11 containers as context
This package is auto-updated.
Last update: 2024-09-22 15:31:24 UTC
README
渲染互操作性接口。
详细信息
与其他 Dhii\Output
命名空间成员一样,本包中的接口与生成输出、处理相关错误以及提供输出功能便利性相关。特别是,本包中的接口是输出生成的核心,定义了一个标准API,适用于任何可以渲染输出的内容。
因此,输出渲染器必须实现 RendererInterface
。如果 RendererInterface#render()
无法生成输出,必须抛出 CouldNotRenderExceptionInterface
。
接口
RendererInterface
- 表示一个渲染器,即可以生成输出的内容。TemplateInterface
- 使用上下文进行渲染的渲染器。PathTemplateFactoryInterface
- 从路径创建模板的工厂。StringTemplateFactoryInterface
- 从字符串创建模板的工厂。BlockInterface
- 具有渲染上下文访问权限的渲染器,也是 可转换字符串。CallbackBlockFactoryInterface
- 从回调创建块的工厂。StringBlockFactoryInterface
- 从字符串创建块的工厂。TemplateBlockFactoryInterface
- 从模板创建块的工厂。RendererAwareInterface
- 提供渲染器的对象。ContextAwareInterface
- 可以检索渲染上下文的对象。BlockAwareInterface
- 可以检索块的对象。TemplateAwareInterface
- 可以检索模板的对象。RendererExceptionInterface
- 与渲染器相关并了解它的异常。CouldNotRenderExceptionInterface
- 一种专门的渲染器异常,用于表示渲染过程中出现的问题。TemplateRenderExceptionInterface
- 一种专门的“无法渲染”异常,了解渲染上下文。