-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wrapping mustache engine to suppress deprecations
- Loading branch information
1 parent
48540c2
commit 9c649ea
Showing
25 changed files
with
163 additions
and
151 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace CarbonPHP\Extras; | ||
|
||
use CarbonPHP\Error\ThrowableHandler; | ||
use Mustache_Engine; | ||
use Throwable; | ||
|
||
class MustacheEngine extends Mustache_Engine | ||
{ | ||
public function __construct(array $options = []) | ||
{ | ||
try { | ||
|
||
ThrowableHandler::stop(); | ||
|
||
error_reporting(ThrowableHandler::$level ^ (E_NOTICE | E_WARNING | E_DEPRECATED)); | ||
|
||
// @note if the Mustache_Engine fails, then tries to re-load itsself the message will say "Class "Mustache_Engine" not found" | ||
// This is very deceptive as the class is found, but failing to be loaded via compile time error. E_DEPRECATED is the first sign | ||
parent::__construct($options); | ||
|
||
ThrowableHandler::start(); | ||
|
||
} catch (Throwable $e) { | ||
|
||
sortDump(['Mustache_Engine Failed', $e->getMessage(), $e->getTraceAsString()]); | ||
|
||
exit(11); | ||
|
||
} | ||
} | ||
|
||
public function render($template, $context = array()) | ||
{ | ||
try { | ||
|
||
ThrowableHandler::stop(); | ||
|
||
error_reporting(ThrowableHandler::$level ^ (E_NOTICE | E_WARNING | E_DEPRECATED)); | ||
|
||
// @note if the Mustache_Engine fails, then tries to re-load itsself the message will say "Class "Mustache_Engine" not found" | ||
// This is very deceptive as the class is found, but failing to be loaded via compile time error. E_DEPRECATED is the first sign | ||
$result = parent::render($template, $context); | ||
|
||
ThrowableHandler::start(); | ||
|
||
return $result; | ||
|
||
} catch (Throwable $e) { | ||
|
||
sortDump(['Mustache_Engine Failed', $e->getMessage(), $context]); | ||
|
||
exit(11); | ||
|
||
} | ||
} | ||
} | ||
|
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
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
Oops, something went wrong.