-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d299bcd
commit 11fd2f0
Showing
6 changed files
with
97 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Phug; | ||
|
||
use Phug\Util\Partial\OptionTrait; | ||
|
||
class OptionsBundle | ||
{ | ||
use OptionTrait; | ||
} |
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,48 @@ | ||
<?php | ||
|
||
namespace Phug\Partial; | ||
|
||
use ArrayObject; | ||
use Phug\OptionsBundle; | ||
|
||
trait FacadeOptionsTrait | ||
{ | ||
/** | ||
* @var OptionsBundle | ||
*/ | ||
private static $options = null; | ||
|
||
protected static function resetFacadeOptions() | ||
{ | ||
static::$options = null; | ||
} | ||
|
||
protected static function callOption($method, array $arguments) | ||
{ | ||
if (!static::$options) { | ||
static::$options = new OptionsBundle(); | ||
} | ||
|
||
return call_user_func_array([static::$options, $method], $arguments); | ||
} | ||
|
||
protected static function isOptionMethod($method) | ||
{ | ||
return in_array($method, [ | ||
'hasOption', | ||
'getOption', | ||
'setOption', | ||
'setOptions', | ||
'setOptionsRecursive', | ||
'setOptionsDefaults', | ||
'unsetOption', | ||
]); | ||
} | ||
|
||
protected static function getFacadeOptions() | ||
{ | ||
$options = static::$options ? (static::$options->getOptions() ?: []) : []; | ||
|
||
return $options instanceof ArrayObject ? $options->getArrayCopy() : $options; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
|
||
class TCompiler extends \Phug\Compiler | ||
{ | ||
} |
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,5 @@ | ||
<?php | ||
|
||
class TParser extends \Phug\Parser | ||
{ | ||
} |