@@ -28,97 +28,97 @@ |
||
| 28 | 28 | class Views |
| 29 | 29 | { |
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * ViewBuilder Instance. |
|
| 33 | - * |
|
| 34 | - * @since 0.1.0 |
|
| 35 | - * |
|
| 36 | - * @var ViewBuilder |
|
| 37 | - */ |
|
| 38 | - protected static $viewBuilder; |
|
| 31 | + /** |
|
| 32 | + * ViewBuilder Instance. |
|
| 33 | + * |
|
| 34 | + * @since 0.1.0 |
|
| 35 | + * |
|
| 36 | + * @var ViewBuilder |
|
| 37 | + */ |
|
| 38 | + protected static $viewBuilder; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Add a location to the ViewBuilder. |
|
| 42 | - * |
|
| 43 | - * @since 0.1.0 |
|
| 44 | - * |
|
| 45 | - * @param Location $location Location to add. |
|
| 46 | - * |
|
| 47 | - * @throws FailedToProcessConfigException If the Config could not be processed. |
|
| 48 | - */ |
|
| 49 | - public static function addLocation(Location $location) |
|
| 50 | - { |
|
| 51 | - $viewBuilder = static::getViewBuilder(); |
|
| 52 | - $viewBuilder->addLocation($location); |
|
| 53 | - } |
|
| 40 | + /** |
|
| 41 | + * Add a location to the ViewBuilder. |
|
| 42 | + * |
|
| 43 | + * @since 0.1.0 |
|
| 44 | + * |
|
| 45 | + * @param Location $location Location to add. |
|
| 46 | + * |
|
| 47 | + * @throws FailedToProcessConfigException If the Config could not be processed. |
|
| 48 | + */ |
|
| 49 | + public static function addLocation(Location $location) |
|
| 50 | + { |
|
| 51 | + $viewBuilder = static::getViewBuilder(); |
|
| 52 | + $viewBuilder->addLocation($location); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Get the ViewBuilder instance. |
|
| 57 | - * |
|
| 58 | - * @since 0.1.0 |
|
| 59 | - * |
|
| 60 | - * @return ViewBuilder |
|
| 61 | - * @throws FailedToProcessConfigException If the Config could not be processed. |
|
| 62 | - */ |
|
| 63 | - public static function getViewBuilder() |
|
| 64 | - { |
|
| 65 | - if (null === static::$viewBuilder) { |
|
| 66 | - static::$viewBuilder = static::instantiateViewBuilder(); |
|
| 67 | - } |
|
| 55 | + /** |
|
| 56 | + * Get the ViewBuilder instance. |
|
| 57 | + * |
|
| 58 | + * @since 0.1.0 |
|
| 59 | + * |
|
| 60 | + * @return ViewBuilder |
|
| 61 | + * @throws FailedToProcessConfigException If the Config could not be processed. |
|
| 62 | + */ |
|
| 63 | + public static function getViewBuilder() |
|
| 64 | + { |
|
| 65 | + if (null === static::$viewBuilder) { |
|
| 66 | + static::$viewBuilder = static::instantiateViewBuilder(); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - return static::$viewBuilder; |
|
| 70 | - } |
|
| 69 | + return static::$viewBuilder; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Instantiate the ViewBuilder. |
|
| 74 | - * |
|
| 75 | - * @since 0.1.0 |
|
| 76 | - * |
|
| 77 | - * @param ConfigInterface|null $config Optional. Configuration to pass into the ViewBuilder. |
|
| 78 | - * |
|
| 79 | - * @return ViewBuilder Instance of the ViewBuilder. |
|
| 80 | - * @throws FailedToProcessConfigException If the Config could not be processed. |
|
| 81 | - */ |
|
| 82 | - public static function instantiateViewBuilder(ConfigInterface $config = null) |
|
| 83 | - { |
|
| 84 | - return static::$viewBuilder = new ViewBuilder($config); |
|
| 85 | - } |
|
| 72 | + /** |
|
| 73 | + * Instantiate the ViewBuilder. |
|
| 74 | + * |
|
| 75 | + * @since 0.1.0 |
|
| 76 | + * |
|
| 77 | + * @param ConfigInterface|null $config Optional. Configuration to pass into the ViewBuilder. |
|
| 78 | + * |
|
| 79 | + * @return ViewBuilder Instance of the ViewBuilder. |
|
| 80 | + * @throws FailedToProcessConfigException If the Config could not be processed. |
|
| 81 | + */ |
|
| 82 | + public static function instantiateViewBuilder(ConfigInterface $config = null) |
|
| 83 | + { |
|
| 84 | + return static::$viewBuilder = new ViewBuilder($config); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Create a new view for a given URI. |
|
| 89 | - * |
|
| 90 | - * @since 0.1.0 |
|
| 91 | - * |
|
| 92 | - * @param string $view View identifier to create a view for. |
|
| 93 | - * @param string|null $type Type of view to create. |
|
| 94 | - * |
|
| 95 | - * @return View Instance of the requested view. |
|
| 96 | - * @throws FailedToProcessConfigException If the Config could not be processed. |
|
| 97 | - */ |
|
| 98 | - public static function create($view, $type = null) |
|
| 99 | - { |
|
| 100 | - $viewBuilder = static::getViewBuilder(); |
|
| 87 | + /** |
|
| 88 | + * Create a new view for a given URI. |
|
| 89 | + * |
|
| 90 | + * @since 0.1.0 |
|
| 91 | + * |
|
| 92 | + * @param string $view View identifier to create a view for. |
|
| 93 | + * @param string|null $type Type of view to create. |
|
| 94 | + * |
|
| 95 | + * @return View Instance of the requested view. |
|
| 96 | + * @throws FailedToProcessConfigException If the Config could not be processed. |
|
| 97 | + */ |
|
| 98 | + public static function create($view, $type = null) |
|
| 99 | + { |
|
| 100 | + $viewBuilder = static::getViewBuilder(); |
|
| 101 | 101 | |
| 102 | - return $viewBuilder->create($view, $type); |
|
| 103 | - } |
|
| 102 | + return $viewBuilder->create($view, $type); |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Render a view for a given URI. |
|
| 107 | - * |
|
| 108 | - * @since 0.1.0 |
|
| 109 | - * |
|
| 110 | - * @param string $view View identifier to create a view for. |
|
| 111 | - * @param array $context Optional. The context in which to render the view. |
|
| 112 | - * @param string|null $type Type of view to create. |
|
| 113 | - * |
|
| 114 | - * @return string Rendered HTML content. |
|
| 115 | - * @throws FailedToProcessConfigException If the Config could not be processed. |
|
| 116 | - */ |
|
| 117 | - public static function render($view, array $context = [], $type = null) |
|
| 118 | - { |
|
| 119 | - $viewBuilder = static::getViewBuilder(); |
|
| 120 | - $viewObject = $viewBuilder->create($view, $type); |
|
| 105 | + /** |
|
| 106 | + * Render a view for a given URI. |
|
| 107 | + * |
|
| 108 | + * @since 0.1.0 |
|
| 109 | + * |
|
| 110 | + * @param string $view View identifier to create a view for. |
|
| 111 | + * @param array $context Optional. The context in which to render the view. |
|
| 112 | + * @param string|null $type Type of view to create. |
|
| 113 | + * |
|
| 114 | + * @return string Rendered HTML content. |
|
| 115 | + * @throws FailedToProcessConfigException If the Config could not be processed. |
|
| 116 | + */ |
|
| 117 | + public static function render($view, array $context = [], $type = null) |
|
| 118 | + { |
|
| 119 | + $viewBuilder = static::getViewBuilder(); |
|
| 120 | + $viewObject = $viewBuilder->create($view, $type); |
|
| 121 | 121 | |
| 122 | - return $viewObject->render($context); |
|
| 123 | - } |
|
| 122 | + return $viewObject->render($context); |
|
| 123 | + } |
|
| 124 | 124 | } |
@@ -25,19 +25,19 @@ |
||
| 25 | 25 | class URIs extends ArrayCollection |
| 26 | 26 | { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Create a new URIs from a Symfony Finder instance. |
|
| 30 | - * |
|
| 31 | - * @since 0.1.3 |
|
| 32 | - * |
|
| 33 | - * @param Finder $finder The Finder instance to create the URI collection from. |
|
| 34 | - * |
|
| 35 | - * @return URIs New URIs instance. |
|
| 36 | - */ |
|
| 37 | - public static function fromFinder(Finder $finder): URIs |
|
| 38 | - { |
|
| 39 | - $elements = array_keys(iterator_to_array($finder)); |
|
| 28 | + /** |
|
| 29 | + * Create a new URIs from a Symfony Finder instance. |
|
| 30 | + * |
|
| 31 | + * @since 0.1.3 |
|
| 32 | + * |
|
| 33 | + * @param Finder $finder The Finder instance to create the URI collection from. |
|
| 34 | + * |
|
| 35 | + * @return URIs New URIs instance. |
|
| 36 | + */ |
|
| 37 | + public static function fromFinder(Finder $finder): URIs |
|
| 38 | + { |
|
| 39 | + $elements = array_keys(iterator_to_array($finder)); |
|
| 40 | 40 | |
| 41 | - return new static($elements); |
|
| 42 | - } |
|
| 41 | + return new static($elements); |
|
| 42 | + } |
|
| 43 | 43 | } |
@@ -22,25 +22,25 @@ |
||
| 22 | 22 | interface Location |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Get the first URI that matches the given criteria. |
|
| 27 | - * |
|
| 28 | - * @since 0.1.0 |
|
| 29 | - * |
|
| 30 | - * @param array $criteria Criteria to match. |
|
| 31 | - * |
|
| 32 | - * @return string|false URI that matches the criteria or false if none found. |
|
| 33 | - */ |
|
| 34 | - public function getURI(array $criteria); |
|
| 25 | + /** |
|
| 26 | + * Get the first URI that matches the given criteria. |
|
| 27 | + * |
|
| 28 | + * @since 0.1.0 |
|
| 29 | + * |
|
| 30 | + * @param array $criteria Criteria to match. |
|
| 31 | + * |
|
| 32 | + * @return string|false URI that matches the criteria or false if none found. |
|
| 33 | + */ |
|
| 34 | + public function getURI(array $criteria); |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Get all URIs that match the given criteria. |
|
| 38 | - * |
|
| 39 | - * @since 0.1.1 |
|
| 40 | - * |
|
| 41 | - * @param array $criteria Criteria to match. |
|
| 42 | - * |
|
| 43 | - * @return URIs Collection of URIs that matches the criteria or an empty collection if none found. |
|
| 44 | - */ |
|
| 45 | - public function getURIs(array $criteria): URIs; |
|
| 36 | + /** |
|
| 37 | + * Get all URIs that match the given criteria. |
|
| 38 | + * |
|
| 39 | + * @since 0.1.1 |
|
| 40 | + * |
|
| 41 | + * @param array $criteria Criteria to match. |
|
| 42 | + * |
|
| 43 | + * @return URIs Collection of URIs that matches the criteria or an empty collection if none found. |
|
| 44 | + */ |
|
| 45 | + public function getURIs(array $criteria): URIs; |
|
| 46 | 46 | } |
@@ -24,37 +24,37 @@ |
||
| 24 | 24 | class Locations extends ArrayCollection |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Adds a location at the end of the collection if it does not already exist. |
|
| 29 | - * |
|
| 30 | - * @param mixed $location The location to add. |
|
| 31 | - * |
|
| 32 | - * @return bool Whether the location was added or not. |
|
| 33 | - */ |
|
| 34 | - public function add($location): bool |
|
| 35 | - { |
|
| 36 | - if ($this->hasLocation($location)) { |
|
| 37 | - return false; |
|
| 38 | - } |
|
| 27 | + /** |
|
| 28 | + * Adds a location at the end of the collection if it does not already exist. |
|
| 29 | + * |
|
| 30 | + * @param mixed $location The location to add. |
|
| 31 | + * |
|
| 32 | + * @return bool Whether the location was added or not. |
|
| 33 | + */ |
|
| 34 | + public function add($location): bool |
|
| 35 | + { |
|
| 36 | + if ($this->hasLocation($location)) { |
|
| 37 | + return false; |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - return parent::add($location); |
|
| 41 | - } |
|
| 40 | + return parent::add($location); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Check whether a given location is already registered. |
|
| 45 | - * |
|
| 46 | - * For two locations to be equal, both their path and their extensions must be the same. |
|
| 47 | - * |
|
| 48 | - * @since 0.1.1 |
|
| 49 | - * |
|
| 50 | - * @param Location $location Location to check the existence of. |
|
| 51 | - * |
|
| 52 | - * @return bool Whether the location is already registered or not. |
|
| 53 | - */ |
|
| 54 | - public function hasLocation(Location $location): bool |
|
| 55 | - { |
|
| 56 | - return $this->exists(function ($key, $element) use ($location) { |
|
| 57 | - return $location == $element; |
|
| 58 | - }); |
|
| 59 | - } |
|
| 43 | + /** |
|
| 44 | + * Check whether a given location is already registered. |
|
| 45 | + * |
|
| 46 | + * For two locations to be equal, both their path and their extensions must be the same. |
|
| 47 | + * |
|
| 48 | + * @since 0.1.1 |
|
| 49 | + * |
|
| 50 | + * @param Location $location Location to check the existence of. |
|
| 51 | + * |
|
| 52 | + * @return bool Whether the location is already registered or not. |
|
| 53 | + */ |
|
| 54 | + public function hasLocation(Location $location): bool |
|
| 55 | + { |
|
| 56 | + return $this->exists(function ($key, $element) use ($location) { |
|
| 57 | + return $location == $element; |
|
| 58 | + }); |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -22,14 +22,14 @@ |
||
| 22 | 22 | interface Findable |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Check whether the Findable can handle an individual criterion. |
|
| 27 | - * |
|
| 28 | - * @since 0.1.0 |
|
| 29 | - * |
|
| 30 | - * @param mixed $criterion Criterion to check. |
|
| 31 | - * |
|
| 32 | - * @return bool Whether the Findable can handle the criterion. |
|
| 33 | - */ |
|
| 34 | - public function canHandle($criterion): bool; |
|
| 25 | + /** |
|
| 26 | + * Check whether the Findable can handle an individual criterion. |
|
| 27 | + * |
|
| 28 | + * @since 0.1.0 |
|
| 29 | + * |
|
| 30 | + * @param mixed $criterion Criterion to check. |
|
| 31 | + * |
|
| 32 | + * @return bool Whether the Findable can handle the criterion. |
|
| 33 | + */ |
|
| 34 | + public function canHandle($criterion): bool; |
|
| 35 | 35 | } |
@@ -24,24 +24,24 @@ |
||
| 24 | 24 | class Extensions extends ArrayCollection |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Check whether a given URI has a specific extension. |
|
| 29 | - * |
|
| 30 | - * @since 0.1.0 |
|
| 31 | - * |
|
| 32 | - * @param string $uri URI to check the extension of. |
|
| 33 | - * @param string $extension Extension to check for. |
|
| 34 | - * |
|
| 35 | - * @return bool |
|
| 36 | - */ |
|
| 37 | - public static function hasExtension(string $uri, string $extension): bool |
|
| 38 | - { |
|
| 39 | - $uriLength = mb_strlen($uri); |
|
| 40 | - $extensionLength = mb_strlen($extension); |
|
| 41 | - if ($extensionLength > $uriLength) { |
|
| 42 | - return false; |
|
| 43 | - } |
|
| 27 | + /** |
|
| 28 | + * Check whether a given URI has a specific extension. |
|
| 29 | + * |
|
| 30 | + * @since 0.1.0 |
|
| 31 | + * |
|
| 32 | + * @param string $uri URI to check the extension of. |
|
| 33 | + * @param string $extension Extension to check for. |
|
| 34 | + * |
|
| 35 | + * @return bool |
|
| 36 | + */ |
|
| 37 | + public static function hasExtension(string $uri, string $extension): bool |
|
| 38 | + { |
|
| 39 | + $uriLength = mb_strlen($uri); |
|
| 40 | + $extensionLength = mb_strlen($extension); |
|
| 41 | + if ($extensionLength > $uriLength) { |
|
| 42 | + return false; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - return substr_compare($uri, $extension, $uriLength - $extensionLength, $extensionLength) === 0; |
|
| 46 | - } |
|
| 45 | + return substr_compare($uri, $extension, $uriLength - $extensionLength, $extensionLength) === 0; |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -24,58 +24,58 @@ |
||
| 24 | 24 | interface View extends Findable |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Check whether the Findable can handle an individual criterion. |
|
| 29 | - * |
|
| 30 | - * @since 0.1.0 |
|
| 31 | - * |
|
| 32 | - * @param mixed $criterion Criterion to check. |
|
| 33 | - * |
|
| 34 | - * @return bool Whether the Findable can handle the criterion. |
|
| 35 | - */ |
|
| 36 | - public function canHandle($criterion): bool; |
|
| 27 | + /** |
|
| 28 | + * Check whether the Findable can handle an individual criterion. |
|
| 29 | + * |
|
| 30 | + * @since 0.1.0 |
|
| 31 | + * |
|
| 32 | + * @param mixed $criterion Criterion to check. |
|
| 33 | + * |
|
| 34 | + * @return bool Whether the Findable can handle the criterion. |
|
| 35 | + */ |
|
| 36 | + public function canHandle($criterion): bool; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Render the view. |
|
| 40 | - * |
|
| 41 | - * @since 0.1.0 |
|
| 42 | - * |
|
| 43 | - * @param array $context Optional. The context in which to render the view. |
|
| 44 | - * |
|
| 45 | - * @return string Rendered HTML. |
|
| 46 | - */ |
|
| 47 | - public function render(array $context = []): string; |
|
| 38 | + /** |
|
| 39 | + * Render the view. |
|
| 40 | + * |
|
| 41 | + * @since 0.1.0 |
|
| 42 | + * |
|
| 43 | + * @param array $context Optional. The context in which to render the view. |
|
| 44 | + * |
|
| 45 | + * @return string Rendered HTML. |
|
| 46 | + */ |
|
| 47 | + public function render(array $context = []): string; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Render a partial view (or section) for a given URI. |
|
| 51 | - * |
|
| 52 | - * @since 0.2.0 |
|
| 53 | - * |
|
| 54 | - * @param string $view View identifier to create a view for. |
|
| 55 | - * @param array $context Optional. The context in which to render the view. |
|
| 56 | - * @param string|null $type Type of view to create. |
|
| 57 | - * |
|
| 58 | - * @return string Rendered HTML content. |
|
| 59 | - */ |
|
| 60 | - public function section(string $view, array $context = [], $type = null): string; |
|
| 49 | + /** |
|
| 50 | + * Render a partial view (or section) for a given URI. |
|
| 51 | + * |
|
| 52 | + * @since 0.2.0 |
|
| 53 | + * |
|
| 54 | + * @param string $view View identifier to create a view for. |
|
| 55 | + * @param array $context Optional. The context in which to render the view. |
|
| 56 | + * @param string|null $type Type of view to create. |
|
| 57 | + * |
|
| 58 | + * @return string Rendered HTML content. |
|
| 59 | + */ |
|
| 60 | + public function section(string $view, array $context = [], $type = null): string; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Get the entire array of contextual data. |
|
| 64 | - * |
|
| 65 | - * @since 0.4.0 |
|
| 66 | - * |
|
| 67 | - * @return array Array of contextual data. |
|
| 68 | - */ |
|
| 69 | - public function getContext(): array; |
|
| 62 | + /** |
|
| 63 | + * Get the entire array of contextual data. |
|
| 64 | + * |
|
| 65 | + * @since 0.4.0 |
|
| 66 | + * |
|
| 67 | + * @return array Array of contextual data. |
|
| 68 | + */ |
|
| 69 | + public function getContext(): array; |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Associate a view builder with this view. |
|
| 73 | - * |
|
| 74 | - * @since 0.2.0 |
|
| 75 | - * |
|
| 76 | - * @param ViewBuilder $builder |
|
| 77 | - * |
|
| 78 | - * @return View |
|
| 79 | - */ |
|
| 80 | - public function setBuilder(ViewBuilder $builder): View; |
|
| 71 | + /** |
|
| 72 | + * Associate a view builder with this view. |
|
| 73 | + * |
|
| 74 | + * @since 0.2.0 |
|
| 75 | + * |
|
| 76 | + * @param ViewBuilder $builder |
|
| 77 | + * |
|
| 78 | + * @return View |
|
| 79 | + */ |
|
| 80 | + public function setBuilder(ViewBuilder $builder): View; |
|
| 81 | 81 | } |
@@ -22,17 +22,17 @@ |
||
| 22 | 22 | class BaseView extends AbstractView |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Check whether the Findable can handle an individual criterion. |
|
| 27 | - * |
|
| 28 | - * @since 0.1.0 |
|
| 29 | - * |
|
| 30 | - * @param mixed $criterion Criterion to check. |
|
| 31 | - * |
|
| 32 | - * @return bool Whether the Findable can handle the criterion. |
|
| 33 | - */ |
|
| 34 | - public function canHandle($criterion): bool |
|
| 35 | - { |
|
| 36 | - return true; |
|
| 37 | - } |
|
| 25 | + /** |
|
| 26 | + * Check whether the Findable can handle an individual criterion. |
|
| 27 | + * |
|
| 28 | + * @since 0.1.0 |
|
| 29 | + * |
|
| 30 | + * @param mixed $criterion Criterion to check. |
|
| 31 | + * |
|
| 32 | + * @return bool Whether the Findable can handle the criterion. |
|
| 33 | + */ |
|
| 34 | + public function canHandle($criterion): bool |
|
| 35 | + { |
|
| 36 | + return true; |
|
| 37 | + } |
|
| 38 | 38 | } |
@@ -26,74 +26,74 @@ |
||
| 26 | 26 | class NullView implements View, NullFindable |
| 27 | 27 | { |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Check whether the Findable can handle an individual criterion. |
|
| 31 | - * |
|
| 32 | - * @since 0.1.0 |
|
| 33 | - * |
|
| 34 | - * @param mixed $criterion Criterion to check. |
|
| 35 | - * |
|
| 36 | - * @return bool Whether the Findable can handle the criterion. |
|
| 37 | - */ |
|
| 38 | - public function canHandle($criterion): bool |
|
| 39 | - { |
|
| 40 | - return true; |
|
| 41 | - } |
|
| 29 | + /** |
|
| 30 | + * Check whether the Findable can handle an individual criterion. |
|
| 31 | + * |
|
| 32 | + * @since 0.1.0 |
|
| 33 | + * |
|
| 34 | + * @param mixed $criterion Criterion to check. |
|
| 35 | + * |
|
| 36 | + * @return bool Whether the Findable can handle the criterion. |
|
| 37 | + */ |
|
| 38 | + public function canHandle($criterion): bool |
|
| 39 | + { |
|
| 40 | + return true; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Render the view. |
|
| 45 | - * |
|
| 46 | - * @since 0.1.0 |
|
| 47 | - * |
|
| 48 | - * @param array $context Optional. The context in which to render the view. |
|
| 49 | - * @param bool $echo Optional. Whether to echo the output immediately. Defaults to false. |
|
| 50 | - * |
|
| 51 | - * @return string Rendered HTML. |
|
| 52 | - */ |
|
| 53 | - public function render(array $context = [], bool $echo = false): string |
|
| 54 | - { |
|
| 55 | - return ''; |
|
| 56 | - } |
|
| 43 | + /** |
|
| 44 | + * Render the view. |
|
| 45 | + * |
|
| 46 | + * @since 0.1.0 |
|
| 47 | + * |
|
| 48 | + * @param array $context Optional. The context in which to render the view. |
|
| 49 | + * @param bool $echo Optional. Whether to echo the output immediately. Defaults to false. |
|
| 50 | + * |
|
| 51 | + * @return string Rendered HTML. |
|
| 52 | + */ |
|
| 53 | + public function render(array $context = [], bool $echo = false): string |
|
| 54 | + { |
|
| 55 | + return ''; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * Render a partial view (or section) for a given URI. |
|
| 60 | - * |
|
| 61 | - * @since 0.2.0 |
|
| 62 | - * |
|
| 63 | - * @param string $view View identifier to create a view for. |
|
| 64 | - * @param array $context Optional. The context in which to render the view. |
|
| 65 | - * @param string|null $type Type of view to create. |
|
| 66 | - * |
|
| 67 | - * @return string Rendered HTML content. |
|
| 68 | - */ |
|
| 69 | - public function section(string $view, array $context = [], $type = null): string |
|
| 70 | - { |
|
| 71 | - return ''; |
|
| 72 | - } |
|
| 58 | + /** |
|
| 59 | + * Render a partial view (or section) for a given URI. |
|
| 60 | + * |
|
| 61 | + * @since 0.2.0 |
|
| 62 | + * |
|
| 63 | + * @param string $view View identifier to create a view for. |
|
| 64 | + * @param array $context Optional. The context in which to render the view. |
|
| 65 | + * @param string|null $type Type of view to create. |
|
| 66 | + * |
|
| 67 | + * @return string Rendered HTML content. |
|
| 68 | + */ |
|
| 69 | + public function section(string $view, array $context = [], $type = null): string |
|
| 70 | + { |
|
| 71 | + return ''; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * Get the entire array of contextual data. |
|
| 76 | - * |
|
| 77 | - * @since 0.4.0 |
|
| 78 | - * |
|
| 79 | - * @return array Array of contextual data. |
|
| 80 | - */ |
|
| 81 | - public function getContext(): array |
|
| 82 | - { |
|
| 83 | - return []; |
|
| 84 | - } |
|
| 74 | + /** |
|
| 75 | + * Get the entire array of contextual data. |
|
| 76 | + * |
|
| 77 | + * @since 0.4.0 |
|
| 78 | + * |
|
| 79 | + * @return array Array of contextual data. |
|
| 80 | + */ |
|
| 81 | + public function getContext(): array |
|
| 82 | + { |
|
| 83 | + return []; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * Associate a view builder with this view. |
|
| 88 | - * |
|
| 89 | - * @since 0.2.0 |
|
| 90 | - * |
|
| 91 | - * @param ViewBuilder $builder |
|
| 92 | - * |
|
| 93 | - * @return View |
|
| 94 | - */ |
|
| 95 | - public function setBuilder(ViewBuilder $builder): View |
|
| 96 | - { |
|
| 97 | - return $this; |
|
| 98 | - } |
|
| 86 | + /** |
|
| 87 | + * Associate a view builder with this view. |
|
| 88 | + * |
|
| 89 | + * @since 0.2.0 |
|
| 90 | + * |
|
| 91 | + * @param ViewBuilder $builder |
|
| 92 | + * |
|
| 93 | + * @return View |
|
| 94 | + */ |
|
| 95 | + public function setBuilder(ViewBuilder $builder): View |
|
| 96 | + { |
|
| 97 | + return $this; |
|
| 98 | + } |
|
| 99 | 99 | } |