src/Koldy/Server.php
public static function signatureArray(): array
    {
        $numberOfIncludedFiles = count(get_included_files());
        $serverIP = static::ip();
        $domain = Application::getDomain();

        $signature = [];

        // add the server IP and domain
        $signature[] = "server: {$serverIP} ({$domain})";

        if (PHP_SAPI != 'cli') {
            // this is regular HTTP request
            $method = Request::method();
            $url = Application::getCurrentURL();

            // add info about the current request
            $signature[] = "URL: {$method}={$url}";

            // some end user IP and host stuff
            $endUserIp = Request::ip();
            $endUserHost = Request::host() ?? 'no host detected';
            $proxy = '';

            if ($endUserIp == $endUserHost) {
                $endUserHost = 'no host detected';
            }

            if (Request::hasProxy()) {
                $proxySignature = Request::proxySignature();
                $forwardedFor = Request::httpXForwardedFor();
                $proxy = " via {$proxySignature} for {$forwardedFor}";
            }

            $signature[] = "Origin: {$endUserIp} ({$endUserHost}){$proxy}";

            $uas = Request::userAgent() ?? 'no user agent set';
            $signature[] = "UAS: {$uas}";
        } else {
            $cliName = Application::getCliName();
            $cliScript = Application::getCliScriptPath();

            $signature[] = "CLI Name: {$cliName}";
            $signature[] = "CLI Script: {$cliScript}";

            $params = Cli::getParameters();
            if (count($params) > 0) {
                $signature[] = 'CLI Params: ' . print_r($params, true);
            }
        }

        $serverLoad = static::getServerLoad();
        $signature[] = "Server Load: {$serverLoad}";

        $memory = memory_get_usage();
        $peak = memory_get_peak_usage();
        $allocatedMemory = memory_get_peak_usage(true);
        $memoryLimit = ini_get('memory_limit') ?? -1;

        $memoryKb = round($memory / 1024, 2);
        $peakKb = round($peak / 1024, 2);
        $allocatedMemoryKb = round($allocatedMemory / 1024, 2);

        $limit = '';
        $peakSpent = '';

        if ($memoryLimit > 0) {
            $limitInt = Convert::stringToBytes($memoryLimit);
            $limit = ", limit: {$memoryLimit}";

            $spent = round($peak / $limitInt * 100, 2);
            $peakSpent = " ({$spent}% of limit)";
        }

        $signature[] = "Memory: current: {$memoryKb}kb, peak: {$peakKb}kb{$peakSpent}, allocated: {$allocatedMemoryKb}kb{$limit}";
        $signature[] = "No. of included files: {$numberOfIncludedFiles}";

        return $signature;
    }
public static function signatureArray(): array
    {
        $numberOfIncludedFiles = count(get_included_files());
        $serverIP = static::ip();
        $domain = Application::getDomain();

        $signature = [];

        // add the server IP and domain
        $signature[] = "server: {$serverIP} ({$domain})";

        if (PHP_SAPI != 'cli') {
            // this is regular HTTP request
            $method = Request::method();
            $url = Application::getCurrentURL();

            // add info about the current request
            $signature[] = "URL: {$method}={$url}";

            // some end user IP and host stuff
            $endUserIp = Request::ip();
            $endUserHost = Request::host() ?? 'no host detected';
            $proxy = '';

            if ($endUserIp == $endUserHost) {
                $endUserHost = 'no host detected';
            }

            if (Request::hasProxy()) {
                $proxySignature = Request::proxySignature();
                $forwardedFor = Request::httpXForwardedFor();
                $proxy = " via {$proxySignature} for {$forwardedFor}";
            }

            $signature[] = "Origin: {$endUserIp} ({$endUserHost}){$proxy}";

            $uas = Request::userAgent() ?? 'no user agent set';
            $signature[] = "UAS: {$uas}";
        } else {
            $cliName = Application::getCliName();
            $cliScript = Application::getCliScriptPath();

            $signature[] = "CLI Name: {$cliName}";
            $signature[] = "CLI Script: {$cliScript}";

            $params = Cli::getParameters();
            if (count($params) > 0) {
                $signature[] = 'CLI Params: ' . print_r($params, true);
            }
        }

        $serverLoad = static::getServerLoad();
        $signature[] = "Server Load: {$serverLoad}";

        $memory = memory_get_usage();
        $peak = memory_get_peak_usage();
        $allocatedMemory = memory_get_peak_usage(true);
        $memoryLimit = ini_get('memory_limit') ?? -1;

        $memoryKb = round($memory / 1024, 2);
        $peakKb = round($peak / 1024, 2);
        $allocatedMemoryKb = round($allocatedMemory / 1024, 2);

        $limit = '';
        $peakSpent = '';

        if ($memoryLimit > 0) {
            $limitInt = Convert::stringToBytes($memoryLimit);
            $limit = ", limit: {$memoryLimit}";

            $spent = round($peak / $limitInt * 100, 2);
            $peakSpent = " ({$spent}% of limit)";
        }

        $signature[] = "Memory: current: {$memoryKb}kb, peak: {$peakKb}kb{$peakSpent}, allocated: {$allocatedMemoryKb}kb{$limit}";
        $signature[] = "No. of included files: {$numberOfIncludedFiles}";

        return $signature;
    }
public static function signatureArray ( ) : array { $ numberOfIncludedFiles = count ( get_included_files ( ) ) ; $ serverIP = static :: ip ( ) ; $ domain = Application :: getDomain ( ) ; $ signature = [ ] ; // add the server IP and domain $ signature [ ] = "server: {$serverIP} ({$domain})" ; if ( PHP_SAPI != 'cli' ) { // this is regular HTTP request $ method = Request :: method ( ) ; $ url = Application :: getCurrentURL ( ) ; // add info about the current request $ signature [ ] = "URL: {$method}={$url}" ; // some end user IP and host stuff $ endUserIp = Request :: ip ( ) ; $ endUserHost = Request :: host ( ) ?? 'no host detected' ; $ proxy = '' ; if ( $ endUserIp == $ endUserHost ) { $ endUserHost = 'no host detected' ; } if ( Request :: hasProxy ( ) ) { $ proxySignature = Request :: proxySignature ( ) ; $ forwardedFor = Request :: httpXForwardedFor ( ) ; $ proxy = " via {$proxySignature} for {$forwardedFor}" ; } $ signature [ ] = "Origin: {$endUserIp} ({$endUserHost}){$proxy}" ; $ uas = Request :: userAgent ( ) ?? 'no user agent set' ; $ signature [ ] = "UAS: {$uas}" ; } else { $ cliName = Application :: getCliName ( ) ; $ cliScript = Application :: getCliScriptPath ( ) ; $ signature [ ] = "CLI Name: {$cliName}" ; $ signature [ ] = "CLI Script: {$cliScript}" ; $ params = Cli :: getParameters ( ) ; if ( count ( $ params ) > 0 ) { $ signature [ ] = 'CLI Params: ' . print_r ( $ params , true ) ; } } $ serverLoad = static :: getServerLoad ( ) ; $ signature [ ] = "Server Load: {$serverLoad}" ; $ memory = memory_get_usage ( ) ; $ peak = memory_get_peak_usage ( ) ; $ allocatedMemory = memory_get_peak_usage ( true ) ; $ memoryLimit = ini_get ( 'memory_limit' ) ?? - 1 ; $ memoryKb = round ( $ memory / 1024 , 2 ) ; $ peakKb = round ( $ peak / 1024 , 2 ) ; $ allocatedMemoryKb = round ( $ allocatedMemory / 1024 , 2 ) ; $ limit = '' ; $ peakSpent = '' ; if ( $ memoryLimit > 0 ) { $ limitInt = Convert :: stringToBytes ( $ memoryLimit ) ; $ limit = ", limit: {$memoryLimit}" ; $ spent = round ( $ peak / $ limitInt * 100 , 2 ) ; $ peakSpent = " ({$spent}% of limit)" ; } $ signature [ ] = "Memory: current: {$memoryKb}kb, peak: {$peakKb}kb{$peakSpent}, allocated: {$allocatedMemoryKb}kb{$limit}" ; $ signature [ ] = "No. of included files: {$numberOfIncludedFiles}" ; return $ signature ; }
Get the server's "signature" in this moment with all useful debug data

@return array
@throws Convert\Exception
@throws Exception
Get the server s signature in this moment with all useful debug data