icingaweb2-module-businessp.../library/Businessprocess/Web/Url.php
2018-08-01 09:37:23 +02:00

35 lines
731 B
PHP

<?php
namespace Icinga\Module\Businessprocess\Web;
use Icinga\Application\Icinga;
use Icinga\Web\Url as WebUrl;
/**
* Class Url
*
* The main purpose of this class is to get unit tests running on CLI
*
* @package Icinga\Module\Businessprocess\Web
*/
class Url extends WebUrl
{
public function setBasePath($basePath)
{
if (property_exists($this, 'basePath')) {
parent::setBasePath($basePath);
} else {
return $this->setBaseUrl($basePath);
}
}
protected static function getRequest()
{
$app = Icinga::app();
if ($app->isCli()) {
return new FakeRequest();
} else {
return $app->getRequest();
}
}
}