for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* PsrAjaxMiddleware.php
*
* A Psr7 middleware to process Jaxon ajax requests.
* @package jaxon-core
* @author Thierry Feuzeu <[email protected]>
* @copyright 2022 Thierry Feuzeu <[email protected]>
* @license https://opensource.org/licenses/BSD-3-Clause BSD 3-Clause License
* @link https://github.com/jaxon-php/jaxon-core
*/
namespace Jaxon\Request\Handler\Psr;
use Jaxon\Di\Container;
use Jaxon\Exception\SetupException;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
class PsrConfigMiddleware implements MiddlewareInterface
{
* @var Container
private $di;
* @var string
private $sConfigFile;
* The constructor
* @param Container $di
* @param string $sConfigFile
public function __construct(Container $di, string $sConfigFile)
$this->di = $di;
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
$this->sConfigFile = $sConfigFile;
}
$request
$handler
* @inheritDoc
* @throws SetupException
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
// Load the config
$this->di->getApp()->setup($this->sConfigFile);
// Next
return $handler->handle($request);