-
Notifications
You must be signed in to change notification settings - Fork 6
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
24ac9dd
commit 6671171
Showing
2 changed files
with
28 additions
and
0 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,25 @@ | ||
<?php | ||
|
||
namespace BNETDocs\Views\Packet; | ||
|
||
use \BNETDocs\Models\Packet\View as PacketViewModel; | ||
|
||
use \CarlBennett\MVC\Libraries\Common; | ||
use \CarlBennett\MVC\Libraries\Exceptions\IncorrectModelException; | ||
use \CarlBennett\MVC\Libraries\Model; | ||
use \CarlBennett\MVC\Libraries\View; | ||
|
||
class ViewJSON extends View { | ||
|
||
public function getMimeType() { | ||
return 'application/json;charset=utf-8'; | ||
} | ||
|
||
public function render( Model &$model ) { | ||
if ( !$model instanceof PacketViewModel ) { | ||
throw new IncorrectModelException(); | ||
} | ||
echo json_encode( $model->packet, Common::prettyJSONIfBrowser() ); | ||
} | ||
|
||
} |