private function collectData(
        string $token,
        ServerRequestInterface $serverRequest,
        ResponseInterface $response
    ): void {
        // sort on priority
        \usort($this->collectors, static function ($a, $b) {
            return $a['priority'] <=> $b['priority'];
        });

        foreach ($this->collectors as $name => $collector) {
            $collector['collector']->collect($serverRequest, $response);

            $this->collectors[$name]['collector'] = $collector['collector'];
        }

        $ip = (new ClientIp($serverRequest))->getIpAddress();

        if ($this->cachePool !== null) {
            $this->createProfile(
                $token,
                $ip ?? 'Unknown',
                $serverRequest->getMethod(),
                (string) $serverRequest->getUri(),
                $response->getStatusCode(),
                \microtime(true),
                \date('Y-m-d H:i:s'),
                $this->collectors
            );
        }
    }
private function collectData(
        string $token,
        ServerRequestInterface $serverRequest,
        ResponseInterface $response
    ): void {
        // sort on priority
        \usort($this->collectors, static function ($a, $b) {
            return $a['priority'] <=> $b['priority'];
        });

        foreach ($this->collectors as $name => $collector) {
            $collector['collector']->collect($serverRequest, $response);

            $this->collectors[$name]['collector'] = $collector['collector'];
        }

        $ip = (new ClientIp($serverRequest))->getIpAddress();

        if ($this->cachePool !== null) {
            $this->createProfile(
                $token,
                $ip ?? 'Unknown',
                $serverRequest->getMethod(),
                (string) $serverRequest->getUri(),
                $response->getStatusCode(),
                \microtime(true),
                \date('Y-m-d H:i:s'),
                $this->collectors
            );
        }
    }
private function collectData ( string $ token , ServerRequestInterface $ serverRequest , ResponseInterface $ response ) : void { // sort on priority \ usort ( $ this -> collectors , static function ( $ a , $ b ) { return $ a [ 'priority' ] <=> $ b [ 'priority' ] ; } ) ; foreach ( $ this -> collectors as $ name => $ collector ) { $ collector [ 'collector' ] -> collect ( $ serverRequest , $ response ) ; $ this -> collectors [ $ name ] [ 'collector' ] = $ collector [ 'collector' ] ; } $ ip = ( new ClientIp ( $ serverRequest ) ) -> getIpAddress ( ) ; if ( $ this -> cachePool !== null ) { $ this -> createProfile ( $ token , $ ip ?? 'Unknown' , $ serverRequest -> getMethod ( ) , ( string ) $ serverRequest -> getUri ( ) , $ response -> getStatusCode ( ) , \ microtime ( true ) , \ date ( 'Y-m-d H:i:s' ) , $ this -> collectors ) ; } }
Collect data and create a new profile and save it.

@param string                                   $token
@param \Psr\Http\Message\ServerRequestInterface $serverRequest
@param \Psr\Http\Message\ResponseInterface      $response

@return void
Collect data and create a new profile and save it .