-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a facade to call Phug static methods
- Loading branch information
1 parent
3090a03
commit 801c8a3
Showing
17 changed files
with
219 additions
and
174 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 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,26 @@ | ||
<?php | ||
|
||
namespace Pug; | ||
|
||
use Phug\Phug; | ||
|
||
/** | ||
* Class Pug\Pug. | ||
*/ | ||
class Facade | ||
{ | ||
/** | ||
* Set Pug\Pug as the default Phug rendering engine then call static method through the Phug facade. | ||
* | ||
* @param string $name | ||
* @param array $arguments | ||
* | ||
* @return mixed | ||
*/ | ||
public static function __callStatic($name, $arguments) | ||
{ | ||
Pug::init(); | ||
|
||
return call_user_func_array([Phug::class, $name], $arguments); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
use Pug\Facade as Pug; | ||
|
||
class FacadeTest extends PHPUnit_Framework_TestCase | ||
{ | ||
public function testFacade() | ||
{ | ||
$html = Pug::render('p=foo', ['foo' => 'bar']); | ||
self::assertSame('<p>bar</p>', $html); | ||
|
||
Pug::share('pi', 3.14); | ||
$html = Pug::render('=2 * pi'); | ||
self::assertSame('6.28', $html); | ||
} | ||
} |
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.