-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from mauricius/feature/php83
Upgrade dependencies
- Loading branch information
Showing
5 changed files
with
33 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,12 @@ | |
namespace ProcessWire; | ||
|
||
use Jenssegers\Blade\Blade; | ||
use Jenssegers\Blade\Container; | ||
|
||
/** | ||
* Wireframe Renderer Blade | ||
* | ||
* @version 0.2.0 | ||
* @version 0.3.0 | ||
* @author Maurizio Bonani <[email protected]> | ||
* @license Mozilla Public License v2.0 https://mozilla.org/MPL/2.0/ | ||
*/ | ||
|
@@ -20,14 +21,14 @@ class WireframeRendererBlade extends Wire implements Module | |
* | ||
* @var Blade | ||
*/ | ||
protected $blade; | ||
protected Blade $blade; | ||
|
||
/** | ||
* Default extension. | ||
* | ||
* @var string | ||
*/ | ||
protected $ext = 'blade.php'; | ||
protected string $ext = 'blade.php'; | ||
|
||
/** | ||
* Init method | ||
|
@@ -52,6 +53,7 @@ public function ___init(array $settings = []): WireframeRendererBlade | |
* | ||
* @param array $settings Blade settings. | ||
* @return Blade | ||
* @throws WireException | ||
*/ | ||
public function ___initBlade(array $settings = []): Blade | ||
{ | ||
|
@@ -62,7 +64,8 @@ public function ___initBlade(array $settings = []): Blade | |
$views = $settings['views'] ?? $viewPaths['view']; | ||
$cache = $settings['cache'] ?? $this->wire('config')->paths->cache . 'WireframeRendererBlade'; | ||
|
||
$blade = new Blade($views, $cache); | ||
// see https://github.com/jenssegers/blade/issues/74 | ||
$blade = new Blade($views, $cache, Container::getInstance()); | ||
|
||
$blade->addNamespace('layout', $viewPaths['layout']); | ||
$blade->addNamespace('partial', $viewPaths['partial']); | ||
|
@@ -82,7 +85,7 @@ public function ___initBlade(array $settings = []): Blade | |
*/ | ||
public function render(string $type, string $view, array $context = []): string | ||
{ | ||
if (! in_array($type, array_keys($this->wire('modules')->get('Wireframe')->getViewPaths()))) { | ||
if (! in_array($type, array_keys($this->wire('modules')->get('Wireframe')->getViewPaths()), true)) { | ||
throw new WireException(sprintf('Unexpected type (%s).', $type)); | ||
} | ||
|
||
|
@@ -102,18 +105,18 @@ public function render(string $type, string $view, array $context = []): string | |
* @param string $view | ||
* @return string | ||
*/ | ||
protected function namespaceView(string $type, string $view) | ||
protected function namespaceView(string $type, string $view): string | ||
{ | ||
return $type . '::' . $view; | ||
} | ||
|
||
/** | ||
* Adapt view path to Blade notation. | ||
* | ||
* @param string $view | ||
* @param string $view | ||
* @return string | ||
*/ | ||
protected function adaptView($view) | ||
protected function adaptView(string $view): string | ||
{ | ||
return preg_replace('/.'. $this->ext . '$/', '', str_replace('/', '.', $view)); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters