-
Notifications
You must be signed in to change notification settings - Fork 45
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 #14 from tastphp/v1.4.1
clean code && add Response compoment
- Loading branch information
Showing
6 changed files
with
61 additions
and
5 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
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,14 @@ | ||
<?php | ||
|
||
namespace TastPHP\Framework\Response; | ||
|
||
use Symfony\Component\HttpFoundation\Response as SymfonyResponse; | ||
|
||
/** | ||
* Class Response | ||
* @package TastPHP\Framework\Request | ||
*/ | ||
class Response extends SymfonyResponse | ||
{ | ||
|
||
} |
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,34 @@ | ||
<?php | ||
|
||
namespace TastPHP\Framework\Response; | ||
|
||
/** | ||
* Class ResponseAdapter | ||
* @package TastPHP\Framework\Response | ||
*/ | ||
class ResponseAdapter | ||
{ | ||
/** | ||
* @param Response $symfonyResponse | ||
* @return psrResponse | ||
*/ | ||
public static function convertPsr7Response(Response $symfonyResponse) | ||
{ | ||
$app = \Kernel::getInstance(); | ||
$psr7Factory = $app['psr7Factory']; | ||
|
||
return $psr7Factory->createResponse($symfonyResponse); | ||
} | ||
|
||
/** | ||
* @param $psrResponse | ||
* @return SymfonyResponse | ||
*/ | ||
public static function convertSymfonyResponse($psrResponse) | ||
{ | ||
$app = \Kernel::getInstance(); | ||
$httpFoundationFactory = $app['httpFoundationFactory']; | ||
|
||
return $httpFoundationFactory->createResponse($psrResponse); | ||
} | ||
} |