pharext\Cli\Command::metadata PHP Method

metadata() public method

Retrieve metadata of the currently running phar
public metadata ( string $key = null ) : mixed
$key string
return mixed
    public function metadata($key = null)
    {
        if (extension_loaded("Phar")) {
            $running = new Phar(Phar::running(false));
        } else {
            $running = new Archive(PHAREXT_PHAR);
        }
        if ($key === "signature") {
            $sig = $running->getSignature();
            return sprintf("%s signature of %s\n%s", $sig["hash_type"], $this->metadata("name"), chunk_split($sig["hash"], 64, "\n"));
        }
        $metadata = $running->getMetadata();
        if (isset($key)) {
            return $metadata[$key];
        }
        return $metadata;
    }