Classes/Repository/Demand.php
public static function createFromRequest(ServerRequestInterface $request): Demand
    {
        $page = (int)($request->getQueryParams()['page'] ?? $request->getParsedBody()['page'] ?? 1);
        $demand = $request->getQueryParams()['demand'] ?? $request->getParsedBody()['demand'];
        if (empty($demand)) {
            return new self($page);
        }
        $sourceHost = $demand['source_host'] ?? '';
        $sourcePath = $demand['source_path'] ?? '';
        $statusCode = (int)$demand['target_statuscode'] ?? 0;
        $target = $demand['target'] ?? '';
        return new self($page, $sourceHost, $sourcePath, $target, $statusCode);
    }
public static function createFromRequest(ServerRequestInterface $request): Demand
    {
        $page = (int)($request->getQueryParams()['page'] ?? $request->getParsedBody()['page'] ?? 1);
        $demand = $request->getQueryParams()['demand'] ?? $request->getParsedBody()['demand'];
        if (empty($demand)) {
            return new self($page);
        }
        $sourceHost = $demand['source_host'] ?? '';
        $sourcePath = $demand['source_path'] ?? '';
        $statusCode = (int)$demand['target_statuscode'] ?? 0;
        $target = $demand['target'] ?? '';
        return new self($page, $sourceHost, $sourcePath, $target, $statusCode);
    }
public static function createFromRequest ( ServerRequestInterface $ request ) : Demand { $ page = ( int ) ( $ request -> getQueryParams ( ) [ 'page' ] ?? $ request -> getParsedBody ( ) [ 'page' ] ?? 1 ) ; $ demand = $ request -> getQueryParams ( ) [ 'demand' ] ?? $ request -> getParsedBody ( ) [ 'demand' ] ; if ( empty ( $ demand ) ) { return new self ( $ page ) ; } $ sourceHost = $ demand [ 'source_host' ] ?? '' ; $ sourcePath = $ demand [ 'source_path' ] ?? '' ; $ statusCode = ( int ) $ demand [ 'target_statuscode' ] ?? 0 ; $ target = $ demand [ 'target' ] ?? '' ; return new self ( $ page , $ sourceHost , $ sourcePath , $ target , $ statusCode ) ; }
Creates a Demand object from the current request.

@param ServerRequestInterface $request
@return Demand
Creates a Demand object from the current request .