<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\SignalRegistry;

/**
 * @author Grégoire Pineau <lyrixx@lyrixx.info>
 */
class SignalMap
{
    private static array $map;

    public static function getSignalName(int $signal): ?string
    {
        if (!\extension_loaded('pcntl')) {
            return null;
        }

        if (!isset(self::$map)) {
            $r = new \ReflectionExtension('pcntl');
            $c = $r->getConstants();
            $map = array_filter($c, static fn ($k) => str_starts_with($k, 'SIG') && !str_starts_with($k, 'SIG_') && 'SIGBABY' !== $k, \ARRAY_FILTER_USE_KEY);
            self::$map = array_flip($map);
        }

        return self::$map[$signal] ?? null;
    }
}
                                                                                           {
    "name": "symfony/console",
    "type": "library",
    "description": "Eases the creation of beautiful and testable command line interfaces",
    "keywords": ["console", "cli", "command-line", "terminal"],
    "homepage": "https://symfony.com",
    "license": "MIT",
    "authors": [
        {
            "name": "Fabien Potencier",
            "email": "fabien@symfony.com"
        },
        {
            "name": "Symfony Community",
            "homepage": "https://symfony.com/contributors"
        }
    ],
    "require": {
        "php": ">=8.2",
        "symfony/deprecation-contracts": "^2.5|^3",
        "symfony/polyfill-mbstring": "~1.0",
        "symfony/service-contracts": "^2.5|^3",
        "symfony/string": "^7.2|^8.0"
    },
    "require-dev": {
        "symfony/config": "^6.4|^7.0|^8.0",
        "symfony/event-dispatcher": "^6.4|^7.0|^8.0",
        "symfony/http-foundation": "^6.4|^7.0|^8.0",
        "symfony/http-kernel": "^6.4|^7.0|^8.0",
        "symfony/dependency-injection": "^6.4|^7.0|^8.0",
        "symfony/lock": "^6.4|^7.0|^8.0",
        "symfony/messenger": "^6.4|^7.0|^8.0",
        "symfony/process": "^6.4|^7.0|^8.0",
        "symfony/stopwatch": "^6.4|^7.0|^8.0",
        "symfony/var-dumper": "^6.4|^7.0|^8.0",
        "psr/log": "^1|^2|^3"
    },
    "provide": {
        "psr/log-implementation": "1.0|2.0|3.0"
    },
    "conflict": {
        "symfony/dependency-injection": "<6.4",
        "symfony/dotenv": "<6.4",
        "symfony/event-dispatcher": "<6.4",
        "symfony/lock": "<6.4",
        "symfony/process": "<6.4"
    },
    "autoload": {
        "psr-4": { "Symfony\\Component\\Console\\": "" },
        "exclude-from-classmap": [
            "/Tests/"
        ]
    },
    "minimum-stability": "dev"
}
