for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* OnResponseHandler.php
*
* @copyright More in license.md
* @license https://www.ipublikuj.eu
* @author Adam Kadlec <[email protected]>
* @package iPublikuj:MobileDetect!
* @subpackage Events
* @since 1.0.0
* @date 23.04.14
*/
declare(strict_types = 1);
namespace IPub\MobileDetect\Events;
use Nette\Application;
use IPub\MobileDetect\Helpers\DeviceView;
* On response event handler
final class OnResponseHandler
{
* @var bool
private $needModifyResponse = FALSE;
* @var DeviceView
private $deviceView;
* @var \Closure
public $modifyResponseClosure;
* @param DeviceView $deviceView
public function __construct(DeviceView $deviceView)
$this->deviceView = $deviceView;
}
* Stores information about modifying response
* @return void
public function needModifyResponse() : void
$this->needModifyResponse = TRUE;
* @param Application\Application $application
public function __invoke(Application\Application $application) : void
if ($this->needModifyResponse && $this->modifyResponseClosure instanceof \Closure) {
$modifyClosure = $this->modifyResponseClosure;
$modifyClosure($this->deviceView);