public static function addSignature(\Phar $phar, $signature, $privateKeyAlias = null)
    {
        if ($signature === false) {
            return;
        }
        echo "\nAdd signature";
        if (in_array($signature, [\Phar::MD5, \Phar::SHA1, \Phar::SHA256, \Phar::SHA512], true) === true) {
            $phar->setSignatureAlgorithm($signature);
        } elseif ($signature === \Phar::OPENSSL) {
            self::setOpenSSLSignature($phar, $privateKeyAlias);
        } else {
            throw new InvalidConfigException("Invalid configuration. Unknown signature type '{$signature}'.");
        }
    }
public static function addSignature(\Phar $phar, $signature, $privateKeyAlias = null)
    {
        if ($signature === false) {
            return;
        }
        echo "\nAdd signature";
        if (in_array($signature, [\Phar::MD5, \Phar::SHA1, \Phar::SHA256, \Phar::SHA512], true) === true) {
            $phar->setSignatureAlgorithm($signature);
        } elseif ($signature === \Phar::OPENSSL) {
            self::setOpenSSLSignature($phar, $privateKeyAlias);
        } else {
            throw new InvalidConfigException("Invalid configuration. Unknown signature type '{$signature}'.");
        }
    }
public static function addSignature ( \ Phar $ phar , $ signature , $ privateKeyAlias = null ) { if ( $ signature === false ) { return ; } echo "\nAdd signature" ; if ( in_array ( $ signature , [ \ Phar :: MD5 , \ Phar :: SHA1 , \ Phar :: SHA256 , \ Phar :: SHA512 ] , true ) === true ) { $ phar -> setSignatureAlgorithm ( $ signature ) ; } elseif ( $ signature === \ Phar :: OPENSSL ) { self :: setOpenSSLSignature ( $ phar , $ privateKeyAlias ) ; } else { throw new InvalidConfigException ( "Invalid configuration. Unknown signature type '{$signature}'." ) ; } }
Add signature to phar file.

@param \Phar       $phar            PHAR object to update.
@param integer     $signature       Signature type.
@param null|string $privateKeyAlias Path alias to private key, on signature type is \Phar::OPENSSL.

@throws \yii\base\InvalidConfigException On wrong signature type set (index0h\phar\Module::signature).
Add signature to phar file .