CoreFiles by mySites.guru
SignalMap.php36 lines, 926 bytes, from Joomla_6.2.0-alpha1-Alpha-Full_Package.zip
Raw History Compare with 6.1.0-alpha3
md5
517f2b424632f47d5bd9dcfd6a7b3684
sha1
5fe29ef36a4b886e4d018cb703fad2bafa52a74e
sha256
2c9509be3c84cf7d98fcd8332403b51e926834a21e097f04464ae411250bd124
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * 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 <[email protected]>
 */
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, 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;
    }
}

The same content is in 65 releases, Joomla 5.4.0-beta1 to 6.2.0-alpha1. See them all, or every version of this file.