<?php
declare(strict_types=1);

namespace PpPhp\Core\Platform\Console\Commands;

use PpPhp\Core\Platform\Console\AbstractCommand;
use PpPhp\Core\Platform\Developer\PlatformMetrics;

final class MetricsCommand extends AbstractCommand
{
    public function name(): string { return 'metrics'; }
    public function description(): string { return 'Show runtime metrics.'; }

    public function handle(array $arguments = []): int
    {
        $metrics = (new PlatformMetrics())->snapshot();

        $this->title('PPphp Runtime Metrics');
        foreach ($metrics as $key => $value) {
            $this->line(str_pad((string)$key, 24) . (string)$value);
        }

        return 0;
    }
}
