PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 1.3.0
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v1.3.0
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / Performance / View / Contracts / View.php

View.php in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 1.3.0, at src/Performance/View/Contracts/View.php

59 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The view contract.
4 *
5 * @package SolidWP\Performance
6 */
7
8 declare( strict_types=1 );
9
10 namespace SolidWP\Performance\View\Contracts;
11
12 use SolidWP\Performance\View\Exceptions\FileNotFoundException;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 /**
19 * The view contract.
20 *
21 * @internal
22 *
23 * @package SolidWP\Performance
24 */
25 interface View {
26
27 /**
28 * Renders a view.
29 *
30 * @example If the server path is /app/views, and you wish to load /app/views/admin/notice.php,
31 * pass `admin/notice` as the view name.
32 *
33 * @param string $name The relative path/name of the view file without extension.
34 *
35 * @param mixed[] $args Arguments to be extracted and passed to the view.
36 *
37 * @throws FileNotFoundException If the view file cannot be found.
38 *
39 * @return void
40 */
41 public function render( string $name, array $args = [] ): void;
42
43 /**
44 * Renders a view and returns it as a string to be echoed.
45 *
46 * @example If the server path is /app/views, and you wish to load /app/views/admin/notice.php,
47 * pass `admin/notice` as the view name.
48 *
49 * @param string $name The relative path/name of the view file without extension.
50 *
51 * @param mixed[] $args Arguments to be extracted and passed to the view.
52 *
53 * @throws FileNotFoundException If the view file cannot be found.
54 *
55 * @return string
56 */
57 public function render_to_string( string $name, array $args = [] ): string;
58 }
59