for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php declare(strict_types=1);
namespace EdmondsCommerce\MockServer;
use Symfony\Component\HttpFoundation\Request;
/**
* Class Factory
*
* @package EdmondsCommerce\MockServer
* @SuppressWarnings(PHPMD.StaticAccess)
*/
class Factory
{
* @return MockServer
* @throws \Exception
public static function getMockServer(): MockServer
return new MockServer(
MockServerConfig::getRouterPath(),
MockServerConfig::getHtdocsPath(),
MockServerConfig::getIp(),
MockServerConfig::getPort()
);
}
* @return StaticRouter
* @throws \RuntimeException
public static function getStaticRouter(): StaticRouter
return new StaticRouter(
MockServerConfig::getHtdocsPath()
* @return Request
public static function getLastRequest(): Request
$requestPath = MockServerConfig::getLogsPath().'/'.MockServer::REQUEST_FILE;
$serialized = file_get_contents($requestPath);
if (empty($serialized)) {
throw new \RuntimeException('request log file ['.$requestPath.'] is empty');
return unserialize($serialized, ['allowed_classes' => [Request::class]]);