fix travis
authorMichael Wallner <mike@php.net>
Mon, 28 Sep 2015 16:35:58 +0000 (18:35 +0200)
committerMichael Wallner <mike@php.net>
Mon, 28 Sep 2015 16:35:58 +0000 (18:35 +0200)
.travis.yml
scripts/gen_travis_yml.php
travis/propro-2.0.0-dev.ext.phar [deleted file]
travis/propro-master.ext.phar [new file with mode: 0755]
travis/raphf-2.0.0-dev.ext.phar [deleted file]
travis/raphf-master.ext.phar [new file with mode: 0755]

index 1041fd7d802cf73252bd92c21d42bdd2b0e18a5c..d92482e6c6987ef1360eead7efde15872e9873fc 100644 (file)
@@ -23,7 +23,7 @@ env:
 
 before_script:
  - make -f travis/pecl/Makefile php
- - make -f travis/pecl/Makefile pharext/raphf-2.0.0-dev pharext/propro-2.0.0-dev
+ - make -f travis/pecl/Makefile pharext/raphf-master pharext/propro-master
 
 script:
  - make -f travis/pecl/Makefile ext PECL=http
index f336d43fa98481f51d4da709c8159e7d185ba1b7..4bb37b775a461b54e0e2787e97e312d7e0ca8f64 100755 (executable)
@@ -34,7 +34,7 @@ foreach ($env as $e) {
 
 before_script:
  - make -f travis/pecl/Makefile php
- - make -f travis/pecl/Makefile pharext/raphf-2.0.0-dev pharext/propro-2.0.0-dev
+ - make -f travis/pecl/Makefile pharext/raphf-master pharext/propro-master
 
 script:
  - make -f travis/pecl/Makefile ext PECL=http
diff --git a/travis/propro-2.0.0-dev.ext.phar b/travis/propro-2.0.0-dev.ext.phar
deleted file mode 100755 (executable)
index 416405d..0000000
+++ /dev/null
@@ -1,5648 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-/**
- * The installer sub-stub for extension phars
- */
-
-namespace pharext;
-
-define("PHAREXT_PHAR", __FILE__);
-
-spl_autoload_register(function($c) {
-       return include strtr($c, "\\_", "//") . ".php";
-});
-
-
-
-namespace pharext;
-
-class Exception extends \Exception
-{
-       public function __construct($message = null, $code = 0, $previous = null) {
-               if (!isset($message)) {
-                       $last_error = error_get_last();
-                       $message = $last_error["message"];
-                       if (!$code) {
-                               $code = $last_error["type"];
-                       }
-               }
-               parent::__construct($message, $code, $previous);
-       }
-}
-
-
-
-namespace pharext;
-
-use pharext\Exception;
-
-/**
- * A temporary file/directory name
- */
-class Tempname
-{
-       /**
-        * @var string
-        */
-       private $name;
-
-       /**
-        * @param string $prefix uniqid() prefix
-        * @param string $suffix e.g. file extension
-        */
-       public function __construct($prefix, $suffix = null) {
-               $temp = sys_get_temp_dir() . "/pharext-" . $this->getUser();
-               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
-                       throw new Exception;
-               }
-               $this->name = $temp ."/". uniqid($prefix) . $suffix;
-       }
-
-       private function getUser() {
-               if (extension_loaded("posix") && function_exists("posix_getpwuid")) {
-                       return posix_getpwuid(posix_getuid())["name"];
-               }
-               return trim(`whoami 2>/dev/null`)
-                       ?: trim(`id -nu 2>/dev/null`)
-                       ?: getenv("USER")
-                       ?: get_current_user();
-       }
-
-       /**
-        * @return string
-        */
-       public function __toString() {
-               return (string) $this->name;
-       }
-}
-
-
-namespace pharext;
-
-/**
- * Create a new temporary file
- */
-class Tempfile extends \SplFileInfo
-{
-       /**
-        * @var resource
-        */
-       private $handle;
-
-       /**
-        * @param string $prefix uniqid() prefix
-        * @param string $suffix e.g. file extension
-        * @throws \pharext\Exception
-        */
-       public function __construct($prefix, $suffix = ".tmp") {
-               $tries = 0;
-               $omask = umask(077);
-               do {
-                       $path = new Tempname($prefix, $suffix);
-                       $this->handle = fopen($path, "x");
-               } while (!is_resource($this->handle) && $tries++ < 10);
-               umask($omask);
-               
-               if (!is_resource($this->handle)) {
-                       throw new Exception("Could not create temporary file");
-               }
-               
-               parent::__construct($path);
-       }
-
-       /**
-        * Unlink the file
-        */
-       public function __destruct() {
-               if (is_file($this->getPathname())) {
-                       @unlink($this->getPathname());
-               }
-       }
-
-       /**
-        * Close the stream
-        */
-       public function closeStream() {
-               fclose($this->handle);
-       }
-
-       /**
-        * Retrieve the stream resource
-        * @return resource
-        */
-       public function getStream() {
-               return $this->handle;
-       }
-}
-
-
-
-namespace pharext;
-
-/**
- * Create a temporary directory
- */
-class Tempdir extends \SplFileInfo
-{
-       /**
-        * @param string $prefix prefix to uniqid()
-        * @throws \pharext\Exception
-        */
-       public function __construct($prefix) {
-               $temp = new Tempname($prefix);
-               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
-                       throw new Exception("Could not create tempdir: ".error_get_last()["message"]);
-               }
-               parent::__construct($temp);
-       }
-}
-
-
-
-namespace pharext;
-
-use ArrayAccess;
-use IteratorAggregate;
-use RecursiveDirectoryIterator;
-use SplFileInfo;
-
-use pharext\Exception;
-
-class Archive implements ArrayAccess, IteratorAggregate
-{
-       const HALT_COMPILER = "\137\137\150\141\154\164\137\143\157\155\160\151\154\145\162\50\51\73";
-       const SIGNED = 0x10000;
-       const SIG_MD5    = 0x0001;
-       const SIG_SHA1   = 0x0002;
-       const SIG_SHA256 = 0x0003;
-       const SIG_SHA512 = 0x0004;
-       const SIG_OPENSSL= 0x0010;
-
-       private static $siglen = [
-               self::SIG_MD5    => 16,
-               self::SIG_SHA1   => 20,
-               self::SIG_SHA256 => 32,
-               self::SIG_SHA512 => 64,
-               self::SIG_OPENSSL=> 0
-       ];
-
-       private static $sigalg = [
-               self::SIG_MD5    => "md5",
-               self::SIG_SHA1   => "sha1",
-               self::SIG_SHA256 => "sha256",
-               self::SIG_SHA512 => "sha512",
-               self::SIG_OPENSSL=> "openssl"
-       ];
-
-       private static $sigtyp = [
-               self::SIG_MD5    => "MD5",
-               self::SIG_SHA1   => "SHA-1",
-               self::SIG_SHA256 => "SHA-256",
-               self::SIG_SHA512 => "SHA-512",
-               self::SIG_OPENSSL=> "OpenSSL",
-       ];
-
-       const PERM_FILE_MASK = 0x01ff;
-       const COMP_FILE_MASK = 0xf000;
-       const COMP_GZ_FILE   = 0x1000;
-       const COMP_BZ2_FILE  = 0x2000;
-
-       const COMP_PHAR_MASK= 0xf000;
-       const COMP_PHAR_GZ  = 0x1000;
-       const COMP_PHAR_BZ2 = 0x2000;
-
-       private $file;
-       private $fd;
-       private $stub;
-       private $manifest;
-       private $signature;
-       private $extracted;
-
-       function __construct($file = null) {
-               if (strlen($file)) {
-                       $this->open($file);
-               }
-       }
-
-       function open($file) {
-               if (!$this->fd = @fopen($file, "r")) {
-                       throw new Exception;
-               }
-               $this->file = $file;
-               $this->stub = $this->readStub();
-               $this->manifest = $this->readManifest();
-               $this->signature = $this->readSignature();
-       }
-
-       function getIterator() {
-               return new RecursiveDirectoryIterator($this->extract());
-       }
-
-       function extract() {
-               return $this->extracted ?: $this->extractTo(new Tempdir("archive"));
-       }
-
-       function extractTo($dir) {
-               if ((string) $this->extracted == (string) $dir) {
-                       return $this->extracted;
-               }
-               foreach ($this->manifest["entries"] as $file => $entry) {
-                       fseek($this->fd, $this->manifest["offset"]+$entry["offset"]);
-                       $path = "$dir/$file";
-                       $copy = stream_copy_to_stream($this->fd, $this->outFd($path, $entry["flags"]), $entry["csize"]);
-                       if ($entry["osize"] != $copy) {
-                               throw new Exception("Copied '$copy' of '$file', expected '{$entry["osize"]}' from '{$entry["csize"]}");
-                       }
-
-                       $crc = hexdec(hash_file("crc32b", $path));
-                       if ($crc !== $entry["crc32"]) {
-                               throw new Exception("CRC mismatch of '$file': '$crc' != '{$entry["crc32"]}");
-                       }
-
-                       chmod($path, $entry["flags"] & self::PERM_FILE_MASK);
-                       touch($path, $entry["stamp"]);
-               }
-               return $this->extracted = $dir;
-       }
-
-       function offsetExists($o) {
-               return isset($this->entries[$o]);
-       }
-
-       function offsetGet($o) {
-               $this->extract();
-               return new SplFileInfo($this->extracted."/$o");
-       }
-
-       function offsetSet($o, $v) {
-               throw new Exception("Archive is read-only");
-       }
-
-       function offsetUnset($o) {
-               throw new Exception("Archive is read-only");
-       }
-
-       function getSignature() {
-               /* compatible with Phar::getSignature() */
-               return [
-                       "hash_type" => self::$sigtyp[$this->signature["flags"]],
-                       "hash" => strtoupper(bin2hex($this->signature["hash"])),
-               ];
-       }
-
-       function getPath() {
-               /* compatible with Phar::getPath() */
-               return new SplFileInfo($this->file);
-       }
-
-       function getMetadata($key = null) {
-               if (isset($key)) {
-                       return $this->manifest["meta"][$key];
-               }
-               return $this->manifest["meta"];
-       }
-
-       private function outFd($path, $flags) {
-                       $dirn = dirname($path);
-                       if (!is_dir($dirn) && !@mkdir($dirn, 0777, true)) {
-                               throw new Exception;
-                       }
-                       if (!$fd = @fopen($path, "w")) {
-                               throw new Exception;
-                       }
-                       switch ($flags & self::COMP_FILE_MASK) {
-                       case self::COMP_GZ_FILE:
-                               if (!@stream_filter_append($fd, "zlib.inflate")) {
-                                       throw new Exception;
-                               }
-                               break;
-                       case self::COMP_BZ2_FILE:
-                               if (!@stream_filter_append($fd, "bz2.decompress")) {
-                                       throw new Exception;
-                               }
-                               break;
-                       }
-
-       }
-       private function readVerified($fd, $len) {
-               if ($len != strlen($data = fread($fd, $len))) {
-                       throw new Exception("Unexpected EOF");
-               }
-               return $data;
-       }
-
-       private function readFormat($format, $fd, $len) {
-               if (false === ($data = @unpack($format, $this->readVerified($fd, $len)))) {
-                       throw new Exception;
-               }
-               return $data;
-       }
-
-       private function readSingleFormat($format, $fd, $len) {
-               return current($this->readFormat($format, $fd, $len));
-       }
-
-       private function readStringBinary($fd) {
-               if (($length = $this->readSingleFormat("V", $fd, 4))) {
-                       return $this->readVerified($this->fd, $length);
-               }
-               return null;
-       }
-
-       private function readSerializedBinary($fd) {
-               if (($length = $this->readSingleFormat("V", $fd, 4))) {
-                       if (false === ($data = unserialize($this->readVerified($fd, $length)))) {
-                               throw new Exception;
-                       }
-                       return $data;
-               }
-               return null;
-       }
-
-       private function readStub() {
-               $stub = "";
-               while (!feof($this->fd)) {
-                       $line = fgets($this->fd);
-                       $stub .= $line;
-                       if (false !== stripos($line, self::HALT_COMPILER)) {
-                               /* check for '?>' on a separate line */
-                               if ('?>' === $this->readVerified($this->fd, 2)) {
-                                       $stub .= '?>' . fgets($this->fd);
-                               } else {
-                                       fseek($this->fd, -2, SEEK_CUR);
-                               }
-                               break;
-                       }
-               }
-               return $stub;
-       }
-
-       private function readManifest() {
-               $current = ftell($this->fd);
-               $header = $this->readFormat("Vlen/Vnum/napi/Vflags", $this->fd, 14);
-               $alias = $this->readStringBinary($this->fd);
-               $meta = $this->readSerializedBinary($this->fd);
-               $entries = [];
-               for ($i = 0; $i < $header["num"]; ++$i) {
-                       $this->readEntry($entries);
-               }
-               $offset = ftell($this->fd);
-               if (($length = $offset - $current - 4) != $header["len"]) {
-                       throw new Exception("Manifest length read was '$length', expected '{$header["len"]}'");
-               }
-               return $header + compact("alias", "meta", "entries", "offset");
-       }
-
-       private function readEntry(array &$entries) {
-               if (!count($entries)) {
-                       $offset = 0;
-               } else {
-                       $last = end($entries);
-                       $offset = $last["offset"] + $last["csize"];
-               }
-               $file = $this->readStringBinary($this->fd);
-               if (!strlen($file)) {
-                       throw new Exception("Empty file name encountered at offset '$offset'");
-               }
-               $header = $this->readFormat("Vosize/Vstamp/Vcsize/Vcrc32/Vflags", $this->fd, 20);
-               $meta = $this->readSerializedBinary($this->fd);
-               $entries[$file] =  $header + compact("meta", "offset");
-       }
-
-       private function readSignature() {
-               fseek($this->fd, -8, SEEK_END);
-               $sig = $this->readFormat("Vflags/Z4magic", $this->fd, 8);
-               $end = ftell($this->fd);
-
-               if ($sig["magic"] !== "GBMB") {
-                       throw new Exception("Invalid signature magic value '{$sig["magic"]}");
-               }
-
-               switch ($sig["flags"]) {
-               case self::SIG_OPENSSL:
-                       fseek($this->fd, -12, SEEK_END);
-                       if (($hash = $this->readSingleFormat("V", $this->fd, 4))) {
-                               $offset = 4 + $hash;
-                               fseek($this->fd, -$offset, SEEK_CUR);
-                               $hash = $this->readVerified($this->fd, $hash);
-                               fseek($this->fd, 0, SEEK_SET);
-                               $valid = openssl_verify($this->readVerified($this->fd, $end - $offset - 8),
-                                       $hash, @file_get_contents($this->file.".pubkey")) === 1;
-                       }
-                       break;
-
-               case self::SIG_MD5:
-               case self::SIG_SHA1:
-               case self::SIG_SHA256:
-               case self::SIG_SHA512:
-                       $offset = 8 + self::$siglen[$sig["flags"]];
-                       fseek($this->fd, -$offset, SEEK_END);
-                       $hash = $this->readVerified($this->fd, self::$siglen[$sig["flags"]]);
-                       $algo = hash_init(self::$sigalg[$sig["flags"]]);
-                       fseek($this->fd, 0, SEEK_SET);
-                       hash_update_stream($algo, $this->fd, $end - $offset);
-                       $valid = hash_final($algo, true) === $hash;
-                       break;
-
-               default:
-                       throw new Exception("Invalid signature type '{$sig["flags"]}");
-               }
-
-               return $sig + compact("hash", "valid");
-       }
-}
-
-
-namespace pharext;
-
-if (extension_loaded("Phar")) {
-       \Phar::interceptFileFuncs();
-       \Phar::mapPhar();
-       $phardir = "phar://".__FILE__;
-} else {
-       $archive = new Archive(__FILE__);
-       $phardir = $archive->extract();
-}
-
-set_include_path("$phardir:". get_include_path());
-
-$installer = new Installer();
-$installer->run($argc, $argv);
-
-__HALT_COMPILER(); ?>\r
-p\10\0\06\0\0\0\11\0\0\0\ 1\0\0\0\0\0-\ 6\0\0a:7:{s:7:"version";s:5:"4.1.1";s:6:"header";s:49:"pharext v4.1.1 (c) Michael Wallner <mike@php.net>";s:4:"date";s:10:"2015-09-28";s:4:"name";s:6:"propro";s:7:"release";s:9:"2.0.0-dev";s:7:"license";s:1345:"Copyright (c) 2013, Michael Wallner <mike@php.net>.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without 
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice, 
-      this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright 
-      notice, this list of conditions and the following disclaimer in the 
-      documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-";s:4:"type";s:9:"extension";}\13\0\0\0pharext/Archive.php\18\1e\0\0oh    V\18\1e\0\04-ÔI¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Cli/Args/Help.phpÉ\f\0\0oh    VÉ\f\0\0gX'\1f\ 1\0\0\0\0\0\0\14\0\0\0pharext/Cli/Args.php\ f\1d\0\0oh V\ f\1d\0\0?n\9dö¶\ 1\0\0\0\0\0\0\17\0\0\0pharext/Cli/Command.phpk   \0\0oh    Vk      \0\0d\84aê¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/Command.php\12\ 4\0\0oh     V\12\ 4\0\0Ôm`Ͷ\ 1\0\0\0\0\0\0\15\0\0\0pharext/Exception.phpc\ 1\0\0oh        Vc\ 1\0\0U\86Ï{¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/ExecCmd.php\1c\ e\0\0oh  V\1c\ e\0\0¹l\94ʶ\ 1\0\0\0\0\0\0\15\0\0\0pharext/Installer.php&\18\0\0oh        V&\18\0\0ød&À¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/License.php\93\ 4\0\0oh  V\93\ 4\0\0î\ 4òE¶\ 1\0\0\0\0\0\0\14\0\0\0pharext/Metadata.php\95\ 1\0\0oh V\95\ 1\0\0¿Ú\90\9e\ 1\0\0\0\0\0\0\1e\0\0\0pharext/Openssl/PrivateKey.phpÁ\ 4\0\0oh       VÁ\ 4\0\0&æP\1a\ 1\0\0\0\0\0\0\14\0\0\0pharext/Packager.phpÌ!\0\0oh VÌ!\0\00\ 2\ 3\ 1\0\0\0\0\0\0\e\0\0\0pharext/SourceDir/Basic.phpz\ 5\0\0oh  Vz\ 5\0\0÷+Ôâ¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/SourceDir/Git.phpZ\ 6\0\0oh    VZ\ 6\0\0É\bÎ\¶\ 1\0\0\0\0\0\0\1a\0\0\0pharext/SourceDir/Pecl.phpø\11\0\0oh   Vø\11\0\0ã\bùж\ 1\0\0\0\0\0\0\15\0\0\0pharext/SourceDir.php½\ 2\0\0oh        V½\ 2\0\03·#\ f\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/Activate.phpÜ\v\0\0oh    VÜ\v\0\0I\93\1c\18\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Askpass.phpU\ 2\0\0oh     VU\ 2\0\0\87*\1e\90\ 1\0\0\0\0\0\0 \0\0\0pharext/Task/BundleGenerator.php}\ 2\0\0oh     V}\ 2\0\0 ï`Y¶\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Cleanup.php\1e\ 4\0\0oh     V\1e\ 4\0\0ÉI\80\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/Configure.phpT\ 4\0\0oh   VT\ 4\0\0}\17Ëì¶\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Extract.phpp\ 3\0\0oh     Vp\ 3\0\0[¨Û̶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/GitClone.phpm\ 3\0\0oh    Vm\ 3\0\0óyµ@¶\ 1\0\0\0\0\0\0\15\0\0\0pharext/Task/Make.phpª\ 4\0\0oh        Vª\ 4\0\0\9cç6\r\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PaxFixup.php¬\ 3\0\0oh    V¬\ 3\0\0yâ¯\e\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/PeclFixup.php\9c\ 4\0\0oh   V\9c\ 4\0\0eùt\9a\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/PharBuild.phpâ\a\0\0oh   Vâ\a\0\0ζ0ɶ\ 1\0\0\0\0\0\0\1d\0\0\0pharext/Task/PharCompress.phpc\ 4\0\0oh        Vc\ 4\0\0½\10³Ï¶\ 1\0\0\0\0\0\0\e\0\0\0pharext/Task/PharRename.phpä\ 3\0\0oh  Vä\ 3\0\0\8a[Þ˶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PharSign.php¨\ 3\0\0oh    V¨\ 3\0\0Ûº¦i¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PharStub.phpæ\ 3\0\0oh    Væ\ 3\0\0Y|­\9b\ 1\0\0\0\0\0\0\17\0\0\0pharext/Task/Phpize.php\ f\ 4\0\0oh      V\ f\ 4\0\0ù\f2Ѷ\ 1\0\0\0\0\0\0\1c\0\0\0pharext/Task/StreamFetch.php\10\a\0\0oh V\10\a\0\0\88îs\¶\ 1\0\0\0\0\0\0\10\0\0\0pharext/Task.phpw\0\0\0oh     Vw\0\0\0 ÄIǶ\ 1\0\0\0\0\0\0\13\0\0\0pharext/Tempdir.phpµ\ 1\0\0oh  Vµ\ 1\0\0ë\7f\96\ 1\0\0\0\0\0\0\14\0\0\0pharext/Tempfile.php\ f\ 4\0\0oh V\ f\ 4\0\0\0®ô\1e\ 1\0\0\0\0\0\0\14\0\0\0pharext/Tempname.phpt\ 3\0\0oh Vt\ 3\0\0\9en<\8d\ 1\0\0\0\0\0\0\13\0\0\0pharext/Updater.php\8d\10\0\0oh  V\8d\10\0\0\9eÏv\16\ 1\0\0\0\0\0\0\15\0\0\0pharext_installer.phpÝ\ 2\0\0oh        VÝ\ 2\0\0\19\8cÞq¶\ 1\0\0\0\0\0\0\14\0\0\0pharext_packager.phpb\ 3\0\0oh Vb\ 3\0\0îVÓ϶\ 1\0\0\0\0\0\0\13\0\0\0pharext_updater.phph\ 3\0\0oh  Vh\ 3\0\0 Êúj¶\ 1\0\0\0\0\0\0\13\0\0\0pharext_package.php2\0\0\0oh  V2\0\0\0vSTÒ¶\ 1\0\0\0\0\0\0\v\0\0\0package.xmlµ\ 6\0\0oh  Vµ\ 6\0\0\1fÈjg¶\ 1\0\0\0\0\0\0\a\0\0\0CREDITS\ 6\0\0\0oh      V\ 6\0\0\0u÷Bζ\ 1\0\0\0\0\0\0\a\0\0\0LICENSEA\ 5\0\0oh      VA\ 5\0\0¾¬Jþ¶\ 1\0\0\0\0\0\0\b\0\0\0Doxyfilea*\0\0oh     Va*\0\0\ 1¯d\16\ 1\0\0\0\0\0\0       \0\0\0config.m4\1c\ 1\0\0oh      V\1c\ 1\0\0\13  k"¶\ 1\0\0\0\0\0\0
-\0\0\0config.w32Ö\0\0\0oh    VÖ\0\0\0È5\13²¶\ 1\0\0\0\0\0\0\f\0\0\0php_propro.hO\ 5\0\0oh VO\ 5\0\0G+\18\99\ 1\0\0\0\0\0\0\10\0\0\0php_propro_api.hý\ e\0\0oh     Vý\ e\0\0´\r#\95\ 1\0\0\0\0\0\0\f\0\0\0php_propro.c08\0\0oh V08\0\0\99ÿ^\ 1\ 1\0\0\0\0\0\0\ e\0\0\0tests/001.phpt9\ 3\0\0oh       V9\ 3\0\02Õ½A¶\ 1\0\0\0\0\0\0\ e\0\0\0tests/002.phpt8\ 5\0\0oh       V8\ 5\0\0L\18Â\ f\ 1\0\0\0\0\0\0\ e\0\0\0tests/003.phptï\ 1\0\0oh       Vï\ 1\0\0U8Ìå¶\ 1\0\0\0\0\0\0<?php
-
-namespace pharext;
-
-use ArrayAccess;
-use IteratorAggregate;
-use RecursiveDirectoryIterator;
-use SplFileInfo;
-
-use pharext\Exception;
-
-class Archive implements ArrayAccess, IteratorAggregate
-{
-       const HALT_COMPILER = "\137\137\150\141\154\164\137\143\157\155\160\151\154\145\162\50\51\73";
-       const SIGNED = 0x10000;
-       const SIG_MD5    = 0x0001;
-       const SIG_SHA1   = 0x0002;
-       const SIG_SHA256 = 0x0003;
-       const SIG_SHA512 = 0x0004;
-       const SIG_OPENSSL= 0x0010;
-
-       private static $siglen = [
-               self::SIG_MD5    => 16,
-               self::SIG_SHA1   => 20,
-               self::SIG_SHA256 => 32,
-               self::SIG_SHA512 => 64,
-               self::SIG_OPENSSL=> 0
-       ];
-
-       private static $sigalg = [
-               self::SIG_MD5    => "md5",
-               self::SIG_SHA1   => "sha1",
-               self::SIG_SHA256 => "sha256",
-               self::SIG_SHA512 => "sha512",
-               self::SIG_OPENSSL=> "openssl"
-       ];
-
-       private static $sigtyp = [
-               self::SIG_MD5    => "MD5",
-               self::SIG_SHA1   => "SHA-1",
-               self::SIG_SHA256 => "SHA-256",
-               self::SIG_SHA512 => "SHA-512",
-               self::SIG_OPENSSL=> "OpenSSL",
-       ];
-
-       const PERM_FILE_MASK = 0x01ff;
-       const COMP_FILE_MASK = 0xf000;
-       const COMP_GZ_FILE   = 0x1000;
-       const COMP_BZ2_FILE  = 0x2000;
-
-       const COMP_PHAR_MASK= 0xf000;
-       const COMP_PHAR_GZ  = 0x1000;
-       const COMP_PHAR_BZ2 = 0x2000;
-
-       private $file;
-       private $fd;
-       private $stub;
-       private $manifest;
-       private $signature;
-       private $extracted;
-
-       function __construct($file = null) {
-               if (strlen($file)) {
-                       $this->open($file);
-               }
-       }
-
-       function open($file) {
-               if (!$this->fd = @fopen($file, "r")) {
-                       throw new Exception;
-               }
-               $this->file = $file;
-               $this->stub = $this->readStub();
-               $this->manifest = $this->readManifest();
-               $this->signature = $this->readSignature();
-       }
-
-       function getIterator() {
-               return new RecursiveDirectoryIterator($this->extract());
-       }
-
-       function extract() {
-               return $this->extracted ?: $this->extractTo(new Tempdir("archive"));
-       }
-
-       function extractTo($dir) {
-               if ((string) $this->extracted == (string) $dir) {
-                       return $this->extracted;
-               }
-               foreach ($this->manifest["entries"] as $file => $entry) {
-                       fseek($this->fd, $this->manifest["offset"]+$entry["offset"]);
-                       $path = "$dir/$file";
-                       $copy = stream_copy_to_stream($this->fd, $this->outFd($path, $entry["flags"]), $entry["csize"]);
-                       if ($entry["osize"] != $copy) {
-                               throw new Exception("Copied '$copy' of '$file', expected '{$entry["osize"]}' from '{$entry["csize"]}");
-                       }
-
-                       $crc = hexdec(hash_file("crc32b", $path));
-                       if ($crc !== $entry["crc32"]) {
-                               throw new Exception("CRC mismatch of '$file': '$crc' != '{$entry["crc32"]}");
-                       }
-
-                       chmod($path, $entry["flags"] & self::PERM_FILE_MASK);
-                       touch($path, $entry["stamp"]);
-               }
-               return $this->extracted = $dir;
-       }
-
-       function offsetExists($o) {
-               return isset($this->entries[$o]);
-       }
-
-       function offsetGet($o) {
-               $this->extract();
-               return new SplFileInfo($this->extracted."/$o");
-       }
-
-       function offsetSet($o, $v) {
-               throw new Exception("Archive is read-only");
-       }
-
-       function offsetUnset($o) {
-               throw new Exception("Archive is read-only");
-       }
-
-       function getSignature() {
-               /* compatible with Phar::getSignature() */
-               return [
-                       "hash_type" => self::$sigtyp[$this->signature["flags"]],
-                       "hash" => strtoupper(bin2hex($this->signature["hash"])),
-               ];
-       }
-
-       function getPath() {
-               /* compatible with Phar::getPath() */
-               return new SplFileInfo($this->file);
-       }
-
-       function getMetadata($key = null) {
-               if (isset($key)) {
-                       return $this->manifest["meta"][$key];
-               }
-               return $this->manifest["meta"];
-       }
-
-       private function outFd($path, $flags) {
-                       $dirn = dirname($path);
-                       if (!is_dir($dirn) && !@mkdir($dirn, 0777, true)) {
-                               throw new Exception;
-                       }
-                       if (!$fd = @fopen($path, "w")) {
-                               throw new Exception;
-                       }
-                       switch ($flags & self::COMP_FILE_MASK) {
-                       case self::COMP_GZ_FILE:
-                               if (!@stream_filter_append($fd, "zlib.inflate")) {
-                                       throw new Exception;
-                               }
-                               break;
-                       case self::COMP_BZ2_FILE:
-                               if (!@stream_filter_append($fd, "bz2.decompress")) {
-                                       throw new Exception;
-                               }
-                               break;
-                       }
-
-       }
-       private function readVerified($fd, $len) {
-               if ($len != strlen($data = fread($fd, $len))) {
-                       throw new Exception("Unexpected EOF");
-               }
-               return $data;
-       }
-
-       private function readFormat($format, $fd, $len) {
-               if (false === ($data = @unpack($format, $this->readVerified($fd, $len)))) {
-                       throw new Exception;
-               }
-               return $data;
-       }
-
-       private function readSingleFormat($format, $fd, $len) {
-               return current($this->readFormat($format, $fd, $len));
-       }
-
-       private function readStringBinary($fd) {
-               if (($length = $this->readSingleFormat("V", $fd, 4))) {
-                       return $this->readVerified($this->fd, $length);
-               }
-               return null;
-       }
-
-       private function readSerializedBinary($fd) {
-               if (($length = $this->readSingleFormat("V", $fd, 4))) {
-                       if (false === ($data = unserialize($this->readVerified($fd, $length)))) {
-                               throw new Exception;
-                       }
-                       return $data;
-               }
-               return null;
-       }
-
-       private function readStub() {
-               $stub = "";
-               while (!feof($this->fd)) {
-                       $line = fgets($this->fd);
-                       $stub .= $line;
-                       if (false !== stripos($line, self::HALT_COMPILER)) {
-                               /* check for '?>' on a separate line */
-                               if ('?>' === $this->readVerified($this->fd, 2)) {
-                                       $stub .= '?>' . fgets($this->fd);
-                               } else {
-                                       fseek($this->fd, -2, SEEK_CUR);
-                               }
-                               break;
-                       }
-               }
-               return $stub;
-       }
-
-       private function readManifest() {
-               $current = ftell($this->fd);
-               $header = $this->readFormat("Vlen/Vnum/napi/Vflags", $this->fd, 14);
-               $alias = $this->readStringBinary($this->fd);
-               $meta = $this->readSerializedBinary($this->fd);
-               $entries = [];
-               for ($i = 0; $i < $header["num"]; ++$i) {
-                       $this->readEntry($entries);
-               }
-               $offset = ftell($this->fd);
-               if (($length = $offset - $current - 4) != $header["len"]) {
-                       throw new Exception("Manifest length read was '$length', expected '{$header["len"]}'");
-               }
-               return $header + compact("alias", "meta", "entries", "offset");
-       }
-
-       private function readEntry(array &$entries) {
-               if (!count($entries)) {
-                       $offset = 0;
-               } else {
-                       $last = end($entries);
-                       $offset = $last["offset"] + $last["csize"];
-               }
-               $file = $this->readStringBinary($this->fd);
-               if (!strlen($file)) {
-                       throw new Exception("Empty file name encountered at offset '$offset'");
-               }
-               $header = $this->readFormat("Vosize/Vstamp/Vcsize/Vcrc32/Vflags", $this->fd, 20);
-               $meta = $this->readSerializedBinary($this->fd);
-               $entries[$file] =  $header + compact("meta", "offset");
-       }
-
-       private function readSignature() {
-               fseek($this->fd, -8, SEEK_END);
-               $sig = $this->readFormat("Vflags/Z4magic", $this->fd, 8);
-               $end = ftell($this->fd);
-
-               if ($sig["magic"] !== "GBMB") {
-                       throw new Exception("Invalid signature magic value '{$sig["magic"]}");
-               }
-
-               switch ($sig["flags"]) {
-               case self::SIG_OPENSSL:
-                       fseek($this->fd, -12, SEEK_END);
-                       if (($hash = $this->readSingleFormat("V", $this->fd, 4))) {
-                               $offset = 4 + $hash;
-                               fseek($this->fd, -$offset, SEEK_CUR);
-                               $hash = $this->readVerified($this->fd, $hash);
-                               fseek($this->fd, 0, SEEK_SET);
-                               $valid = openssl_verify($this->readVerified($this->fd, $end - $offset - 8),
-                                       $hash, @file_get_contents($this->file.".pubkey")) === 1;
-                       }
-                       break;
-
-               case self::SIG_MD5:
-               case self::SIG_SHA1:
-               case self::SIG_SHA256:
-               case self::SIG_SHA512:
-                       $offset = 8 + self::$siglen[$sig["flags"]];
-                       fseek($this->fd, -$offset, SEEK_END);
-                       $hash = $this->readVerified($this->fd, self::$siglen[$sig["flags"]]);
-                       $algo = hash_init(self::$sigalg[$sig["flags"]]);
-                       fseek($this->fd, 0, SEEK_SET);
-                       hash_update_stream($algo, $this->fd, $end - $offset);
-                       $valid = hash_final($algo, true) === $hash;
-                       break;
-
-               default:
-                       throw new Exception("Invalid signature type '{$sig["flags"]}");
-               }
-
-               return $sig + compact("hash", "valid");
-       }
-}
-<?php
-
-namespace pharext\Cli\Args;
-
-use pharext\Cli\Args;
-
-class Help
-{
-       private $args;
-
-       function __construct($prog, Args $args) {
-               $this->prog = $prog;
-               $this->args = $args;
-       }
-
-       function __toString() {
-               $usage = "Usage:\n\n  \$ ";
-               $usage .= $this->prog;
-
-               list($flags, $required, $optional, $positional) = $this->listSpec();
-               if ($flags) {
-                       $usage .= $this->dumpFlags($flags);
-               }
-               if ($required) {
-                       $usage .= $this->dumpRequired($required);
-               }
-               if ($optional) {
-                       $usage .= $this->dumpOptional($optional);
-               }
-               if ($positional) {
-                       $usage .= $this->dumpPositional($positional);
-               }
-
-               $help = $this->dumpHelp($positional);
-
-               return $usage . "\n\n" . $help . "\n";
-       }
-
-       function listSpec() {
-               $flags = [];
-               $required = [];
-               $optional = [];
-               $positional = [];
-               foreach ($this->args->getSpec() as $spec) {
-                       if (is_numeric($spec[0])) {
-                               $positional[] = $spec;
-                       } elseif ($spec[3] & Args::REQUIRED) {
-                               $required[] = $spec;
-                       } elseif ($spec[3] & (Args::OPTARG|Args::REQARG)) {
-                               $optional[] = $spec;
-                       } else {
-                               $flags[] = $spec;
-                       }
-               }
-
-               return [$flags, $required, $optional, $positional]
-                       + compact("flags", "required", "optional", "positional");
-       }
-
-       function dumpFlags(array $flags) {
-               return sprintf(" [-%s]", implode("", array_column($flags, 0)));
-       }
-
-       function dumpRequired(array $required) {
-               $dump = "";
-               foreach ($required as $req) {
-                       $dump .= sprintf(" -%s <%s>", $req[0], $req[1]);
-               }
-               return $dump;
-       }
-
-       function dumpOptional(array $optional) {
-               $req = array_filter($optional, function($a) {
-                       return $a[3] & Args::REQARG;
-               });
-               $opt = array_filter($optional, function($a) {
-                       return $a[3] & Args::OPTARG;
-               });
-
-               $dump = "";
-               if ($req) {
-                       $dump .= sprintf(" [-%s <arg>]", implode("|-", array_column($req, 0)));
-               }
-               if ($opt) {
-                       $dump .= sprintf(" [-%s [<arg>]]", implode("|-", array_column($opt, 0)));
-               }
-               return $dump;
-       }
-
-       function dumpPositional(array $positional) {
-               $dump = " [--]";
-               foreach ($positional as $pos) {
-                       if ($pos[3] & Args::REQUIRED) {
-                               $dump .= sprintf(" <%s>", $pos[1]);
-                       } else {
-                               $dump .= sprintf(" [<%s>]", $pos[1]);
-                       }
-                       if ($pos[3] & Args::MULTI) {
-                               $dump .= sprintf(" [<%s>]...", $pos[1]);
-                       }
-               }
-               return $dump;
-       }
-
-       function calcMaxLen() {
-               $spc = $this->args->getSpec();
-               $max = max(array_map("strlen", array_column($spc, 1)));
-               $max += $max % 8 + 2;
-               return $max;
-       }
-
-       function dumpHelp() {
-               $max = $this->calcMaxLen();
-               $dump = "";
-               foreach ($this->args->getSpec() as $spec) {
-                       $dump .= "    ";
-                       if (is_numeric($spec[0])) {
-                               $dump .= sprintf("--   %s ", $spec[1]);
-                       } elseif (isset($spec[0])) {
-                               $dump .= sprintf("-%s|", $spec[0]);
-                       }
-                       if (!is_numeric($spec[0])) {
-                               $dump .= sprintf("--%s ", $spec[1]);
-                       }
-                       if ($spec[3] & Args::REQARG) {
-                               $dump .= "<arg>  ";
-                       } elseif ($spec[3] & Args::OPTARG) {
-                               $dump .= "[<arg>]";
-                       } else {
-                               $dump .= "       ";
-                       }
-
-                       $dump .= str_repeat(" ", $max-strlen($spec[1])+3*!isset($spec[0]));
-                       $dump .= $spec[2];
-
-                       if ($spec[3] & Args::REQUIRED) {
-                               $dump .= " (REQUIRED)";
-                       }
-                       if ($spec[3] & Args::MULTI) {
-                               $dump .= " (MULTIPLE)";
-                       }
-                       if (isset($spec[4])) {
-                               $dump .= sprintf(" [%s]", $spec[4]);
-                       }
-                       $dump .= "\n";
-               }
-               return $dump;
-       }
-}
-<?php
-
-namespace pharext\Cli;
-
-/**
- * Command line arguments
- */
-class Args implements \ArrayAccess
-{
-       /**
-        * Optional option
-        */
-       const OPTIONAL = 0x000;
-
-       /**
-        * Required Option
-        */
-       const REQUIRED = 0x001;
-
-       /**
-        * Only one value, even when used multiple times
-        */
-       const SINGLE = 0x000;
-
-       /**
-        * Aggregate an array, when used multiple times
-        */
-       const MULTI = 0x010;
-
-       /**
-        * Option takes no argument
-        */
-       const NOARG = 0x000;
-
-       /**
-        * Option requires an argument
-        */
-       const REQARG = 0x100;
-
-       /**
-        * Option takes an optional argument
-        */
-       const OPTARG = 0x200;
-
-       /**
-        * Option halts processing
-        */
-       const HALT = 0x10000000;
-
-       /**
-        * Original option spec
-        * @var array
-        */
-       private $orig = [];
-
-       /**
-        * Compiled spec
-        * @var array
-        */
-       private $spec = [];
-
-       /**
-        * Parsed args
-        * @var array
-        */
-       private $args = [];
-
-       /**
-        * Compile the original spec
-        * @param array|Traversable $spec
-        */
-       public function __construct($spec = null) {
-               if (is_array($spec) || $spec instanceof Traversable) {
-                       $this->compile($spec);
-               }
-
-       }
-
-       /**
-        * Compile the original spec
-        * @param array|Traversable $spec
-        * @return pharext\Cli\Args self
-        */
-       public function compile($spec) {
-               foreach ($spec as $arg) {
-                       if (isset($arg[0]) && is_numeric($arg[0])) {
-                               $arg[3] &= ~0xf00;
-                               $this->spec["--".$arg[0]] = $arg;
-                       } elseif (isset($arg[0])) {
-                               $this->spec["-".$arg[0]] = $arg;
-                               $this->spec["--".$arg[1]] = $arg;
-                       } else {
-                               $this->spec["--".$arg[1]] = $arg;
-                       }
-                       $this->orig[] = $arg;
-               }
-               return $this;
-       }
-
-       /**
-        * Get original spec
-        * @return array
-        */
-       public function getSpec() {
-               return $this->orig;
-       }
-
-       /**
-        * Get compiled spec
-        * @return array
-        */
-       public function getCompiledSpec() {
-               return $this->spec;
-       }
-
-       /**
-        * Parse command line arguments according to the compiled spec.
-        *
-        * The Generator yields any parsing errors.
-        * Parsing will stop when all arguments are processed or the first option
-        * flagged Cli\Args::HALT was encountered.
-        *
-        * @param int $argc
-        * @param array $argv
-        * @return Generator
-        */
-       public function parse($argc, array $argv) {
-               for ($f = false, $p = 0, $i = 0; $i < $argc; ++$i) {
-                       $o = $argv[$i];
-
-                       if ($o{0} === "-" && strlen($o) > 2 && $o{1} !== "-") {
-                               // multiple short opts, e.g. -vps
-                               $argc += strlen($o) - 2;
-                               array_splice($argv, $i, 1, array_map(function($s) {
-                                       return "-$s";
-                               }, str_split(substr($o, 1))));
-                               $o = $argv[$i];
-                       } elseif ($o{0} === "-" && strlen($o) > 2 && $o{1} === "-" && 0 < ($eq = strpos($o, "="))) {
-                               // long opt with argument, e.g. --foo=bar
-                               $argc++;
-                               array_splice($argv, $i, 1, [
-                                       substr($o, 0, $eq++),
-                                       substr($o, $eq)
-                               ]);
-                               $o = $argv[$i];
-                       } elseif ($o === "--") {
-                               // only positional args following
-                               $f = true;
-                               continue;
-                       }
-
-                       if ($f || !isset($this->spec[$o])) {
-                               if ($o{0} !== "-" && isset($this->spec["--$p"])) {
-                                       $this[$p] = $o;
-                                       if (!$this->optIsMulti($p)) {
-                                               ++$p;
-                                       }
-                               } else {
-                                       yield sprintf("Unknown option %s", $o);
-                               }
-                       } elseif (!$this->optAcceptsArg($o)) {
-                               $this[$o] = true;
-                       } elseif ($i+1 < $argc && !isset($this->spec[$argv[$i+1]])) {
-                               $this[$o] = $argv[++$i];
-                       } elseif ($this->optRequiresArg($o)) {
-                               yield sprintf("Option --%s requires an argument", $this->optLongName($o));
-                       } else {
-                               // OPTARG
-                               $this[$o] = $this->optDefaultArg($o);
-                       }
-
-                       if ($this->optHalts($o)) {
-                               return;
-                       }
-               }
-       }
-
-       /**
-        * Validate that all required options were given.
-        *
-        * The Generator yields any validation errors.
-        *
-        * @return Generator
-        */
-       public function validate() {
-               $required = array_filter($this->orig, function($spec) {
-                       return $spec[3] & self::REQUIRED;
-               });
-               foreach ($required as $req) {
-                       if ($req[3] & self::MULTI) {
-                               if (is_array($this[$req[0]])) {
-                                       continue;
-                               }
-                       } elseif (strlen($this[$req[0]])) {
-                               continue;
-                       }
-                       if (is_numeric($req[0])) {
-                               yield sprintf("Argument <%s> is required", $req[1]);
-                       } else {
-                               yield sprintf("Option --%s is required", $req[1]);
-                       }
-               }
-       }
-
-
-       public function toArray() {
-               $args = [];
-               foreach ($this->spec as $spec) {
-                       $opt = $this->opt($spec[1]);
-                       $args[$opt] = $this[$opt];
-               }
-               return $args;
-       }
-
-       /**
-        * Retreive the default argument of an option
-        * @param string $o
-        * @return mixed
-        */
-       private function optDefaultArg($o) {
-               $o = $this->opt($o);
-               if (isset($this->spec[$o][4])) {
-                       return $this->spec[$o][4];
-               }
-               return null;
-       }
-
-       /**
-        * Retrieve the help message of an option
-        * @param string $o
-        * @return string
-        */
-       private function optHelp($o) {
-               $o = $this->opt($o);
-               if (isset($this->spec[$o][2])) {
-                       return $this->spec[$o][2];
-               }
-               return "";
-       }
-
-       /**
-        * Retrieve option's flags
-        * @param string $o
-        * @return int
-        */
-       private function optFlags($o) {
-               $o = $this->opt($o);
-               if (isset($this->spec[$o])) {
-                       return $this->spec[$o][3];
-               }
-               return null;
-       }
-
-       /**
-        * Check whether an option is flagged for halting argument processing
-        * @param string $o
-        * @return boolean
-        */
-       private function optHalts($o) {
-               return $this->optFlags($o) & self::HALT;
-       }
-
-       /**
-        * Check whether an option needs an argument
-        * @param string $o
-        * @return boolean
-        */
-       private function optRequiresArg($o) {
-               return $this->optFlags($o) & self::REQARG;
-       }
-
-       /**
-        * Check wether an option accepts any argument
-        * @param string $o
-        * @return boolean
-        */
-       private function optAcceptsArg($o) {
-               return $this->optFlags($o) & 0xf00;
-       }
-
-       /**
-        * Check whether an option can be used more than once
-        * @param string $o
-        * @return boolean
-        */
-       private function optIsMulti($o) {
-               return $this->optFlags($o) & self::MULTI;
-       }
-
-       /**
-        * Retreive the long name of an option
-        * @param string $o
-        * @return string
-        */
-       private function optLongName($o) {
-               $o = $this->opt($o);
-               return is_numeric($this->spec[$o][0]) ? $this->spec[$o][0] : $this->spec[$o][1];
-       }
-
-       /**
-        * Retreive the short name of an option
-        * @param string $o
-        * @return string
-        */
-       private function optShortName($o) {
-               $o = $this->opt($o);
-               return is_numeric($this->spec[$o][0]) ? null : $this->spec[$o][0];
-       }
-
-       /**
-        * Retreive the canonical name (--long-name) of an option
-        * @param string $o
-        * @return string
-        */
-       private function opt($o) {
-               if (is_numeric($o)) {
-                       return "--$o";
-               }
-               if ($o{0} !== '-') {
-                       if (strlen($o) > 1) {
-                               $o = "-$o";
-                       }
-                       $o = "-$o";
-               }
-               return $o;
-       }
-
-       /**@+
-        * Implements ArrayAccess and virtual properties
-        */
-       function offsetExists($o) {
-               $o = $this->opt($o);
-               return isset($this->args[$o]);
-       }
-       function __isset($o) {
-               return $this->offsetExists($o);
-       }
-       function offsetGet($o) {
-               $o = $this->opt($o);
-               if (isset($this->args[$o])) {
-                       return $this->args[$o];
-               }
-               return $this->optDefaultArg($o);
-       }
-       function __get($o) {
-               return $this->offsetGet($o);
-       }
-       function offsetSet($o, $v) {
-               $osn = $this->optShortName($o);
-               $oln = $this->optLongName($o);
-               if ($this->optIsMulti($o)) {
-                       if (isset($osn)) {
-                               $this->args["-$osn"][] = $v;
-                       }
-                       $this->args["--$oln"][] = $v;
-               } else {
-                       if (isset($osn)) {
-                               $this->args["-$osn"] = $v;
-                       }
-                       $this->args["--$oln"] = $v;
-               }
-       }
-       function __set($o, $v) {
-               $this->offsetSet($o, $v);
-       }
-       function offsetUnset($o) {
-               unset($this->args["-".$this->optShortName($o)]);
-               unset($this->args["--".$this->optLongName($o)]);
-       }
-       function __unset($o) {
-               $this->offsetUnset($o);
-       }
-       /**@-*/
-}
-<?php
-
-namespace pharext\Cli;
-
-use pharext\Archive;
-
-use Phar;
-
-trait Command
-{
-       /**
-        * Command line arguments
-        * @var pharext\Cli\Args
-        */
-       private $args;
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::getArgs()
-        */
-       public function getArgs() {
-               return $this->args;
-       }
-
-       /**
-        * Retrieve metadata of the currently running phar
-        * @param string $key
-        * @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;
-       }
-
-       /**
-        * Output pharext vX.Y.Z header
-        */
-       public function header() {
-               if (!headers_sent()) {
-                       /* only display header, if we didn't generate any output yet */
-                       printf("%s\n\n", $this->metadata("header"));
-               }
-       }
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::debug()
-        */
-       public function debug($fmt) {
-               if ($this->args->verbose) {
-                       vprintf($fmt, array_slice(func_get_args(), 1));
-               }
-       }
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::info()
-        */
-       public function info($fmt) {
-               if (!$this->args->quiet) {
-                       vprintf($fmt, array_slice(func_get_args(), 1));
-               }
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::warn()
-        */
-       public function warn($fmt) {
-               if (!$this->args->quiet) {
-                       if (!isset($fmt)) {
-                               $fmt = "%s\n";
-                               $arg = error_get_last()["message"];
-                       } else {
-                               $arg = array_slice(func_get_args(), 1);
-                       }
-                       vfprintf(STDERR, "Warning: $fmt", $arg);
-               }
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::error()
-        */
-       public function error($fmt) {
-               if (!isset($fmt)) {
-                       $fmt = "%s\n";
-                       $arg = error_get_last()["message"];
-               } else {
-                       $arg = array_slice(func_get_args(), 1);
-               }
-               vfprintf(STDERR, "ERROR: $fmt", $arg);
-       }
-
-       /**
-        * Output command line help message
-        * @param string $prog
-        */
-       public function help($prog) {
-               print new Args\Help($prog, $this->args);
-       }
-       
-       /**
-        * Verbosity
-        * @return boolean
-        */
-       public function verbosity() {
-               if ($this->args->verbose) {
-                       return true;
-               } elseif ($this->args->quiet) {
-                       return false;
-               } else {
-                       return null;
-               }
-       }
-}
-<?php
-
-namespace pharext;
-
-/**
- * Command interface
- */
-interface Command
-{
-       /**
-        * Argument error
-        */
-       const EARGS = 1;
-       /**
-        * Build error
-        */
-       const EBUILD = 2;
-       /**
-        * Signature error
-        */
-       const ESIGN = 3;
-       /**
-        * Extract/unpack error
-        */
-       const EEXTRACT = 4;
-       /**
-        * Install error
-        */
-       const EINSTALL = 5;
-       
-       /**
-        * Retrieve command line arguments
-        * @return pharext\Cli\Args
-        */
-       public function getArgs();
-       
-       /**
-        * Print debug message
-        * @param string $fmt
-        * @param string ...$args
-        */
-       public function debug($fmt);
-       
-       /**
-        * Print info
-        * @param string $fmt
-        * @param string ...$args
-        */
-       public function info($fmt);
-       
-       /**
-        * Print warning
-        * @param string $fmt
-        * @param string ...$args
-        */
-       public function warn($fmt);
-
-       /**
-        * Print error
-        * @param string $fmt
-        * @param string ...$args
-        */
-       public function error($fmt);
-
-       /**
-        * Execute the command
-        * @param int $argc command line argument count
-        * @param array $argv command line argument list
-        */
-       public function run($argc, array $argv);
-}
-<?php
-
-namespace pharext;
-
-class Exception extends \Exception
-{
-       public function __construct($message = null, $code = 0, $previous = null) {
-               if (!isset($message)) {
-                       $last_error = error_get_last();
-                       $message = $last_error["message"];
-                       if (!$code) {
-                               $code = $last_error["type"];
-                       }
-               }
-               parent::__construct($message, $code, $previous);
-       }
-}
-<?php
-
-namespace pharext;
-
-/**
- * Execute system command
- */
-class ExecCmd
-{
-       /**
-        * Sudo command, if the cmd needs escalated privileges
-        * @var string
-        */
-       private $sudo;
-       
-       /**
-        * Executable of the cmd
-        * @var string
-        */
-       private $command;
-       
-       /**
-        * Passthrough cmd output
-        * @var bool
-        */
-       private $verbose;
-       
-       /**
-        * Output of cmd run
-        * @var string
-        */
-       private $output;
-       
-       /**
-        * Return code of cmd run
-        * @var int
-        */
-       private $status;
-
-       /**
-        * @param string $command
-        * @param bool verbose
-        */
-       public function __construct($command, $verbose = false) {
-               $this->command = $command;
-               $this->verbose = $verbose;
-       }
-       
-       /**
-        * (Re-)set sudo command
-        * @param string $sudo
-        */
-       public function setSu($sudo = false) {
-               $this->sudo = $sudo;
-       }
-       
-       /**
-        * Execute a program with escalated privileges handling interactive password prompt
-        * @param string $command
-        * @param bool $verbose
-        * @return int exit status
-        */
-       private function suExec($command, $verbose = null) {
-               if (!($proc = proc_open($command, [STDIN,["pipe","w"],["pipe","w"]], $pipes))) {
-                       $this->status = -1;
-                       throw new Exception("Failed to run {$command}");
-               }
-               
-               $stdout = $pipes[1];
-               $passwd = 0;
-               $checks = 10;
-
-               while (!feof($stdout)) {
-                       $R = [$stdout]; $W = []; $E = [];
-                       if (!stream_select($R, $W, $E, null)) {
-                               continue;
-                       }
-                       $data = fread($stdout, 0x1000);
-                       /* only check a few times */
-                       if ($passwd < $checks) {
-                               $passwd++;
-                               if (stristr($data, "password")) {
-                                       $passwd = $checks + 1;
-                                       printf("\n%s", $data);
-                                       continue;
-                               }
-                       } elseif ($passwd > $checks) {
-                               /* new line after pw entry */
-                               printf("\n");
-                               $passwd = $checks;
-                       }
-                       
-                       if ($verbose === null) {
-                               print $this->progress($data, 0);
-                       } else {
-                               if ($verbose) {
-                                       printf("%s", $data);
-                               }
-                               $this->output .= $data;
-                       }
-               }
-               if ($verbose === null) {
-                       $this->progress("", PHP_OUTPUT_HANDLER_FINAL);
-               }
-               return $this->status = proc_close($proc);
-       }
-
-       /**
-        * Output handler that displays some progress while soaking output
-        * @param string $string
-        * @param int $flags
-        * @return string
-        */
-       private function progress($string, $flags) {
-               static $counter = 0;
-               static $symbols = ["\\","|","/","-"];
-
-               $this->output .= $string;
-               
-               if (false !== strpos($string, "\n")) {
-                       ++$counter;
-               }
-
-               return $flags & PHP_OUTPUT_HANDLER_FINAL
-                       ? "   \r"
-                       : sprintf("  %s\r", $symbols[$counter % 4]);
-       }
-
-       /**
-        * Run the command
-        * @param array $args
-        * @return \pharext\ExecCmd self
-        * @throws \pharext\Exception
-        */
-       public function run(array $args = null) {
-               $exec = escapeshellcmd($this->command);
-               if ($args) {
-                       $exec .= " ". implode(" ", array_map("escapeshellarg", (array) $args));
-               }
-               
-               if ($this->sudo) {
-                       $this->suExec(sprintf($this->sudo." 2>&1", $exec), $this->verbose);
-               } elseif ($this->verbose) {
-                       ob_start(function($s) {
-                               $this->output .= $s;
-                               return $s;
-                       }, 1);
-                       passthru($exec, $this->status);
-                       ob_end_flush();
-               } elseif ($this->verbose !== false /* !quiet */) {
-                       ob_start([$this, "progress"], 1);
-                       passthru($exec . " 2>&1", $this->status);
-                       ob_end_flush();
-               } else {
-                       exec($exec ." 2>&1", $output, $this->status);
-                       $this->output = implode("\n", $output);
-               }
-               
-               if ($this->status) {
-                       throw new Exception("Command {$exec} failed ({$this->status})");
-               }
-
-               return $this;
-       }
-       
-       /**
-        * Retrieve exit code of cmd run
-        * @return int
-        */
-       public function getStatus() {
-               return $this->status;
-       }
-       
-       /**
-        * Retrieve output of cmd run
-        * @return string
-        */
-       public function getOutput() {
-               return $this->output;
-       }
-}
-<?php
-
-namespace pharext;
-
-use Phar;
-use SplObjectStorage;
-
-/**
- * The extension install command executed by the extension phar
- */
-class Installer implements Command
-{
-       use Cli\Command;
-
-       /**
-        * Cleanups
-        * @var array
-        */
-       private $cleanup = [];
-
-       /**
-        * Create the command
-        */
-       public function __construct() {
-               $this->args = new Cli\Args([
-                       ["h", "help", "Display help",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       ["v", "verbose", "More output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["q", "quiet", "Less output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["p", "prefix", "PHP installation prefix if phpize is not in \$PATH, e.g. /opt/php7",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["n", "common-name", "PHP common program name, e.g. php5 or zts-php",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG,
-                               "php"],
-                       ["c", "configure", "Additional extension configure flags, e.g. -c --with-flag",
-                               Cli\Args::OPTIONAL|Cli\Args::MULTI|Cli\Args::REQARG],
-                       ["s", "sudo", "Installation might need increased privileges",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::OPTARG,
-                               "sudo -S %s"],
-                       ["i", "ini", "Activate in this php.ini instead of loaded default php.ini",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       [null, "signature", "Show package signature",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "license", "Show package license",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "name", "Show package name",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "date", "Show package release date",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "release", "Show package release version",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "version", "Show pharext version",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-               ]);
-       }
-
-       /**
-        * Perform cleaniup
-        */
-       function __destruct() {
-               foreach ($this->cleanup as $cleanup) {
-                       $cleanup->run();
-               }
-       }
-
-       private function extract($phar) {
-               $temp = (new Task\Extract($phar))->run($this->verbosity());
-               $this->cleanup[] = new Task\Cleanup($temp);
-               return $temp;
-       }
-
-       private function hooks(SplObjectStorage $phars) {
-               $hook = [];
-               foreach ($phars as $phar) {
-                       if (isset($phar["pharext_package.php"])) {
-                               $sdir = include $phar["pharext_package.php"];
-                               if ($sdir instanceof SourceDir) {
-                                       $this->args->compile($sdir->getArgs());
-                                       $hook[] = $sdir;
-                               }
-                       }
-               }
-               return $hook;
-       }
-
-       private function load() {
-               $list = new SplObjectStorage();
-               $phar = extension_loaded("Phar")
-                       ? new Phar(Phar::running(false))
-                       : new Archive(PHAREXT_PHAR);
-               $temp = $this->extract($phar);
-
-               foreach ($phar as $entry) {
-                       $dep_file = $entry->getBaseName();
-                       if (fnmatch("*.ext.phar*", $dep_file)) {
-                               $dep_phar = extension_loaded("Phar")
-                                       ? new Phar("$temp/$dep_file")
-                                       : new Archive("$temp/$dep_file");
-                               $list[$dep_phar] = $this->extract($dep_phar);
-                       }
-               }
-
-               /* the actual ext.phar at last */
-               $list[$phar] = $temp;
-               return $list;
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::run()
-        */
-       public function run($argc, array $argv) {
-               try {
-                       /* load the phar(s) */
-                       $list = $this->load();
-                       /* installer hooks */
-                       $hook = $this->hooks($list);
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EEXTRACT);
-               }
-
-               /* standard arg stuff */
-               $errs = [];
-               $prog = array_shift($argv);
-               foreach ($this->args->parse(--$argc, $argv) as $error) {
-                       $errs[] = $error;
-               }
-
-               if ($this->args["help"]) {
-                       $this->header();
-                       $this->help($prog);
-                       exit;
-               }
-               try {
-                       foreach (["signature", "name", "date", "license", "release", "version"] as $opt) {
-                               if ($this->args[$opt]) {
-                                       printf("%s\n", $this->metadata($opt));
-                                       exit;
-                               }
-                       }
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EARGS);
-               }
-
-               foreach ($this->args->validate() as $error) {
-                       $errs[] = $error;
-               }
-
-               if ($errs) {
-                       if (!$this->args["quiet"]) {
-                               $this->header();
-                       }
-                       foreach ($errs as $err) {
-                               $this->error("%s\n", $err);
-                       }
-                       if (!$this->args["quiet"]) {
-                               $this->help($prog);
-                       }
-                       exit(self::EARGS);
-               }
-
-               try {
-                       /* post process hooks */
-                       foreach ($hook as $sdir) {
-                               $sdir->setArgs($this->args);
-                       }
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EARGS);
-               }
-
-               /* install packages */
-               try {
-                       foreach ($list as $phar) {
-                               $this->info("Installing %s ...\n", basename($phar->getPath()));
-                               $this->install($list[$phar]);
-                               $this->activate($list[$phar]);
-                               $this->info("Successfully installed %s!\n", basename($phar->getPath()));
-                       }
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EINSTALL);
-               }
-       }
-
-       /**
-        * Phpize + trinity
-        */
-       private function install($temp) {
-               // phpize
-               $phpize = new Task\Phpize($temp, $this->args->prefix, $this->args->{"common-name"});
-               $phpize->run($this->verbosity());
-
-               // configure
-               $configure = new Task\Configure($temp, $this->args->configure, $this->args->prefix, $this->args->{"common-name"});
-               $configure->run($this->verbosity());
-
-               // make
-               $make = new Task\Make($temp);
-               $make->run($this->verbosity());
-
-               // install
-               $sudo = isset($this->args->sudo) ? $this->args->sudo : null;
-               $install = new Task\Make($temp, ["install"], $sudo);
-               $install->run($this->verbosity());
-       }
-
-       private function activate($temp) {
-               if ($this->args->ini) {
-                       $files = [$this->args->ini];
-               } else {
-                       $files = array_filter(array_map("trim", explode(",", php_ini_scanned_files())));
-                       $files[] = php_ini_loaded_file();
-               }
-
-               $sudo = isset($this->args->sudo) ? $this->args->sudo : null;
-               $type = $this->metadata("type") ?: "extension";
-
-               $activate = new Task\Activate($temp, $files, $type, $this->args->prefix, $this->args{"common-name"}, $sudo);
-               if (!$activate->run($this->verbosity())) {
-                       $this->info("Extension already activated ...\n");
-               }
-       }
-}
-<?php
-
-namespace pharext;
-
-trait License
-{
-       function findLicense($dir, $file = null) {
-               if (isset($file)) {
-                       return realpath("$dir/$file");
-               }
-
-               $names = [];
-               foreach (["{,UN}LICEN{S,C}{E,ING}", "COPY{,ING,RIGHT}"] as $name) {
-                       $names[] = $this->mergeLicensePattern($name, strtolower($name));
-               }
-               $exts = [];
-               foreach (["t{,e}xt", "rst", "asc{,i,ii}", "m{,ark}d{,own}", "htm{,l}"] as $ext) {
-                       $exts[] = $this->mergeLicensePattern(strtoupper($ext), $ext);
-               }
-               
-               $pattern = "{". implode(",", $names) ."}{,.{". implode(",", $exts) ."}}";
-
-               if (($glob = glob("$dir/$pattern", GLOB_BRACE))) {
-                       return current($glob);
-               }
-       }
-
-       private function mergeLicensePattern($upper, $lower) {
-               $pattern = "";
-               $length = strlen($upper);
-               for ($i = 0; $i < $length; ++$i) {
-                       if ($lower{$i} === $upper{$i}) {
-                               $pattern .= $upper{$i};
-                       } else {
-                               $pattern .= "[" . $upper{$i} . $lower{$i} . "]";
-                       }
-               }
-               return $pattern;
-       }
-
-       public function readLicense($file) {
-               $text = file_get_contents($file);
-               switch (strtolower(pathinfo($file, PATHINFO_EXTENSION))) {
-                       case "htm":
-                       case "html":
-                               $text = strip_tags($text);
-                               break;
-               }
-               return $text;
-       }
-}
-<?php
-
-namespace pharext;
-
-class Metadata
-{
-       static function version() {
-               return "4.1.1";
-       }
-
-       static function header() {
-               return sprintf("pharext v%s (c) Michael Wallner <mike@php.net>", self::version());
-       }
-
-       static function date() {
-               return gmdate("Y-m-d");
-       }
-
-       static function all() {
-               return [
-                       "version" => self::version(),
-                       "header" => self::header(),
-                       "date" => self::date(),
-               ];
-       }
-}
-<?php
-
-namespace pharext\Openssl;
-
-use pharext\Exception;
-
-class PrivateKey
-{
-       /**
-        * Private key
-        * @var string
-        */
-       private $key;
-       
-       /**
-        * Public key
-        * @var string
-        */
-       private $pub;
-
-       /**
-        * Read a private key
-        * @param string $file
-        * @param string $password
-        * @throws \pharext\Exception
-        */
-       function __construct($file, $password) {
-               /* there appears to be a bug with refcount handling of this
-                * resource; when the resource is stored as property, it cannot be
-                * "coerced to a private key" on openssl_sign() later in another method
-                */
-               $key = openssl_pkey_get_private("file://$file", $password);
-               if (!is_resource($key)) {
-                       throw new Exception("Could not load private key");
-               }
-               openssl_pkey_export($key, $this->key);
-               $this->pub = openssl_pkey_get_details($key)["key"];
-       }
-
-       /**
-        * Sign the PHAR
-        * @param \Phar $package
-        */
-       function sign(\Phar $package) {
-               $package->setSignatureAlgorithm(\Phar::OPENSSL, $this->key);
-       }
-
-       /**
-        * Export the public key to a file
-        * @param string $file
-        * @throws \pharext\Exception
-        */
-       function exportPublicKey($file) {
-               if (!file_put_contents("$file.tmp", $this->pub) || !rename("$file.tmp", $file)) {
-                       throw new Exception;
-               }
-       }
-}
-<?php
-
-namespace pharext;
-
-use Phar;
-use pharext\Exception;
-
-/**
- * The extension packaging command executed by bin/pharext
- */
-class Packager implements Command
-{
-       use Cli\Command;
-       
-       /**
-        * Extension source directory
-        * @var pharext\SourceDir
-        */
-       private $source;
-       
-       /**
-        * Cleanups
-        * @var array
-        */
-       private $cleanup = [];
-       
-       /**
-        * Create the command
-        */
-       public function __construct() {
-               $this->args = new Cli\Args([
-                       ["h", "help", "Display this help",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       ["v", "verbose", "More output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["q", "quiet", "Less output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["n", "name", "Extension name",
-                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["r", "release", "Extension release version",
-                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["s", "source", "Extension source directory",
-                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["g", "git", "Use `git ls-tree` to determine file list",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["b", "branch", "Checkout this tag/branch",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["p", "pecl", "Use PECL package.xml to determine file list, name and release",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["d", "dest", "Destination directory",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG,
-                               "."],
-                       ["z", "gzip", "Create additional PHAR compressed with gzip",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["Z", "bzip", "Create additional PHAR compressed with bzip",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["S", "sign", "Sign the PHAR with a private key",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["E", "zend", "Mark as Zend Extension",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       [null, "signature", "Show pharext signature",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "license", "Show pharext license",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "version", "Show pharext version",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-               ]);
-       }
-       
-       /**
-        * Perform cleaniup
-        */
-       function __destruct() {
-               foreach ($this->cleanup as $cleanup) {
-                       $cleanup->run();
-               }
-       }
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::run()
-        */
-       public function run($argc, array $argv) {
-               $errs = [];
-               $prog = array_shift($argv);
-               foreach ($this->args->parse(--$argc, $argv) as $error) {
-                       $errs[] = $error;
-               }
-               
-               if ($this->args["help"]) {
-                       $this->header();
-                       $this->help($prog);
-                       exit;
-               }
-               try {
-                       foreach (["signature", "license", "version"] as $opt) {
-                               if ($this->args[$opt]) {
-                                       printf("%s\n", $this->metadata($opt));
-                                       exit;
-                               }
-                       }
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EARGS);
-               }
-
-               try {
-                       /* source needs to be evaluated before Cli\Args validation, 
-                        * so e.g. name and version can be overriden and Cli\Args 
-                        * does not complain about missing arguments
-                        */
-                       $this->loadSource();
-               } catch (\Exception $e) {
-                       $errs[] = $e->getMessage();
-               }
-               
-               foreach ($this->args->validate() as $error) {
-                       $errs[] = $error;
-               }
-               
-               if ($errs) {
-                       if (!$this->args["quiet"]) {
-                               $this->header();
-                       }
-                       foreach ($errs as $err) {
-                               $this->error("%s\n", $err);
-                       }
-                       printf("\n");
-                       if (!$this->args["quiet"]) {
-                               $this->help($prog);
-                       }
-                       exit(self::EARGS);
-               }
-               
-               $this->createPackage();
-       }
-       
-       /**
-        * Download remote source
-        * @param string $source
-        * @return string local source
-        */
-       private function download($source) {
-               if ($this->args->git) {
-                       $task = new Task\GitClone($source, $this->args->branch);
-               } else {
-                       /* print newline only once */
-                       $done = false;
-                       $task = new Task\StreamFetch($source, function($bytes_pct) use(&$done) {
-                               if (!$done) {
-                                       $this->info(" %3d%% [%s>%s] \r",
-                                               floor($bytes_pct*100),
-                                               str_repeat("=", round(50*$bytes_pct)),
-                                               str_repeat(" ", round(50*(1-$bytes_pct)))
-                                       );
-                                       if ($bytes_pct == 1) {
-                                               $done = true;
-                                               $this->info("\n");
-                                       }
-                               }
-                       });
-               }
-               $local = $task->run($this->verbosity());
-
-               $this->cleanup[] = new Task\Cleanup($local);
-               return $local;
-       }
-
-       /**
-        * Extract local archive
-        * @param stirng $source
-        * @return string extracted directory
-        */
-       private function extract($source) {
-               try {
-                       $task = new Task\Extract($source);
-                       $dest = $task->run($this->verbosity());
-               } catch (\Exception $e) {
-                       if (false === strpos($e->getMessage(), "checksum mismatch")) {
-                               throw $e;
-                       }
-                       $dest = (new Task\PaxFixup($source))->run($this->verbosity());
-               }
-               
-               $this->cleanup[] = new Task\Cleanup($dest);
-               return $dest;
-       }
-
-       /**
-        * Localize a possibly remote source
-        * @param string $source
-        * @return string local source directory
-        */
-       private function localize($source) {
-               if (!stream_is_local($source) || ($this->args->git && isset($this->args->branch))) {
-                       $source = $this->download($source);
-                       $this->cleanup[] = new Task\Cleanup($source);
-               }
-               $source = realpath($source);
-               if (!is_dir($source)) {
-                       $source = $this->extract($source);
-                       $this->cleanup[] = new Task\Cleanup($source);
-                       
-                       if (!$this->args->git) {
-                               $source = (new Task\PeclFixup($source))->run($this->verbosity());
-                       }
-               }
-               return $source;
-       }
-
-       /**
-        * Load the source dir
-        * @throws \pharext\Exception
-        */
-       private function loadSource(){
-               if ($this->args["source"]) {
-                       $source = $this->localize($this->args["source"]);
-
-                       if ($this->args["pecl"]) {
-                               $this->source = new SourceDir\Pecl($source);
-                       } elseif ($this->args["git"]) {
-                               $this->source = new SourceDir\Git($source);
-                       } elseif (is_file("$source/pharext_package.php")) {
-                               $this->source = include "$source/pharext_package.php";
-                       } else {
-                               $this->source = new SourceDir\Basic($source);
-                       }
-
-                       if (!$this->source instanceof SourceDir) {
-                               throw new Exception("Unknown source dir $source");
-                       }
-
-                       foreach ($this->source->getPackageInfo() as $key => $val) {
-                               $this->args->$key = $val;
-                       }
-               }
-       }
-
-       /**
-        * Creates the extension phar
-        */
-       private function createPackage() {
-               try {
-                       $meta = array_merge(Metadata::all(), [
-                               "name" => $this->args->name,
-                               "release" => $this->args->release,
-                               "license" => $this->source->getLicense(),
-                               "type" => $this->args->zend ? "zend_extension" : "extension",
-                       ]);
-                       $file = (new Task\PharBuild($this->source, __DIR__."/../pharext_installer.php", $meta))->run($this->verbosity());
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EBUILD);
-               }
-
-               try {
-                       if ($this->args->sign) {
-                               $this->info("Using private key to sign phar ...\n");
-                               $pass = (new Task\Askpass)->run($this->verbosity());
-                               $sign = new Task\PharSign($file, $this->args->sign, $pass);
-                               $pkey = $sign->run($this->verbosity());
-                       }
-
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::ESIGN);
-               }
-
-               if ($this->args->gzip) {
-                       try {
-                               $gzip = (new Task\PharCompress($file, Phar::GZ))->run();
-                               $move = new Task\PharRename($gzip, $this->args->dest, $this->args->name ."-". $this->args->release);
-                               $name = $move->run($this->verbosity());
-
-                               $this->info("Created gzipped phar %s\n", $name);
-
-                               if ($this->args->sign) {
-                                       $sign = new Task\PharSign($name, $this->args->sign, $pass);
-                                       $sign->run($this->verbosity())->exportPublicKey($name.".pubkey");
-                               }
-
-                       } catch (\Exception $e) {
-                               $this->warn("%s\n", $e->getMessage());
-                       }
-               }
-               
-               if ($this->args->bzip) {
-                       try {
-                               $bzip = (new Task\PharCompress($file, Phar::BZ2))->run();
-                               $move = new Task\PharRename($bzip, $this->args->dest, $this->args->name ."-". $this->args->release);
-                               $name = $move->run($this->verbosity());
-
-                               $this->info("Created bzipped phar %s\n", $name);
-
-                               if ($this->args->sign) {
-                                       $sign = new Task\PharSign($name, $this->args->sign, $pass);
-                                       $sign->run($this->verbosity())->exportPublicKey($name.".pubkey");
-                               }
-
-                       } catch (\Exception $e) {
-                               $this->warn("%s\n", $e->getMessage());
-                       }
-               }
-
-               try {
-                       $move = new Task\PharRename($file, $this->args->dest, $this->args->name ."-". $this->args->release);
-                       $name = $move->run($this->verbosity());
-
-                       $this->info("Created executable phar %s\n", $name);
-
-                       if (isset($pkey)) {
-                               $pkey->exportPublicKey($name.".pubkey");
-                       }
-
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EBUILD);
-               }
-       }
-}
-<?php
-
-namespace pharext\SourceDir;
-
-use pharext\Cli\Args;
-use pharext\License;
-use pharext\SourceDir;
-
-use FilesystemIterator;
-use IteratorAggregate;
-use RecursiveCallbackFilterIterator;
-use RecursiveDirectoryIterator;
-use RecursiveIteratorIterator;
-
-
-class Basic implements IteratorAggregate, SourceDir
-{
-       use License;
-       
-       private $path;
-       
-       public function __construct($path) {
-               $this->path = $path;
-       }
-       
-       public function getBaseDir() {
-               return $this->path;
-       }
-       
-       public function getPackageInfo() {
-               return [];
-       }
-       
-       public function getLicense() {
-               if (($file = $this->findLicense($this->getBaseDir()))) {
-                       return $this->readLicense($file);
-               }
-               return "UNKNOWN";
-       }
-
-       public function getArgs() {
-               return [];
-       }
-       
-       public function setArgs(Args $args) {
-       }
-
-       public function filter($current, $key, $iterator) {
-               $sub = $current->getSubPath();
-               if ($sub === ".git" || $sub === ".hg" || $sub === ".svn") {
-                       return false;
-               }
-               return true;
-       }
-       
-       public function getIterator() {
-               $rdi = new RecursiveDirectoryIterator($this->path,
-                               FilesystemIterator::CURRENT_AS_SELF | // needed for 5.5
-                               FilesystemIterator::KEY_AS_PATHNAME |
-                               FilesystemIterator::SKIP_DOTS);
-               $rci = new RecursiveCallbackFilterIterator($rdi, [$this, "filter"]);
-               $rii = new RecursiveIteratorIterator($rci);
-               foreach ($rii as $path => $child) {
-                       if (!$child->isDir()) {
-                               yield realpath($path);
-                       }
-               }
-       }
-}
-<?php
-
-namespace pharext\SourceDir;
-
-use pharext\Cli\Args;
-use pharext\License;
-use pharext\SourceDir;
-
-/**
- * Extension source directory which is a git repo
- */
-class Git implements \IteratorAggregate, SourceDir
-{
-       use License;
-       
-       /**
-        * Base directory
-        * @var string
-        */
-       private $path;
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::__construct()
-        */
-       public function __construct($path) {
-               $this->path = $path;
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::getBaseDir()
-        */
-       public function getBaseDir() {
-               return $this->path;
-       }
-
-       /**
-        * @inheritdoc
-        * @return array
-        */
-       public function getPackageInfo() {
-               return [];
-       }
-
-       /**
-        * @inheritdoc
-        * @return string
-        */
-       public function getLicense() {
-               if (($file = $this->findLicense($this->getBaseDir()))) {
-                       return $this->readLicense($file);
-               }
-               return "UNKNOWN";
-       }
-
-       /**
-        * @inheritdoc
-        * @return array
-        */
-       public function getArgs() {
-               return [];
-       }
-
-       /**
-        * @inheritdoc
-        */
-       public function setArgs(Args $args) {
-       }
-
-       /**
-        * Generate a list of files by `git ls-files`
-        * @return Generator
-        */
-       private function generateFiles() {
-               $pwd = getcwd();
-               chdir($this->path);
-               if (($pipe = popen("git ls-tree -r --name-only HEAD", "r"))) {
-                       $path = realpath($this->path);
-                       while (!feof($pipe)) {
-                               if (strlen($file = trim(fgets($pipe)))) {
-                                       /* there may be symlinks, so no realpath here */
-                                       yield "$path/$file";
-                               }
-                       }
-                       pclose($pipe);
-               }
-               chdir($pwd);
-       }
-
-       /**
-        * Implements IteratorAggregate
-        * @see IteratorAggregate::getIterator()
-        */
-       public function getIterator() {
-               return $this->generateFiles();
-       }
-}
-<?php
-
-namespace pharext\SourceDir;
-
-use pharext\Cli\Args;
-use pharext\Exception;
-use pharext\SourceDir;
-use pharext\License;
-
-/**
- * A PECL extension source directory containing a v2 package.xml
- */
-class Pecl implements \IteratorAggregate, SourceDir
-{
-       use License;
-       
-       /**
-        * The package.xml
-        * @var SimpleXmlElement
-        */
-       private $sxe;
-       
-       /**
-        * The base directory
-        * @var string
-        */
-       private $path;
-
-       /**
-        * The package.xml
-        * @var string
-        */
-       private $file;
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::__construct()
-        */
-       public function __construct($path) {
-               if (is_file("$path/package2.xml")) {
-                       $sxe = simplexml_load_file($this->file = "$path/package2.xml");
-               } elseif (is_file("$path/package.xml")) {
-                       $sxe = simplexml_load_file($this->file = "$path/package.xml");
-               } else {
-                       throw new Exception("Missing package.xml in $path");
-               }
-               
-               $sxe->registerXPathNamespace("pecl", $sxe->getDocNamespaces()[""]);
-               
-               $this->sxe = $sxe;
-               $this->path = realpath($path);
-       }
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::getBaseDir()
-        */
-       public function getBaseDir() {
-               return $this->path;
-       }
-
-       /**
-        * Retrieve gathered package info
-        * @return Generator
-        */
-       public function getPackageInfo() {
-               if (($name = $this->sxe->xpath("/pecl:package/pecl:name"))) {
-                       yield "name" => (string) $name[0];
-               }
-               if (($release = $this->sxe->xpath("/pecl:package/pecl:version/pecl:release"))) {
-                       yield "release" => (string) $release[0];
-               }
-               if ($this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease")) {
-                       yield "zend" => true;
-               }
-       }
-
-       /**
-        * @inheritdoc
-        * @return string
-        */
-       public function getLicense() {
-               if (($license = $this->sxe->xpath("/pecl:package/pecl:license"))) {
-                       if (($file = $this->findLicense($this->getBaseDir(), $license[0]["filesource"]))) {
-                               return $this->readLicense($file);
-                       }
-               }
-               if (($file = $this->findLicense($this->getBaseDir()))) {
-                       return $this->readLicense($file);
-               }
-               if ($license) {
-                       return $license[0] ." ". $license[0]["uri"];
-               }
-               return "UNKNOWN";
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::getArgs()
-        */
-       public function getArgs() {
-               $configure = $this->sxe->xpath("/pecl:package/pecl:extsrcrelease/pecl:configureoption");
-               foreach ($configure as $cfg) {
-                       yield [null, $cfg["name"], ucfirst($cfg["prompt"]), Args::OPTARG,
-                               strlen($cfg["default"]) ? $cfg["default"] : null];
-               }
-               $configure = $this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease/pecl:configureoption");
-               foreach ($configure as $cfg) {
-                       yield [null, $cfg["name"], ucfirst($cfg["prompt"]), Args::OPTARG,
-                               strlen($cfg["default"]) ? $cfg["default"] : null];
-               }
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::setArgs()
-        */
-       public function setArgs(Args $args) {
-               $configure = $this->sxe->xpath("/pecl:package/pecl:extsrcrelease/pecl:configureoption");
-               foreach ($configure as $cfg) {
-                       if (isset($args[$cfg["name"]])) {
-                               $args->configure = "--{$cfg["name"]}={$args[$cfg["name"]]}";
-                       }
-               }
-               $configure = $this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease/pecl:configureoption");
-               foreach ($configure as $cfg) {
-                       if (isset($args[$cfg["name"]])) {
-                               $args->configure = "--{$cfg["name"]}={$args[$cfg["name"]]}";
-                       }
-               }
-       }
-       
-       /**
-        * Compute the path of a file by parent dir nodes
-        * @param \SimpleXMLElement $ele
-        * @return string
-        */
-       private function dirOf($ele) {
-               $path = "";
-               while (($ele = current($ele->xpath(".."))) && $ele->getName() == "dir") {
-                       $path = trim($ele["name"], "/") ."/". $path ;
-               }
-               return trim($path, "/");
-       }
-
-       /**
-        * Generate a list of files from the package.xml
-        * @return Generator
-        */
-       private function generateFiles() {
-               /* hook  */
-               $temp = tmpfile();
-               fprintf($temp, "<?php\nreturn new %s(__DIR__);\n", get_class($this));
-               rewind($temp);
-               yield "pharext_package.php" => $temp;
-
-               /* deps */
-               $dependencies = $this->sxe->xpath("/pecl:package/pecl:dependencies/pecl:required/pecl:package");
-               foreach ($dependencies as $key => $dep) {
-                       if (($glob = glob("{$this->path}/{$dep->name}-*.ext.phar*"))) {
-                               usort($glob, function($a, $b) {
-                                       return version_compare(
-                                               substr($a, strpos(".ext.phar", $a)),
-                                               substr($b, strpos(".ext.phar", $b))
-                                       );
-                               });
-                               yield end($glob);
-                       }
-               }
-
-               /* files */
-               yield realpath($this->file);
-               foreach ($this->sxe->xpath("//pecl:file") as $file) {
-                       yield realpath($this->path ."/". $this->dirOf($file) ."/". $file["name"]);
-               }
-       }
-       
-       /**
-        * Implements IteratorAggregate
-        * @see IteratorAggregate::getIterator()
-        */
-       public function getIterator() {
-               return $this->generateFiles();
-       }
-}
-<?php
-
-namespace pharext;
-
-/**
- * Source directory interface, which should yield file names to package on traversal
- */
-interface SourceDir extends \Traversable
-{
-       /**
-        * Retrieve the base directory
-        * @return string
-        */
-       public function getBaseDir();
-
-       /**
-        * Retrieve gathered package info
-        * @return array|Traversable
-        */
-       public function getPackageInfo();
-
-       /**
-        * Retrieve the full text license
-        * @return string
-        */
-       public function getLicense();
-
-       /**
-        * Provide installer command line args
-        * @return array|Traversable
-        */
-       public function getArgs();
-
-       /**
-        * Process installer command line args
-        * @param \pharext\Cli\Args $args
-        */
-       public function setArgs(Cli\Args $args);
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\ExecCmd;
-use pharext\Task;
-use pharext\Tempfile;
-
-/**
- * PHP INI activation
- */
-class Activate implements Task
-{
-       /**
-        * @var string
-        */
-       private $cwd;
-
-       /**
-        * @var array
-        */
-       private $inis;
-
-       /**
-        * @var string
-        */
-       private $type;
-
-       /**
-        * @var string
-        */
-       private $php_config;
-       
-       /**
-        * @var string
-        */
-       private $sudo;
-
-       /**
-        * @param string $cwd working directory
-        * @param array $inis custom INI or list of loaded/scanned INI files
-        * @param string $type extension or zend_extension
-        * @param string $prefix install prefix, e.g. /usr/local
-        * @param string $common_name PHP programs common name, e.g. php5
-        * @param string $sudo sudo command
-        * @throws \pharext\Exception
-        */
-       public function __construct($cwd, array $inis, $type = "extension", $prefix = null, $common_name = "php", $sudo = null) {
-               $this->cwd = $cwd;
-               $this->type = $type;
-               $this->sudo = $sudo;
-               if (!$this->inis = $inis) {
-                       throw new Exception("No PHP INIs given");
-               }
-               $cmd = $common_name . "-config";
-               if (isset($prefix)) {
-                       $cmd = $prefix . "/bin/" . $cmd;
-               }
-               $this->php_config = $cmd;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return boolean false, if extension was already activated
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Running INI activation ...\n");
-               }
-               $extension = basename(current(glob("{$this->cwd}/modules/*.so")));
-
-               if ($this->type === "zend_extension") {
-                       $pattern = preg_quote((new ExecCmd($this->php_config))->run(["--extension-dir"])->getOutput() . "/$extension", "/");
-               } else {
-                       $pattern = preg_quote($extension, "/");
-               }
-
-               foreach ($this->inis as $file) {
-                       if ($verbose) {
-                               printf("Checking %s ...\n", $file);
-                       }
-                       if (!file_exists($file)) {
-                               throw new Exception(sprintf("INI file '%s' does not exist", $file));
-                       }
-                       $temp = new Tempfile("phpini");
-                       foreach (file($file) as $line) {
-                               if (preg_match("/^\s*{$this->type}\s*=\s*[\"']?{$pattern}[\"']?\s*(;.*)?\$/", $line)) {
-                                       return false;
-                               }
-                               fwrite($temp->getStream(), $line);
-                       }
-               }
-
-               /* not found; append to last processed file, which is the main by default */
-               if ($verbose) {
-                       printf("Activating in %s ...\n", $file);
-               }
-               fprintf($temp->getStream(), $this->type . "=%s\n", $extension);
-               $temp->closeStream();
-
-               $path = $temp->getPathname();
-               $stat = stat($file);
-
-               // owner transfer
-               $ugid = sprintf("%d:%d", $stat["uid"], $stat["gid"]);
-               $cmd = new ExecCmd("chown", $verbose);
-               if (isset($this->sudo)) {
-                       $cmd->setSu($this->sudo);
-               }
-               $cmd->run([$ugid, $path]);
-
-               // permission transfer
-               $perm = decoct($stat["mode"] & 0777);
-               $cmd = new ExecCmd("chmod", $verbose);
-               if (isset($this->sudo)) {
-                       $cmd->setSu($this->sudo);
-               }
-               $cmd->run([$perm, $path]);
-
-               // rename
-               $cmd = new ExecCmd("mv", $verbose);
-               if (isset($this->sudo)) {
-                       $cmd->setSu($this->sudo);
-               }
-               $cmd->run([$path, $file]);
-               
-               if ($verbose) {
-                       printf("Replaced %s ...\n", $file);
-               }
-
-               return true;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Task;
-
-/**
- * Ask password on console
- */
-class Askpass implements Task
-{
-       /**
-        * @var string
-        */
-       private $prompt;
-
-       /**
-        * @param string $prompt
-        */
-       public function __construct($prompt = "Password:") {
-               $this->prompt = $prompt;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return string
-        */
-       public function run($verbose = false) {
-               system("stty -echo");
-               printf("%s ", $this->prompt);
-               $pass = fgets(STDIN, 1024);
-               printf("\n");
-               system("stty echo");
-               if (substr($pass, -1) == "\n") {
-                       $pass = substr($pass, 0, -1);
-               }
-               return $pass;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Task;
-
-use RecursiveDirectoryIterator;
-use RecursiveIteratorIterator;
-
-/**
- * List all library files of pharext to bundle with a phar
- */
-class BundleGenerator implements Task
-{
-       /**
-        * @param bool $verbose
-        * @return Generator
-        */
-       public function run($verbose = false) {
-               if ($verbose) {
-                       printf("Packaging pharext ... \n");
-               }
-               $rdi = new RecursiveDirectoryIterator(dirname(dirname(__DIR__)));
-               $rii = new RecursiveIteratorIterator($rdi);
-               for ($rii->rewind(); $rii->valid(); $rii->next()) {
-                       if (!$rii->isDot()) {
-                               yield $rii->getSubPathname() => $rii->key();
-                       }
-               }
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Task;
-
-use FilesystemIterator;
-use RecursiveDirectoryIterator;
-use RecursiveIteratorIterator;
-
-/**
- * Recursively cleanup FS entries
- */
-class Cleanup implements Task
-{
-       /**
-        * @var string
-        */
-       private $rm;
-
-       public function __construct($rm) {
-               $this->rm = $rm;
-       }
-
-       /**
-        * @param bool $verbose
-        */
-       public function run($verbose = false) {
-               if ($verbose) {
-                       printf("Cleaning up %s ...\n", $this->rm);
-               }
-               if ($this->rm instanceof Tempfile) {
-                       unset($this->rm);
-               } elseif (is_dir($this->rm)) {
-                       $rdi = new RecursiveDirectoryIterator($this->rm,
-                               FilesystemIterator::CURRENT_AS_SELF | // needed for 5.5
-                               FilesystemIterator::KEY_AS_PATHNAME |
-                               FilesystemIterator::SKIP_DOTS);
-                       $rii = new RecursiveIteratorIterator($rdi,
-                               RecursiveIteratorIterator::CHILD_FIRST);
-                       foreach ($rii as $path => $child) {
-                               if ($child->isDir()) {
-                                       @rmdir($path);
-                               } else {
-                                       @unlink($path);
-                               }
-                       }
-                       @rmdir($this->rm);
-               } elseif (file_exists($this->rm)) {
-                       @unlink($this->rm);
-               }
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\ExecCmd;
-use pharext\Task;
-
-/**
- * Runs extension's configure
- */
-class Configure implements Task
-{
-       /**
-        * @var array
-        */
-       private $args;
-
-       /**
-        * @var string
-        */
-       private $cwd;
-
-       /**
-        * @param string $cwd working directory
-        * @param array $args configure args
-        * @param string $prefix install prefix, e.g. /usr/local
-        * @param string $common_name PHP programs common name, e.g. php5
-        */
-       public function __construct($cwd, array $args = null, $prefix = null, $common_name = "php") {
-               $this->cwd = $cwd;
-               $cmd = $common_name . "-config";
-               if (isset($prefix)) {
-                       $cmd = $prefix . "/bin/" . $cmd;
-               }
-               $this->args =  ["--with-php-config=$cmd"];
-               if ($args) {
-                       $this->args = array_merge($this->args, $args);
-               }
-       }
-
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Running ./configure ...\n");
-               }
-               $pwd = getcwd();
-               if (!chdir($this->cwd)) {
-                       throw new Exception;
-               }
-               try {
-                       $cmd = new ExecCmd("./configure", $verbose);
-                       $cmd->run($this->args);
-               } finally {
-                       chdir($pwd);
-               }
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Archive;
-use pharext\Task;
-use pharext\Tempdir;
-
-use Phar;
-use PharData;
-
-/**
- * Extract a package archive
- */
-class Extract implements Task
-{
-       /**
-        * @var Phar(Data)
-        */
-       private $source;
-
-       /**
-        * @param mixed $source archive location
-        */
-       public function __construct($source) {
-               if ($source instanceof Phar || $source instanceof PharData || $source instanceof Archive) {
-                       $this->source = $source;
-               } else {
-                       $this->source = new PharData($source);
-               }
-       }
-
-       /**
-        * @param bool $verbose
-        * @return \pharext\Tempdir
-        */
-       public function run($verbose = false) {
-               if ($verbose) {
-                       printf("Extracting %s ...\n", basename($this->source->getPath()));
-               }
-               if ($this->source instanceof Archive) {
-                       return $this->source->extract();
-               }
-               $dest = new Tempdir("extract");
-               $this->source->extractTo($dest);
-               return $dest;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\ExecCmd;
-use pharext\Task;
-use pharext\Tempdir;
-
-/**
- * Clone a git repo
- */
-class GitClone implements Task
-{
-       /**
-        * @var string
-        */
-       private $source;
-       
-       /**
-        * @var string
-        */
-       private $branch;
-
-       /**
-        * @param string $source git repo location
-        */
-       public function __construct($source, $branch = null) {
-               $this->source = $source;
-               $this->branch = $branch;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return \pharext\Tempdir
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Fetching %s ...\n", $this->source);
-               }
-               $local = new Tempdir("gitclone");
-               $cmd = new ExecCmd("git", $verbose);
-               if (strlen($this->branch)) {
-                       $cmd->run(["clone", "--depth", 1, "--branch", $this->branch, $this->source, $local]);
-               } else {
-                       $cmd->run(["clone", $this->source, $local]);
-               }
-               return $local;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\ExecCmd;
-use pharext\Exception;
-use pharext\Task;
-
-/**
- * Run make in the source dir
- */
-class Make implements Task
-{
-       /**
-        * @var string
-        */
-       private $cwd;
-
-       /**
-        * @var array
-        */
-       private $args;
-
-       /**
-        * @var string
-        */
-       private $sudo;
-
-       /**
-        *
-        * @param string $cwd working directory
-        * @param array $args make's arguments
-        * @param string $sudo sudo command
-        */
-       public function __construct($cwd, array $args = null, $sudo = null) {
-               $this->cwd = $cwd;
-               $this->sudo = $sudo;
-               $this->args = $args;
-       }
-
-       /**
-        *
-        * @param bool $verbose
-        * @throws \pharext\Exception
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Running make");
-                       if ($this->args) {
-                               foreach ($this->args as $arg) {
-                                       printf(" %s", $arg);
-                               }
-                       }
-                       printf(" ...\n");
-               }
-               $pwd = getcwd();
-               if (!chdir($this->cwd)) {
-                       throw new Exception;
-               }
-               try {
-                       $cmd = new ExecCmd("make", $verbose);
-                       if (isset($this->sudo)) {
-                               $cmd->setSu($this->sudo);
-                       }
-                       $args = $this->args;
-                       if (!$verbose) {
-                               $args = array_merge((array) $args, ["-s"]);
-                       }
-                       $cmd->run($args);
-               } finally {
-                       chdir($pwd);
-               }
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\Task;
-use pharext\Tempfile;
-
-class PaxFixup implements Task
-{
-       private $source;
-
-       public function __construct($source) {
-               $this->source = $source;
-       }
-
-       private function openArchive($source) {
-               $hdr = file_get_contents($source, false, null, 0, 3);
-               if ($hdr === "\x1f\x8b\x08") {
-                       $fd = fopen("compress.zlib://$source", "r");
-               } elseif ($hdr === "BZh") {
-                       $fd = fopen("compress.bzip2://$source", "r");
-               } else {
-                       $fd = fopen($source, "r");
-               }
-               if (!is_resource($fd)) {
-                       throw new Exception;
-               }
-               return $fd;
-       }
-
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Fixing up a tarball with global pax header ...\n");
-               }
-               $temp = new Tempfile("paxfix");
-               stream_copy_to_stream($this->openArchive($this->source),
-                       $temp->getStream(), -1, 1024);
-               $temp->closeStream();
-               return (new Extract((string) $temp))->run($verbose);
-       }
-}<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\Task;
-
-/**
- * Fixup package.xml files in an extracted PECL dir
- */
-class PeclFixup implements Task
-{
-       /**
-        * @var string
-        */
-       private $source;
-
-       /**
-        * @param string $source source directory
-        */
-       public function __construct($source) {
-               $this->source = $source;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return string sanitized source location
-        * @throws \pahrext\Exception
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Sanitizing PECL dir ...\n");
-               }
-               $dirs = glob("{$this->source}/*", GLOB_ONLYDIR);
-               $files = array_diff(glob("{$this->source}/*"), $dirs);
-               $check = array_reduce($files, function($r, $v) {
-                       return $v && fnmatch("package*.xml", basename($v));
-               }, true);
-
-               if (count($dirs) !== 1 || !$check) {
-                       throw new Exception("Does not look like an extracted PECL dir: {$this->source}");
-               }
-
-               $dest = current($dirs);
-
-               foreach ($files as $file) {
-                       if ($verbose) {
-                               printf("Moving %s into %s ...\n", basename($file), basename($dest));
-                       }
-                       if (!rename($file, "$dest/" . basename($file))) {
-                               throw new Exception;
-                       }
-               }
-
-               return $dest;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\SourceDir;
-use pharext\Task;
-use pharext\Tempname;
-
-use Phar;
-
-/**
- * Build phar
- */
-class PharBuild implements Task
-{
-       /**
-        * @var \pharext\SourceDir
-        */
-       private $source;
-
-       /**
-        * @var string
-        */
-       private $stub;
-
-       /**
-        * @var array
-        */
-       private $meta;
-
-       /**
-        * @var bool
-        */
-       private $readonly;
-
-       /**
-        * @param SourceDir $source extension source directory
-        * @param string $stub path to phar stub
-        * @param array $meta phar meta data
-        * @param bool $readonly whether the stub has -dphar.readonly=1 set
-        */
-       public function __construct(SourceDir $source = null, $stub, array $meta = null, $readonly = true) {
-               $this->source = $source;
-               $this->stub = $stub;
-               $this->meta = $meta;
-               $this->readonly = $readonly;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return \pharext\Tempname
-        * @throws \pharext\Exception
-        */
-       public function run($verbose = false) {
-               /* Phar::compress() and ::convert*() use strtok("."), ugh!
-                * so, be sure to not use any other dots in the filename
-                * except for .phar
-                */
-               $temp = new Tempname("", "-pharext.phar");
-
-               $phar = new Phar($temp);
-               $phar->startBuffering();
-
-               if ($this->meta) {
-                       $phar->setMetadata($this->meta);
-               }
-               if ($this->stub) {
-                       (new PharStub($phar, $this->stub))->run($verbose);
-               }
-
-               $phar->buildFromIterator((new Task\BundleGenerator)->run());
-
-               if ($this->source) {
-                       if ($verbose) {
-                               $bdir = $this->source->getBaseDir();
-                               $blen = strlen($bdir);
-                               foreach ($this->source as $index => $file) {
-                                       if (is_resource($file)) {
-                                               printf("Packaging %s ...\n", $index);
-                                               $phar[$index] = $file;
-                                       } else {
-                                               printf("Packaging %s ...\n", $index = trim(substr($file, $blen), "/"));
-                                               $phar->addFile($file, $index);
-                                       }
-                               }
-                       } else {
-                               $phar->buildFromIterator($this->source, $this->source->getBaseDir());
-                       }
-               }
-
-               $phar->stopBuffering();
-               
-               if (!chmod($temp, fileperms($temp) | 0111)) {
-                       throw new Exception;
-               }
-               
-               return $temp;
-       }
-}<?php
-
-namespace pharext\Task;
-
-use pharext\Task;
-
-use Phar;
-
-/**
- * Clone a compressed copy of a phar
- */
-class PharCompress implements Task
-{
-       /**
-        * @var string
-        */
-       private $file;
-
-       /**
-        * @var Phar
-        */
-       private $package;
-
-       /**
-        * @var int
-        */
-       private $encoding;
-
-       /**
-        * @var string
-        */
-       private $extension;
-
-       /**
-        * @param string $file path to the original phar
-        * @param int $encoding Phar::GZ or Phar::BZ2
-        */
-       public function __construct($file, $encoding) {
-               $this->file = $file;
-               $this->package = new Phar($file);
-               $this->encoding = $encoding;
-
-               switch ($encoding) {
-                       case Phar::GZ:
-                               $this->extension = ".gz";
-                               break;
-                       case Phar::BZ2:
-                               $this->extension = ".bz2";
-                               break;
-               }
-       }
-
-       /**
-        * @param bool $verbose
-        * @return string
-        */
-       public function run($verbose = false) {
-               if ($verbose) {
-                       printf("Compressing %s ...\n", basename($this->package->getPath()));
-               }
-               /* stop shebang */
-               $stub = $this->package->getStub();
-               $phar = $this->package->compress($this->encoding);
-               $phar->setStub(substr($stub, strpos($stub, "\n")+1));
-               return $this->file . $this->extension;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\Task;
-
-/**
- * Rename the phar archive
- */
-class PharRename implements Task
-{
-       /**
-        * @var string
-        */
-       private $phar;
-
-       /**
-        * @var string
-        */
-       private $dest;
-
-       /**
-        * @var string
-        */
-       private $name;
-
-       /**
-        * @param string $phar path to phar
-        * @param string $dest destination dir
-        * @param string $name package name
-        */
-       public function __construct($phar, $dest, $name) {
-               $this->phar = $phar;
-               $this->dest = $dest;
-               $this->name = $name;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return string path to renamed phar
-        * @throws \pharext\Exception
-        */
-       public function run($verbose = false) {
-               $extension = substr(strstr($this->phar, "-pharext.phar"), 8);
-               $name = sprintf("%s/%s.ext%s", $this->dest, $this->name, $extension);
-               
-               if ($verbose) {
-                       printf("Renaming %s to %s ...\n", basename($this->phar), basename($name));
-               }
-
-               if (!rename($this->phar, $name)) {
-                       throw new Exception;
-               }
-
-               return $name;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Openssl;
-use pharext\Task;
-
-use Phar;
-
-/**
- * Sign the phar with a private key
- */
-class PharSign implements Task
-{
-       /**
-        * @var Phar
-        */
-       private $phar;
-
-       /**
-        * @var \pharext\Openssl\PrivateKey
-        */
-       private $pkey;
-
-       /**
-        *
-        * @param mixed $phar phar instance or path to phar
-        * @param string $pkey path to private key
-        * @param string $pass password for the private key
-        */
-       public function __construct($phar, $pkey, $pass) {
-               if ($phar instanceof Phar || $phar instanceof PharData) {
-                       $this->phar = $phar;
-               } else {
-                       $this->phar = new Phar($phar);
-               }
-               $this->pkey = new Openssl\PrivateKey($pkey, $pass);
-       }
-
-       /**
-        * @param bool $verbose
-        * @return \pharext\Openssl\PrivateKey
-        */
-       public function run($verbose = false) {
-               if ($verbose) {
-                       printf("Signing %s ...\n", basename($this->phar->getPath()));
-               }
-               $this->pkey->sign($this->phar);
-               return $this->pkey;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use Phar;
-use pharext\Exception;
-use pharext\Task;
-
-/**
- * Set the phar's stub
- */
-class PharStub implements Task
-{
-       /**
-        * @var \Phar
-        */
-       private $phar;
-
-       /**
-        * @var string
-        */
-       private $stub;
-
-       /**
-        * @param \Phar $phar
-        * @param string $stub file path to the stub
-        * @throws \pharext\Exception
-        */
-       function __construct(Phar $phar, $stub) {
-               $this->phar = $phar;
-               if (!file_exists($this->stub = $stub)) {
-                       throw new Exception("File '$stub' does not exist");
-               }
-       }
-
-       /**
-        * @param bool $verbose
-        */
-       function run($verbose = false) {
-               if ($verbose) {
-                       printf("Using stub '%s'...\n", basename($this->stub));
-               }
-               $stub = preg_replace_callback('/^#include <([^>]+)>/m', function($includes) {
-                       return file_get_contents($includes[1], true, null, 5);
-               }, file_get_contents($this->stub));
-               if ($this->phar->isCompressed() && substr($stub, 0, 2) === "#!") {
-                       $stub = substr($stub, strpos($stub, "\n")+1);
-               }
-               $this->phar->setStub($stub);
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\ExecCmd;
-use pharext\Task;
-
-/**
- * Run phpize in the extension source directory
- */
-class Phpize implements Task
-{
-       /**
-        * @var string
-        */
-       private $phpize;
-
-       /**
-        *
-        * @var string
-        */
-       private $cwd;
-
-       /**
-        * @param string $cwd working directory
-        * @param string $prefix install prefix, e.g. /usr/local
-        * @param string $common_name PHP program common name, e.g. php5
-        */
-       public function __construct($cwd, $prefix = null,  $common_name = "php") {
-               $this->cwd = $cwd;
-               $cmd = $common_name . "ize";
-               if (isset($prefix)) {
-                       $cmd = $prefix . "/bin/" . $cmd;
-               }
-               $this->phpize = $cmd;
-       }
-
-       /**
-        * @param bool $verbose
-        * @throws \pharext\Exception
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Running %s ...\n", $this->phpize);
-               }
-               $pwd = getcwd();
-               if (!chdir($this->cwd)) {
-                       throw new Exception;
-               }
-               try {
-                       $cmd = new ExecCmd($this->phpize, $verbose);
-                       $cmd->run();
-               } finally {
-                       chdir($pwd);
-               }
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\Task;
-use pharext\Tempfile;
-
-/**
- * Fetch a remote archive
- */
-class StreamFetch implements Task
-{
-       /**
-        * @var string
-        */
-       private $source;
-
-       /**
-        * @var callable
-        */
-       private $progress;
-
-       /**
-        * @param string $source remote file location
-        * @param callable $progress progress callback
-        */
-       public function __construct($source, callable $progress) {
-               $this->source = $source;
-               $this->progress = $progress;
-       }
-
-       private function createStreamContext() {
-               $progress = $this->progress;
-
-               /* avoid bytes_max bug of older PHP versions */
-               $maxbytes = 0;
-               return stream_context_create([],["notification" => function($notification, $severity, $message, $code, $bytes_cur, $bytes_max) use($progress, &$maxbytes) {
-                       if ($bytes_max > $maxbytes) {
-                               $maxbytes = $bytes_max;
-                       }
-                       switch ($notification) {
-                               case STREAM_NOTIFY_CONNECT:
-                                       $progress(0);
-                                       break;
-                               case STREAM_NOTIFY_PROGRESS:
-                                       $progress($maxbytes > 0 ? $bytes_cur/$maxbytes : .5);
-                                       break;
-                               case STREAM_NOTIFY_COMPLETED:
-                                       /* this is sometimes not generated, why? */
-                                       $progress(1);
-                                       break;
-                       }
-               }]);
-       }
-
-       /**
-        * @param bool $verbose
-        * @return \pharext\Task\Tempfile
-        * @throws \pharext\Exception
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Fetching %s ...\n", $this->source);
-               }
-               $context = $this->createStreamContext();
-
-               if (!$remote = fopen($this->source, "r", false, $context)) {
-                       throw new Exception;
-               }
-               
-               $local = new Tempfile("remote");
-               if (!stream_copy_to_stream($remote, $local->getStream())) {
-                       throw new Exception;
-               }
-               $local->closeStream();
-
-               /* STREAM_NOTIFY_COMPLETED is not generated, see above */
-               call_user_func($this->progress, 1);
-
-               return $local;
-       }
-}
-<?php
-
-namespace pharext;
-
-/**
- * Simple task interface
- */
-interface Task
-{
-       public function run($verbose = false);
-}
-<?php
-
-namespace pharext;
-
-/**
- * Create a temporary directory
- */
-class Tempdir extends \SplFileInfo
-{
-       /**
-        * @param string $prefix prefix to uniqid()
-        * @throws \pharext\Exception
-        */
-       public function __construct($prefix) {
-               $temp = new Tempname($prefix);
-               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
-                       throw new Exception("Could not create tempdir: ".error_get_last()["message"]);
-               }
-               parent::__construct($temp);
-       }
-}
-<?php 
-
-namespace pharext;
-
-/**
- * Create a new temporary file
- */
-class Tempfile extends \SplFileInfo
-{
-       /**
-        * @var resource
-        */
-       private $handle;
-
-       /**
-        * @param string $prefix uniqid() prefix
-        * @param string $suffix e.g. file extension
-        * @throws \pharext\Exception
-        */
-       public function __construct($prefix, $suffix = ".tmp") {
-               $tries = 0;
-               $omask = umask(077);
-               do {
-                       $path = new Tempname($prefix, $suffix);
-                       $this->handle = fopen($path, "x");
-               } while (!is_resource($this->handle) && $tries++ < 10);
-               umask($omask);
-               
-               if (!is_resource($this->handle)) {
-                       throw new Exception("Could not create temporary file");
-               }
-               
-               parent::__construct($path);
-       }
-
-       /**
-        * Unlink the file
-        */
-       public function __destruct() {
-               if (is_file($this->getPathname())) {
-                       @unlink($this->getPathname());
-               }
-       }
-
-       /**
-        * Close the stream
-        */
-       public function closeStream() {
-               fclose($this->handle);
-       }
-
-       /**
-        * Retrieve the stream resource
-        * @return resource
-        */
-       public function getStream() {
-               return $this->handle;
-       }
-}
-<?php
-
-namespace pharext;
-
-use pharext\Exception;
-
-/**
- * A temporary file/directory name
- */
-class Tempname
-{
-       /**
-        * @var string
-        */
-       private $name;
-
-       /**
-        * @param string $prefix uniqid() prefix
-        * @param string $suffix e.g. file extension
-        */
-       public function __construct($prefix, $suffix = null) {
-               $temp = sys_get_temp_dir() . "/pharext-" . $this->getUser();
-               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
-                       throw new Exception;
-               }
-               $this->name = $temp ."/". uniqid($prefix) . $suffix;
-       }
-
-       private function getUser() {
-               if (extension_loaded("posix") && function_exists("posix_getpwuid")) {
-                       return posix_getpwuid(posix_getuid())["name"];
-               }
-               return trim(`whoami 2>/dev/null`)
-                       ?: trim(`id -nu 2>/dev/null`)
-                       ?: getenv("USER")
-                       ?: get_current_user();
-       }
-
-       /**
-        * @return string
-        */
-       public function __toString() {
-               return (string) $this->name;
-       }
-}
-<?php
-
-namespace pharext;
-
-use Phar;
-use PharFileInfo;
-use SplFileInfo;
-use pharext\Exception;
-
-class Updater implements Command
-{
-       use Cli\Command;
-
-       /**
-        * Create the command
-        */
-       public function __construct() {
-               $this->args = new Cli\Args([
-                       ["h", "help", "Display this help",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       ["v", "verbose", "More output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["q", "quiet", "Less output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       [null, "signature", "Show pharext signature",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "license", "Show pharext license",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "version", "Show pharext version",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [0, "path", "Path to .ext.phar to update",
-                               Cli\Args::REQUIRED|Cli\Args::MULTI],
-               ]);
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::run()
-        */
-       public function run($argc, array $argv) {
-               $errs = [];
-               $prog = array_shift($argv);
-               foreach ($this->args->parse(--$argc, $argv) as $error) {
-                       $errs[] = $error;
-               }
-
-               if ($this->args["help"]) {
-                       $this->header();
-                       $this->help($prog);
-                       exit;
-               }
-
-               try {
-                       foreach (["signature", "license", "version"] as $opt) {
-                               if ($this->args[$opt]) {
-                                       printf("%s\n", $this->metadata($opt));
-                                       exit;
-                               }
-                       }
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EARGS);
-               }
-
-
-               foreach ($this->args->validate() as $error) {
-                       $errs[] = $error;
-               }
-
-               if ($errs) {
-                       if (!$this->args["quiet"]) {
-                               $this->header();
-                       }
-                       foreach ($errs as $err) {
-                               $this->error("%s\n", $err);
-                       }
-                       printf("\n");
-                       if (!$this->args["quiet"]) {
-                               $this->help($prog);
-                       }
-                       exit(self::EARGS);
-               }
-
-               foreach ($this->args[0] as $file) {
-                       $info = new SplFileInfo($file);
-
-                       while ($info->isLink()) {
-                               $info = new SplFileInfo($info->getLinkTarget());
-                       }
-                       
-                       if ($info->isFile()) {
-                               if (!$this->updatePackage($info)) {
-                                       $this->warn("Cannot upgrade pre-v3 packages\n");
-                               }
-                       } else {
-                               $this->error("File '%s' does not exist\n", $file);
-                               exit(self::EARGS);
-                       }
-               }
-       }
-
-       /**
-        * Replace the pharext core in an .ext.phar package
-        * @param string $temp path to temp phar
-        * @return boolean FALSE if the package is too old (pre-v3) to upgrade
-        */
-       private function replacePharext($temp) {
-               $phar = new Phar($temp, Phar::CURRENT_AS_SELF);
-               $phar->startBuffering();
-
-               if (!$meta = $phar->getMetadata()) {
-                       // don't upgrade pre-v3 packages
-                       return false;
-               }
-
-               // replace current pharext files
-               $core = (new Task\BundleGenerator)->run($this->verbosity());
-               $phar->buildFromIterator($core);
-               $stub = __DIR__."/../pharext_installer.php";
-               (new Task\PharStub($phar, $stub))->run($this->verbosity());
-
-               // check dependencies
-               foreach ($phar as $info) {
-                       if (fnmatch("*.ext.phar*", $info->getBasename())) {
-                               $this->updatePackage($info, $phar);
-                       }
-               }
-               
-               $phar->stopBuffering();
-
-               $phar->setMetadata([
-                       "version" => Metadata::version(),
-                       "header" => Metadata::header(),
-               ] + $meta);
-
-               $this->info("Updated pharext version from '%s' to '%s'\n",
-                       isset($meta["version"]) ? $meta["version"] : "(unknown)",
-                       $phar->getMetadata()["version"]);
-
-               return true;
-       }
-
-       /**
-        * Update an .ext.phar package to the current pharext version
-        * @param SplFileInfo $file
-        * @param Phar $phar the parent phar containing $file as dependency
-        * @return boolean FALSE if the package is too old (pre-v3) to upgrade
-        * @throws Exception
-        */
-       private function updatePackage(SplFileInfo $file, Phar $phar = null) {
-               $this->info("Updating pharext core in '%s'...\n", basename($file));
-
-               $temp = new Tempname("update", substr(strstr($file, ".ext.phar"), 4));
-
-               if (!copy($file->getPathname(), $temp)) {
-                       throw new Exception;
-               }
-               if (!chmod($temp, $file->getPerms())) {
-                       throw new Exception;
-               }
-               
-               if (!$this->replacePharext($temp)) {
-                       return false;
-               }
-
-               if ($phar) {
-                       $phar->addFile($temp, $file);
-               } elseif (!rename($temp, $file->getPathname())) {
-                       throw new Exception;
-               }
-
-               return true;
-       }
-}
-#!/usr/bin/env php
-<?php
-
-/**
- * The installer sub-stub for extension phars
- */
-
-namespace pharext;
-
-define("PHAREXT_PHAR", __FILE__);
-
-spl_autoload_register(function($c) {
-       return include strtr($c, "\\_", "//") . ".php";
-});
-
-#include <pharext/Exception.php>
-#include <pharext/Tempname.php>
-#include <pharext/Tempfile.php>
-#include <pharext/Tempdir.php>
-#include <pharext/Archive.php>
-
-namespace pharext;
-
-if (extension_loaded("Phar")) {
-       \Phar::interceptFileFuncs();
-       \Phar::mapPhar();
-       $phardir = "phar://".__FILE__;
-} else {
-       $archive = new Archive(__FILE__);
-       $phardir = $archive->extract();
-}
-
-set_include_path("$phardir:". get_include_path());
-
-$installer = new Installer();
-$installer->run($argc, $argv);
-
-__HALT_COMPILER();
-#!/usr/bin/php -dphar.readonly=0
-<?php
-
-/**
- * The packager sub-stub for bin/pharext
- */
-
-namespace pharext;
-
-spl_autoload_register(function($c) {
-       return include strtr($c, "\\_", "//") . ".php";
-});
-
-set_include_path('phar://' . __FILE__ .":". get_include_path());
-
-if (!extension_loaded("Phar")) {
-       fprintf(STDERR, "ERROR: Phar extension not loaded\n\n");
-       fprintf(STDERR, "\tPlease load the phar extension in your php.ini\n".
-                                       "\tor rebuild PHP with the --enable-phar flag.\n\n");
-       exit(1);
-}
-
-if (ini_get("phar.readonly")) {
-       fprintf(STDERR, "ERROR: Phar is configured read-only\n\n");
-       fprintf(STDERR, "\tPlease specify phar.readonly=0 in your php.ini\n".
-                                       "\tor run this command with php -dphar.readonly=0\n\n");
-       exit(1);
-}
-
-\Phar::interceptFileFuncs();
-\Phar::mapPhar();
-
-$packager = new Packager();
-$packager->run($argc, $argv);
-
-__HALT_COMPILER();
-#!/usr/bin/php -dphar.readonly=0
-<?php
-
-/**
- * The installer updater stub for extension phars
- */
-
-namespace pharext;
-
-spl_autoload_register(function($c) {
-       return include strtr($c, "\\_", "//") . ".php";
-});
-
-set_include_path('phar://' . __FILE__ .":". get_include_path());
-
-if (!extension_loaded("Phar")) {
-       fprintf(STDERR, "ERROR: Phar extension not loaded\n\n");
-       fprintf(STDERR, "\tPlease load the phar extension in your php.ini\n".
-                                       "\tor rebuild PHP with the --enable-phar flag.\n\n");
-       exit(1);
-}
-
-if (ini_get("phar.readonly")) {
-       fprintf(STDERR, "ERROR: Phar is configured read-only\n\n");
-       fprintf(STDERR, "\tPlease specify phar.readonly=0 in your php.ini\n".
-                                       "\tor run this command with php -dphar.readonly=0\n\n");
-       exit(1);
-}
-
-\Phar::interceptFileFuncs();
-\Phar::mapPhar();
-
-$updater = new Updater();
-$updater->run($argc, $argv);
-
-__HALT_COMPILER();
-<?php
-return new pharext\SourceDir\Pecl(__DIR__);
-<?xml version="1.0" encoding="UTF-8"?>
-<package 
- packagerversion="1.4.11" 
- version="2.0" 
- xmlns="http://pear.php.net/dtd/package-2.0" 
- xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" 
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
- xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
-http://pear.php.net/dtd/tasks-1.0.xsd
-http://pear.php.net/dtd/package-2.0
-http://pear.php.net/dtd/package-2.0.xsd">
- <name>propro</name>
- <channel>pecl.php.net</channel>
- <summary>Property proxy</summary>
- <description>A reusable split-off of pecl_http's property proxy API.</description>
- <lead>
-  <name>Michael Wallner</name>
-  <user>mike</user>
-  <email>mike@php.net</email>
-  <active>yes</active>
- </lead>
- <date>2013-12-05</date>
- <version>
-  <release>2.0.0-dev</release>
-  <api>2.0.0</api>
- </version>
- <stability>
-  <release>stable</release>
-  <api>stable</api>
- </stability>
- <license>BSD, revised</license>
- <notes><![CDATA[
-]]></notes>
- <contents>
-  <dir name="/">
-   <file role="doc" name="CREDITS" />
-   <file role="doc" name="LICENSE" />
-   <file role="doc" name="Doxyfile" />
-   <file role="src" name="config.m4" />
-   <file role="src" name="config.w32" />
-   <file role="src" name="php_propro.h" />
-   <file role="src" name="php_propro_api.h" />
-   <file role="src" name="php_propro.c" />
-   <dir name="tests">
-    <file role="test" name="001.phpt" />
-    <file role="test" name="002.phpt" />
-    <file role="test" name="003.phpt" />
-   </dir>
-  </dir>
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>7.0.0</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.0</min>
-   </pearinstaller>
-  </required>
- </dependencies>
- <providesextension>propro</providesextension>
- <extsrcrelease/>
-</package>
-
-proproCopyright (c) 2013, Michael Wallner <mike@php.net>.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without 
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice, 
-      this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright 
-      notice, this list of conditions and the following disclaimer in the 
-      documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Doxyfile 1.8.5
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-DOXYFILE_ENCODING      = UTF-8
-PROJECT_NAME           = "Property proxy API"
-PROJECT_NUMBER         =
-PROJECT_BRIEF          = "A facility to manage extension object properties tied to C-struct members"
-PROJECT_LOGO           = 
-OUTPUT_DIRECTORY       = 
-CREATE_SUBDIRS         = NO
-OUTPUT_LANGUAGE        = English
-BRIEF_MEMBER_DESC      = YES
-REPEAT_BRIEF           = YES
-ABBREVIATE_BRIEF       =
-ALWAYS_DETAILED_SEC    = NO
-INLINE_INHERITED_MEMB  = NO
-FULL_PATH_NAMES        = YES
-STRIP_FROM_PATH        =
-STRIP_FROM_INC_PATH    =
-SHORT_NAMES            = NO
-JAVADOC_AUTOBRIEF      = YES
-QT_AUTOBRIEF           = NO
-MULTILINE_CPP_IS_BRIEF = NO
-INHERIT_DOCS           = YES
-SEPARATE_MEMBER_PAGES  = NO
-TAB_SIZE               = 4
-ALIASES                =
-TCL_SUBST              =
-OPTIMIZE_OUTPUT_FOR_C  = YES
-OPTIMIZE_OUTPUT_JAVA   = NO
-OPTIMIZE_FOR_FORTRAN   = NO
-OPTIMIZE_OUTPUT_VHDL   = NO
-EXTENSION_MAPPING      =
-MARKDOWN_SUPPORT       = YES
-AUTOLINK_SUPPORT       = YES
-BUILTIN_STL_SUPPORT    = NO
-CPP_CLI_SUPPORT        = NO
-SIP_SUPPORT            = NO
-IDL_PROPERTY_SUPPORT   = YES
-DISTRIBUTE_GROUP_DOC   = NO
-SUBGROUPING            = YES
-INLINE_GROUPED_CLASSES = NO
-INLINE_SIMPLE_STRUCTS  = YES
-TYPEDEF_HIDES_STRUCT   = NO
-LOOKUP_CACHE_SIZE      = 0
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL            = YES
-EXTRACT_PRIVATE        = NO
-EXTRACT_PACKAGE        = NO
-EXTRACT_STATIC         = NO
-EXTRACT_LOCAL_CLASSES  = NO
-EXTRACT_LOCAL_METHODS  = NO
-EXTRACT_ANON_NSPACES   = NO
-HIDE_UNDOC_MEMBERS     = NO
-HIDE_UNDOC_CLASSES     = NO
-HIDE_FRIEND_COMPOUNDS  = NO
-HIDE_IN_BODY_DOCS      = NO
-INTERNAL_DOCS          = NO
-CASE_SENSE_NAMES       = YES
-HIDE_SCOPE_NAMES       = NO
-SHOW_INCLUDE_FILES     = YES
-FORCE_LOCAL_INCLUDES   = NO
-INLINE_INFO            = YES
-SORT_MEMBER_DOCS       = YES
-SORT_BRIEF_DOCS        = NO
-SORT_MEMBERS_CTORS_1ST = NO
-SORT_GROUP_NAMES       = NO
-SORT_BY_SCOPE_NAME     = NO
-STRICT_PROTO_MATCHING  = NO
-GENERATE_TODOLIST      = YES
-GENERATE_TESTLIST      = YES
-GENERATE_BUGLIST       = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS       =
-MAX_INITIALIZER_LINES  = 30
-SHOW_USED_FILES        = YES
-SHOW_FILES             = YES
-SHOW_NAMESPACES        = YES
-FILE_VERSION_FILTER    =
-LAYOUT_FILE            =
-CITE_BIB_FILES         =
-#---------------------------------------------------------------------------
-# Configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET                  = NO
-WARNINGS               = YES
-WARN_IF_UNDOCUMENTED   = YES
-WARN_IF_DOC_ERROR      = YES
-WARN_NO_PARAMDOC       = NO
-WARN_FORMAT            = "$file:$line: $text"
-WARN_LOGFILE           =
-#---------------------------------------------------------------------------
-# Configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT                  = php_propro.h
-INPUT_ENCODING         = UTF-8
-FILE_PATTERNS          =
-RECURSIVE              = NO
-EXCLUDE                =
-EXCLUDE_SYMLINKS       = NO
-EXCLUDE_PATTERNS       =
-EXCLUDE_SYMBOLS        =
-EXAMPLE_PATH           =
-EXAMPLE_PATTERNS       =
-EXAMPLE_RECURSIVE      = NO
-IMAGE_PATH             =
-INPUT_FILTER           =
-FILTER_PATTERNS        =
-FILTER_SOURCE_FILES    = NO
-FILTER_SOURCE_PATTERNS =
-USE_MDFILE_AS_MAINPAGE =
-#---------------------------------------------------------------------------
-# Configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER         = NO
-INLINE_SOURCES         = NO
-STRIP_CODE_COMMENTS    = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION    = NO
-REFERENCES_LINK_SOURCE = YES
-SOURCE_TOOLTIPS        = YES
-USE_HTAGS              = NO
-VERBATIM_HEADERS       = YES
-#---------------------------------------------------------------------------
-# Configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX     = YES
-COLS_IN_ALPHA_INDEX    = 5
-IGNORE_PREFIX          =
-#---------------------------------------------------------------------------
-# Configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML          = YES
-HTML_OUTPUT            = html
-HTML_FILE_EXTENSION    = .html
-HTML_HEADER            =
-HTML_FOOTER            =
-HTML_STYLESHEET        =
-HTML_EXTRA_STYLESHEET  =
-HTML_EXTRA_FILES       =
-HTML_COLORSTYLE_HUE    = 220
-HTML_COLORSTYLE_SAT    = 100
-HTML_COLORSTYLE_GAMMA  = 80
-HTML_TIMESTAMP         = NO
-HTML_DYNAMIC_SECTIONS  = NO
-HTML_INDEX_NUM_ENTRIES = 100
-GENERATE_DOCSET        = NO
-DOCSET_FEEDNAME        = "Doxygen generated docs"
-DOCSET_BUNDLE_ID       = org.doxygen.Project
-DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
-DOCSET_PUBLISHER_NAME  = Publisher
-GENERATE_HTMLHELP      = NO
-CHM_FILE               =
-HHC_LOCATION           =
-GENERATE_CHI           = NO
-CHM_INDEX_ENCODING     =
-BINARY_TOC             = NO
-TOC_EXPAND             = NO
-GENERATE_QHP           = NO
-QCH_FILE               =
-QHP_NAMESPACE          = org.doxygen.Project
-QHP_VIRTUAL_FOLDER     = doc
-QHP_CUST_FILTER_NAME   =
-QHP_CUST_FILTER_ATTRS  =
-QHP_SECT_FILTER_ATTRS  =
-QHG_LOCATION           =
-GENERATE_ECLIPSEHELP   = NO
-ECLIPSE_DOC_ID         = org.doxygen.Project
-DISABLE_INDEX          = NO
-GENERATE_TREEVIEW      = YES
-ENUM_VALUES_PER_LINE   = 4
-TREEVIEW_WIDTH         = 250
-EXT_LINKS_IN_WINDOW    = NO
-FORMULA_FONTSIZE       = 10
-FORMULA_TRANSPARENT    = YES
-USE_MATHJAX            = NO
-MATHJAX_FORMAT         = HTML-CSS
-MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
-MATHJAX_EXTENSIONS     =
-MATHJAX_CODEFILE       =
-SEARCHENGINE           = YES
-SERVER_BASED_SEARCH    = NO
-EXTERNAL_SEARCH        = NO
-SEARCHENGINE_URL       =
-SEARCHDATA_FILE        = searchdata.xml
-EXTERNAL_SEARCH_ID     =
-EXTRA_SEARCH_MAPPINGS  =
-#---------------------------------------------------------------------------
-# Configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX         = NO
-LATEX_OUTPUT           = latex
-LATEX_CMD_NAME         = latex
-MAKEINDEX_CMD_NAME     = makeindex
-COMPACT_LATEX          = NO
-PAPER_TYPE             = a4
-EXTRA_PACKAGES         =
-LATEX_HEADER           =
-LATEX_FOOTER           =
-LATEX_EXTRA_FILES      =
-PDF_HYPERLINKS         = YES
-USE_PDFLATEX           = YES
-LATEX_BATCHMODE        = NO
-LATEX_HIDE_INDICES     = NO
-LATEX_SOURCE_CODE      = NO
-LATEX_BIB_STYLE        = plain
-#---------------------------------------------------------------------------
-# Configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF           = NO
-RTF_OUTPUT             = rtf
-COMPACT_RTF            = NO
-RTF_HYPERLINKS         = NO
-RTF_STYLESHEET_FILE    =
-RTF_EXTENSIONS_FILE    =
-#---------------------------------------------------------------------------
-# Configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN           = NO
-MAN_OUTPUT             = man
-MAN_EXTENSION          = .3
-MAN_LINKS              = NO
-#---------------------------------------------------------------------------
-# Configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML           = NO
-XML_OUTPUT             = xml
-XML_SCHEMA             =
-XML_DTD                =
-XML_PROGRAMLISTING     = YES
-#---------------------------------------------------------------------------
-# Configuration options related to the DOCBOOK output
-#---------------------------------------------------------------------------
-GENERATE_DOCBOOK       = NO
-DOCBOOK_OUTPUT         = docbook
-#---------------------------------------------------------------------------
-# Configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF   = NO
-#---------------------------------------------------------------------------
-# Configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD       = NO
-PERLMOD_LATEX          = NO
-PERLMOD_PRETTY         = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING   = YES
-MACRO_EXPANSION        = YES
-EXPAND_ONLY_PREDEF     = NO
-SEARCH_INCLUDES        = YES
-INCLUDE_PATH           =
-INCLUDE_FILE_PATTERNS  =
-PREDEFINED             = DOXYGEN TSRMLS_C= TSRMLS_D= TSRMLS_CC= TSRMLS_DC= PHP_PROPRO_API=
-EXPAND_AS_DEFINED      =
-SKIP_FUNCTION_MACROS   = YES
-#---------------------------------------------------------------------------
-# Configuration options related to external references
-#---------------------------------------------------------------------------
-TAGFILES               =
-GENERATE_TAGFILE       =
-ALLEXTERNALS           = NO
-EXTERNAL_GROUPS        = YES
-EXTERNAL_PAGES         = YES
-PERL_PATH              = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS         = YES
-MSCGEN_PATH            =
-HIDE_UNDOC_RELATIONS   = YES
-HAVE_DOT               = YES
-DOT_NUM_THREADS        = 0
-DOT_FONTNAME           = Helvetica
-DOT_FONTSIZE           = 10
-DOT_FONTPATH           =
-CLASS_GRAPH            = NO
-COLLABORATION_GRAPH    = YES
-GROUP_GRAPHS           = YES
-UML_LOOK               = NO
-UML_LIMIT_NUM_FIELDS   = 10
-TEMPLATE_RELATIONS     = NO
-INCLUDE_GRAPH          = YES
-INCLUDED_BY_GRAPH      = YES
-CALL_GRAPH             = YES
-CALLER_GRAPH           = YES
-GRAPHICAL_HIERARCHY    = YES
-DIRECTORY_GRAPH        = YES
-DOT_IMAGE_FORMAT       = png
-INTERACTIVE_SVG        = NO
-DOT_PATH               =
-DOTFILE_DIRS           =
-MSCFILE_DIRS           =
-DOT_GRAPH_MAX_NODES    = 50
-MAX_DOT_GRAPH_DEPTH    = 0
-DOT_TRANSPARENT        = NO
-DOT_MULTI_TARGETS      = NO
-GENERATE_LEGEND        = YES
-DOT_CLEANUP            = YES
-PHP_ARG_ENABLE(propro, whether to enable property proxy support,
-[  --enable-propro           Enable property proxy support])
-
-if test "$PHP_PROPRO" != "no"; then
-       PHP_INSTALL_HEADERS(ext/propro, php_propro.h php_propro_api.h)
-       PHP_NEW_EXTENSION(propro, php_propro.c, $ext_shared)
-fi
-\r
-ARG_ENABLE("propro", "for propro support", "no");\r
-\r
-if (PHP_PROPRO == "yes") {\r
-               EXTENSION("propro", "php_propro.c");\r
-\r
-               AC_DEFINE("HAVE_PROPRO", 1);\r
-               PHP_INSTALL_HEADERS("ext/propro", "php_propro.h");\r
-}\r
-/*
-    +--------------------------------------------------------------------+
-    | PECL :: propro                                                     |
-    +--------------------------------------------------------------------+
-    | Redistribution and use in source and binary forms, with or without |
-    | modification, are permitted provided that the conditions mentioned |
-    | in the accompanying LICENSE file are met.                          |
-    +--------------------------------------------------------------------+
-    | Copyright (c) 2013 Michael Wallner <mike@php.net>                  |
-    +--------------------------------------------------------------------+
-*/
-
-#ifndef PHP_PROPRO_H
-#define PHP_PROPRO_H
-
-extern zend_module_entry propro_module_entry;
-#define phpext_propro_ptr &propro_module_entry
-
-#define PHP_PROPRO_VERSION "2.0.0dev"
-
-#ifdef PHP_WIN32
-#      define PHP_PROPRO_API __declspec(dllexport)
-#elif defined(__GNUC__) && __GNUC__ >= 4
-#      define PHP_PROPRO_API extern __attribute__ ((visibility("default")))
-#else
-#      define PHP_PROPRO_API extern
-#endif
-
-#ifdef ZTS
-#      include <TSRM/TSRM.h>
-#endif
-
-#define PHP_PROPRO_PTR(zo) (void*)(((char*)(zo))-(zo)->handlers->offset)
-
-#endif /* PHP_PROPRO_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-/*
-    +--------------------------------------------------------------------+
-    | PECL :: propro                                                     |
-    +--------------------------------------------------------------------+
-    | Redistribution and use in source and binary forms, with or without |
-    | modification, are permitted provided that the conditions mentioned |
-    | in the accompanying LICENSE file are met.                          |
-    +--------------------------------------------------------------------+
-    | Copyright (c) 2013 Michael Wallner <mike@php.net>                  |
-    +--------------------------------------------------------------------+
-*/
-
-#ifndef PHP_PROPRO_API_H
-#define PHP_PROPRO_API_H
-
-#include "php_propro.h"
-
-/**
- * The internal property proxy.
- *
- * Container for the object/array holding the proxied property.
- */
-struct php_property_proxy {
-       /** The container holding the property */
-       zval container;
-       /** The name of the proxied property */
-       zend_string *member;
-};
-typedef struct php_property_proxy php_property_proxy_t;
-
-/**
- * The userland object.
- *
- * Return an object instance of php\\PropertyProxy to make your C-struct
- * member accessible by reference from PHP userland.
- *
- * Example:
- * ~~~~~~~~~~{.c}
- * static zval *my_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *tmp)
- * {
- *    zval *return_value;
- *    zend_string *member_name = zval_get_string(member);
- *    my_prophandler_t *handler = my_get_prophandler(member_name);
- *
- *    if (!handler || type == BP_VAR_R || type == BP_VAR_IS) {
- *     return_value = zend_get_std_object_handlers()->read_property(object, member, type, cache_slot, tmp);
- *
- *     if (handler) {
- *             handler->read(object, tmp);
- *
- *             zval_ptr_dtor(return_value);
- *             ZVAL_COPY_VALUE(return_value, tmp);
- *     }
- *    } else {
- *     return_value = php_property_proxy_zval(object, member_name);
- *    }
- *
- *    zend_string_release(member_name);
- *
- *    return return_value;
- * }
- * ~~~~~~~~~~
- */
-struct php_property_proxy_object {
-       /** The actual property proxy */
-       php_property_proxy_t *proxy;
-       /** Any parent property proxy object */
-       zval parent;
-       /** The std zend_object */
-       zend_object zo;
-};
-typedef struct php_property_proxy_object php_property_proxy_object_t;
-
-/**
- * Create a property proxy
- *
- * The property proxy will forward reads and writes to itself to the
- * proxied property with name \a member_str of \a container.
- *
- * @param container the container holding the property
- * @param member the name of the proxied property
- * @return a new property proxy
- */
-PHP_PROPRO_API php_property_proxy_t *php_property_proxy_init(zval *container,
-               zend_string *member);
-
-/**
- * Destroy and free a property proxy.
- *
- * The destruction of the property proxy object calls this.
- *
- * @param proxy a pointer to the allocated property proxy
- */
-PHP_PROPRO_API void php_property_proxy_free(php_property_proxy_t **proxy);
-
-/**
- * Get the zend_class_entry of php\\PropertyProxy
- * @return the class entry pointer
- */
-PHP_PROPRO_API zend_class_entry *php_property_proxy_get_class_entry(void);
-
-/**
- * Instantiate a new php\\PropertyProxy
- * @param ce the property proxy or derived class entry
- * @return the zend object
- */
-PHP_PROPRO_API zend_object *php_property_proxy_object_new(zend_class_entry *ce);
-
-/**
- * Instantiate a new php\\PropertyProxy with \a proxy
- * @param ce the property proxy or derived class entry
- * @param proxy the internal property proxy
- * @return the property proxy
- */
-PHP_PROPRO_API php_property_proxy_object_t *php_property_proxy_object_new_ex(
-               zend_class_entry *ce, php_property_proxy_t *proxy);
-
-#endif /* PHP_PROPRO_API_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-/*
-    +--------------------------------------------------------------------+
-    | PECL :: propro                                                     |
-    +--------------------------------------------------------------------+
-    | Redistribution and use in source and binary forms, with or without |
-    | modification, are permitted provided that the conditions mentioned |
-    | in the accompanying LICENSE file are met.                          |
-    +--------------------------------------------------------------------+
-    | Copyright (c) 2013 Michael Wallner <mike@php.net>                  |
-    +--------------------------------------------------------------------+
-*/
-
-
-#ifdef HAVE_CONFIG_H
-#      include "config.h"
-#endif
-
-#include <php.h>
-#include <ext/standard/info.h>
-
-#include "php_propro_api.h"
-
-#define DEBUG_PROPRO 0
-
-static inline zval *get_referenced_zval(zval *ref)
-{
-       while (Z_ISREF_P(ref)) {
-               ref = Z_REFVAL_P(ref);
-       }
-       return ref;
-}
-
-php_property_proxy_t *php_property_proxy_init(zval *container, zend_string *member)
-{
-       php_property_proxy_t *proxy = ecalloc(1, sizeof(*proxy));
-
-       ZVAL_COPY(&proxy->container, get_referenced_zval(container));
-       proxy->member = zend_string_copy(member);
-
-       return proxy;
-}
-
-void php_property_proxy_free(php_property_proxy_t **proxy)
-{
-       if (*proxy) {
-               zval_ptr_dtor(&(*proxy)->container);
-               zend_string_release((*proxy)->member);
-               efree(*proxy);
-               *proxy = NULL;
-       }
-}
-
-static zend_class_entry *php_property_proxy_class_entry;
-static zend_object_handlers php_property_proxy_object_handlers;
-
-zend_class_entry *php_property_proxy_get_class_entry(void)
-{
-       return php_property_proxy_class_entry;
-}
-
-static inline php_property_proxy_object_t *get_propro(zval *object);
-static zval *get_parent_proxied_value(zval *object, zval *return_value);
-static zval *get_proxied_value(zval *object, zval *return_value);
-static zval *read_dimension(zval *object, zval *offset, int type, zval *return_value);
-static ZEND_RESULT_CODE cast_proxied_value(zval *object, zval *return_value, int type);
-static void write_dimension(zval *object, zval *offset, zval *value);
-static void set_proxied_value(zval *object, zval *value);
-
-#if DEBUG_PROPRO
-/* we do not really care about TS when debugging */
-static int level = 1;
-static const char space[] = "                               ";
-static const char *inoutstr[] = {"< return","="," > enter"};
-
-static void _walk(php_property_proxy_object_t *obj)
-{
-       if (obj) {
-               if (!Z_ISUNDEF(obj->parent)) {
-                       _walk(get_propro(&obj->parent));
-               }
-               if (obj->proxy) {
-                       fprintf(stderr, ".%s", obj->proxy->member->val);
-               }
-       }
-}
-
-static void debug_propro(int inout, const char *f,
-               php_property_proxy_object_t *obj, zval *offset, zval *value TSRMLS_DC)
-{
-       fprintf(stderr, "#PP %p %s %s %s ", obj, &space[sizeof(space)-level],
-                       inoutstr[inout+1], f);
-
-       level += inout;
-
-       _walk(obj);
-
-       if (*f++=='d'
-       &&      *f++=='i'
-       &&      *f++=='m'
-       ) {
-               char *offset_str = "[]";
-               zval *o = offset;
-
-               if (o) {
-                       convert_to_string_ex(o);
-                       offset_str = Z_STRVAL_P(o);
-               }
-
-               fprintf(stderr, ".%s", offset_str);
-
-               if (o && o != offset) {
-                       zval_ptr_dtor(o);
-               }
-       }
-       if (value && !Z_ISUNDEF_P(value)) {
-               const char *t[] = {
-                               "UNDEF",
-                               "NULL",
-                               "FALSE",
-                               "TRUE",
-                               "int",
-                               "float",
-                               "string",
-                               "Array",
-                               "Object",
-                               "resource",
-                               "reference",
-                               "constant",
-                               "constant AST",
-                               "_BOOL",
-                               "callable",
-                               "indirect",
-                               "---",
-                               "pointer"
-               };
-               fprintf(stderr, " = (%s) ", t[Z_TYPE_P(value)&0xf]);
-               if (!Z_ISUNDEF_P(value) && Z_TYPE_P(value) != IS_INDIRECT) {
-                       zend_print_flat_zval_r(value TSRMLS_CC);
-               }
-       }
-
-       fprintf(stderr, "\n");
-}
-#else
-#define debug_propro(l, f, obj, off, val)
-#endif
-
-php_property_proxy_object_t *php_property_proxy_object_new_ex(
-               zend_class_entry *ce, php_property_proxy_t *proxy)
-{
-       php_property_proxy_object_t *o;
-
-       if (!ce) {
-               ce = php_property_proxy_class_entry;
-       }
-
-       o = ecalloc(1, sizeof(*o) + sizeof(zval) * (ce->default_properties_count - 1));
-       zend_object_std_init(&o->zo, ce);
-       object_properties_init(&o->zo, ce);
-
-       o->proxy = proxy;
-       o->zo.handlers = &php_property_proxy_object_handlers;
-
-       debug_propro(0, "init", o, NULL, NULL);
-
-       return o;
-}
-
-zend_object *php_property_proxy_object_new(zend_class_entry *ce)
-{
-       return &php_property_proxy_object_new_ex(ce, NULL)->zo;
-}
-
-static void destroy_obj(zend_object *object)
-{
-       php_property_proxy_object_t *o = PHP_PROPRO_PTR(object);
-
-       debug_propro(0, "dtor", o, NULL, NULL);
-
-       if (o->proxy) {
-               php_property_proxy_free(&o->proxy);
-       }
-       if (!Z_ISUNDEF(o->parent)) {
-               zval_ptr_dtor(&o->parent);
-               ZVAL_UNDEF(&o->parent);
-       }
-       zend_object_std_dtor(object);
-}
-
-static inline php_property_proxy_object_t *get_propro(zval *object)
-{
-       object = get_referenced_zval(object);
-       switch (Z_TYPE_P(object)) {
-       case IS_OBJECT:
-               break;
-
-       EMPTY_SWITCH_DEFAULT_CASE();
-       }
-       return PHP_PROPRO_PTR(Z_OBJ_P(object));
-}
-
-static inline zend_bool got_value(zval *container, zval *value)
-{
-       zval identical;
-
-       if (!Z_ISUNDEF_P(value)) {
-               if (SUCCESS == is_identical_function(&identical, value, container)) {
-                       if (Z_TYPE(identical) != IS_TRUE) {
-                               return 1;
-                       }
-               }
-       }
-
-       return 0;
-}
-
-static zval *get_parent_proxied_value(zval *object, zval *return_value)
-{
-       php_property_proxy_object_t *obj;
-
-       obj = get_propro(object);
-       debug_propro(1, "parent_get", obj, NULL, NULL);
-
-       if (obj->proxy) {
-               if (!Z_ISUNDEF(obj->parent)) {
-                       get_proxied_value(&obj->parent, return_value);
-               }
-       }
-
-       debug_propro(-1, "parent_get", obj, NULL, return_value);
-
-       return return_value;
-}
-
-static zval *get_proxied_value(zval *object, zval *return_value)
-{
-       zval *hash_value, *ref, prop_tmp;
-       php_property_proxy_object_t *obj;
-
-       obj = get_propro(object);
-       debug_propro(1, "get", obj, NULL, NULL);
-
-       if (obj->proxy) {
-               if (!Z_ISUNDEF(obj->parent)) {
-                       zval parent_value;
-
-                       ZVAL_UNDEF(&parent_value);
-                       get_parent_proxied_value(object, &parent_value);
-
-                       if (got_value(&obj->proxy->container, &parent_value)) {
-                               zval_ptr_dtor(&obj->proxy->container);
-                               ZVAL_COPY(&obj->proxy->container, &parent_value);
-                       }
-               }
-
-               ref = get_referenced_zval(&obj->proxy->container);
-
-               switch (Z_TYPE_P(ref)) {
-               case IS_OBJECT:
-                       RETVAL_ZVAL(zend_read_property(Z_OBJCE_P(ref), ref,
-                                       obj->proxy->member->val, obj->proxy->member->len, 0, &prop_tmp),
-                                       0, 0);
-                       break;
-
-               case IS_ARRAY:
-                       hash_value = zend_symtable_find(Z_ARRVAL_P(ref), obj->proxy->member);
-
-                       if (hash_value) {
-                               RETVAL_ZVAL(hash_value, 0, 0);
-                       }
-                       break;
-               }
-       }
-
-       debug_propro(-1, "get", obj, NULL, return_value);
-
-       return return_value;
-}
-
-static ZEND_RESULT_CODE cast_proxied_value(zval *object, zval *return_value,
-               int type)
-{
-       get_proxied_value(object, return_value);
-
-       debug_propro(0, "cast", get_propro(object), NULL, return_value);
-
-       if (!Z_ISUNDEF_P(return_value)) {
-               convert_to_explicit_type_ex(return_value, type);
-               return SUCCESS;
-       }
-
-       return FAILURE;
-}
-
-static void set_proxied_value(zval *object, zval *value)
-{
-       php_property_proxy_object_t *obj;
-       zval *ref;
-
-       obj = get_propro(object);
-       debug_propro(1, "set", obj, NULL, value TSRMLS_CC);
-
-       if (obj->proxy) {
-               if (!Z_ISUNDEF(obj->parent)) {
-                       zval parent_value;
-
-                       ZVAL_UNDEF(&parent_value);
-                       get_parent_proxied_value(object, &parent_value);
-
-                       if (got_value(&obj->proxy->container, &parent_value)) {
-                               zval_ptr_dtor(&obj->proxy->container);
-                               ZVAL_COPY(&obj->proxy->container, &parent_value);
-                       }
-               }
-
-               ref = get_referenced_zval(&obj->proxy->container);
-
-               switch (Z_TYPE_P(ref)) {
-               case IS_OBJECT:
-                       zend_update_property(Z_OBJCE_P(ref), ref, obj->proxy->member->val,
-                                       obj->proxy->member->len, value);
-                       break;
-
-               default:
-                       convert_to_array(ref);
-                       /* no break */
-
-               case IS_ARRAY:
-                       Z_TRY_ADDREF_P(value);
-                       zend_symtable_update(Z_ARRVAL_P(ref), obj->proxy->member, value);
-                       break;
-               }
-
-               if (!Z_ISUNDEF(obj->parent)) {
-                       set_proxied_value(&obj->parent, &obj->proxy->container);
-               }
-       }
-
-       debug_propro(-1, "set", obj, NULL, NULL);
-}
-
-static zval *read_dimension(zval *object, zval *offset, int type, zval *return_value)
-{
-       zval proxied_value;
-       zend_string *member = offset ? zval_get_string(offset) : NULL;
-
-       debug_propro(1, type == BP_VAR_R ? "dim_read" : "dim_read_ref",
-                       get_propro(object), offset, NULL);
-
-       ZVAL_UNDEF(&proxied_value);
-       get_proxied_value(object, &proxied_value);
-
-       if (BP_VAR_R == type && member && !Z_ISUNDEF(proxied_value)) {
-               if (Z_TYPE(proxied_value) == IS_ARRAY) {
-                       zval *hash_value = zend_symtable_find(Z_ARRVAL(proxied_value),
-                                       member);
-
-                       if (hash_value) {
-                               RETVAL_ZVAL(hash_value, 1, 0);
-                       }
-               }
-       } else {
-               php_property_proxy_t *proxy;
-               php_property_proxy_object_t *proxy_obj;
-
-               if (!Z_ISUNDEF(proxied_value)) {
-                       convert_to_array(&proxied_value);
-                       Z_ADDREF(proxied_value);
-               } else {
-                       array_init(&proxied_value);
-                       set_proxied_value(object, &proxied_value);
-               }
-
-               if (!member) {
-                       member = zend_long_to_str(zend_hash_next_free_element(
-                                       Z_ARRVAL(proxied_value)));
-               }
-
-               proxy = php_property_proxy_init(&proxied_value, member);
-               zval_ptr_dtor(&proxied_value);
-
-               proxy_obj = php_property_proxy_object_new_ex(NULL, proxy);
-               ZVAL_COPY(&proxy_obj->parent, object);
-               RETVAL_OBJ(&proxy_obj->zo);
-       }
-
-       if (member) {
-               zend_string_release(member);
-       }
-
-       debug_propro(-1, type == BP_VAR_R ? "dim_read" : "dim_read_ref",
-                       get_propro(object), offset, return_value);
-
-       return return_value;
-}
-
-static int has_dimension(zval *object, zval *offset, int check_empty)
-{
-       zval proxied_value;
-       int exists = 0;
-
-       debug_propro(1, "dim_exists", get_propro(object), offset, NULL);
-
-       ZVAL_UNDEF(&proxied_value);
-       get_proxied_value(object, &proxied_value);
-       if (Z_ISUNDEF(proxied_value)) {
-               exists = 0;
-       } else {
-               zend_string *zs = zval_get_string(offset);
-
-               if (Z_TYPE(proxied_value) == IS_ARRAY) {
-                       zval *zentry = zend_symtable_find(Z_ARRVAL(proxied_value), zs);
-
-                       if (!zentry) {
-                               exists = 0;
-                       } else {
-                               if (check_empty) {
-                                       exists = !Z_ISNULL_P(zentry);
-                               } else {
-                                       exists = 1;
-                               }
-                       }
-               }
-
-               zend_string_release(zs);
-       }
-
-       debug_propro(-1, "dim_exists", get_propro(object), offset, NULL);
-
-       return exists;
-}
-
-static void write_dimension(zval *object, zval *offset, zval *value)
-{
-       zval proxied_value;
-
-       debug_propro(1, "dim_write", get_propro(object), offset, value);
-
-       ZVAL_UNDEF(&proxied_value);
-       get_proxied_value(object, &proxied_value);
-
-       if (!Z_ISUNDEF(proxied_value)) {
-               if (Z_TYPE(proxied_value) == IS_ARRAY) {
-                       Z_ADDREF(proxied_value);
-               } else {
-                       convert_to_array(&proxied_value);
-               }
-       } else {
-               array_init(&proxied_value);
-       }
-
-       SEPARATE_ZVAL(value);
-       Z_TRY_ADDREF_P(value);
-
-       if (offset) {
-               zend_string *zs = zval_get_string(offset);
-               zend_symtable_update(Z_ARRVAL(proxied_value), zs, value);
-               zend_string_release(zs);
-       } else {
-               zend_hash_next_index_insert(Z_ARRVAL(proxied_value), value);
-       }
-
-       set_proxied_value(object, &proxied_value);
-
-       debug_propro(-1, "dim_write", get_propro(object), offset, &proxied_value);
-
-       zval_ptr_dtor(&proxied_value);
-}
-
-static void unset_dimension(zval *object, zval *offset)
-{
-       zval proxied_value;
-
-       debug_propro(1, "dim_unset", get_propro(object), offset, NULL);
-
-       ZVAL_UNDEF(&proxied_value);
-       get_proxied_value(object, &proxied_value);
-
-       if (Z_TYPE(proxied_value) == IS_ARRAY) {
-               zval *o = offset;
-               ZEND_RESULT_CODE rv;
-
-               convert_to_string_ex(o);
-               rv = zend_symtable_del(Z_ARRVAL(proxied_value), Z_STR_P(o));
-               if (SUCCESS == rv) {
-                       set_proxied_value(object, &proxied_value);
-               }
-
-               if (o != offset) {
-                       zval_ptr_dtor(o);
-               }
-       }
-
-       debug_propro(-1, "dim_unset", get_propro(object), offset, &proxied_value);
-}
-
-ZEND_BEGIN_ARG_INFO_EX(ai_propro_construct, 0, 0, 2)
-       ZEND_ARG_INFO(1, object)
-       ZEND_ARG_INFO(0, member)
-       ZEND_ARG_OBJ_INFO(0, parent, php\\PropertyProxy, 1)
-ZEND_END_ARG_INFO();
-static PHP_METHOD(propro, __construct) {
-       zend_error_handling zeh;
-       zval *container, *parent = NULL;
-       zend_string *member;
-
-       zend_replace_error_handling(EH_THROW, NULL, &zeh);
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "zS|O!",
-                       &container, &member, &parent,
-                       php_property_proxy_class_entry)) {
-               php_property_proxy_object_t *obj;
-               zval *ref = get_referenced_zval(container);
-
-               switch (Z_TYPE_P(ref)) {
-               case IS_OBJECT:
-               case IS_ARRAY:
-                       break;
-               default:
-                       convert_to_array(ref);
-               }
-               obj = get_propro(getThis());
-               obj->proxy = php_property_proxy_init(container, member);
-               if (parent) {
-                       ZVAL_COPY(&obj->parent, parent);
-               }
-       }
-       zend_restore_error_handling(&zeh);
-}
-
-static const zend_function_entry php_property_proxy_method_entry[] = {
-       PHP_ME(propro, __construct, ai_propro_construct, ZEND_ACC_PUBLIC)
-       {0}
-};
-
-static PHP_MINIT_FUNCTION(propro)
-{
-       zend_class_entry ce = {0};
-
-       INIT_NS_CLASS_ENTRY(ce, "php", "PropertyProxy",
-                       php_property_proxy_method_entry);
-       php_property_proxy_class_entry = zend_register_internal_class(&ce);
-       php_property_proxy_class_entry->create_object = php_property_proxy_object_new;
-       php_property_proxy_class_entry->ce_flags |= ZEND_ACC_FINAL;
-
-       memcpy(&php_property_proxy_object_handlers, zend_get_std_object_handlers(),
-                       sizeof(zend_object_handlers));
-       php_property_proxy_object_handlers.offset = XtOffsetOf(php_property_proxy_object_t, zo);
-       php_property_proxy_object_handlers.free_obj = destroy_obj;
-       php_property_proxy_object_handlers.set = set_proxied_value;
-       php_property_proxy_object_handlers.get = get_proxied_value;
-       php_property_proxy_object_handlers.cast_object = cast_proxied_value;
-       php_property_proxy_object_handlers.read_dimension = read_dimension;
-       php_property_proxy_object_handlers.write_dimension = write_dimension;
-       php_property_proxy_object_handlers.has_dimension = has_dimension;
-       php_property_proxy_object_handlers.unset_dimension = unset_dimension;
-
-       return SUCCESS;
-}
-
-PHP_MINFO_FUNCTION(propro)
-{
-       php_info_print_table_start();
-       php_info_print_table_header(2, "Property proxy support", "enabled");
-       php_info_print_table_row(2, "Extension version", PHP_PROPRO_VERSION);
-       php_info_print_table_end();
-}
-
-static const zend_function_entry propro_functions[] = {
-       {0}
-};
-
-zend_module_entry propro_module_entry = {
-       STANDARD_MODULE_HEADER,
-       "propro",
-       propro_functions,
-       PHP_MINIT(propro),
-       NULL,
-       NULL,
-       NULL,
-       PHP_MINFO(propro),
-       PHP_PROPRO_VERSION,
-       STANDARD_MODULE_PROPERTIES
-};
-
-#ifdef COMPILE_DL_PROPRO
-ZEND_GET_MODULE(propro)
-#endif
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
---TEST--
-property proxy
---SKIPIF--
-<?php if (!extension_loaded("propro")) print "skip"; ?>
---FILE--
-<?php
-
-echo "Test\n";
-
-class c {
-       private $prop;
-       private $anon;
-       function __get($p) {
-               return new php\PropertyProxy($this, $p);
-       }
-}
-
-$c = new c;
-
-$p = $c->prop;
-$a = $c->anon;
-
-var_dump($c);
-
-echo "set\n";
-$a = 123; 
-echo "get\n";
-echo $a,"\n";
-
-$p["foo"] = 123;
-$p["bar"]["baz"]["a"]["b"]=987;
-
-var_dump($c);
-
-?>
-DONE
---EXPECTF--
-Test
-object(c)#%d (2) {
-  ["prop":"c":private]=>
-  NULL
-  ["anon":"c":private]=>
-  NULL
-}
-set
-get
-123
-object(c)#%d (2) {
-  ["prop":"c":private]=>
-  array(2) {
-    ["foo"]=>
-    int(123)
-    ["bar"]=>
-    array(1) {
-      ["baz"]=>
-      array(1) {
-        ["a"]=>
-        array(1) {
-          ["b"]=>
-          int(987)
-        }
-      }
-    }
-  }
-  ["anon":"c":private]=>
-  int(123)
-}
-DONE
---TEST--
-property proxy
---SKIPIF--
-<?php if (!extension_loaded("propro")) print "skip"; ?>
---FILE--
-<?php
-
-echo "Test\n";
-
-class c {
-       private $storage = array();
-       function __get($p) {
-               return new php\PropertyProxy($this->storage, $p);
-       }
-       function __set($p, $v) {
-               $this->storage[$p] = $v;
-       }
-}
-
-$c = new c;
-$c->data["foo"] = 1;
-var_dump(
-       isset($c->data["foo"]),
-       isset($c->data["bar"])
-);
-
-var_dump($c);
-
-$c->data[] = 1;
-$c->data[] = 2;
-$c->data[] = 3;
-$c->data["bar"][] = 123;
-$c->data["bar"][] = 456;
-
-var_dump($c);
-unset($c->data["bar"][0]);
-
-var_dump($c);
-
-?>
-DONE
---EXPECTF--
-Test
-bool(true)
-bool(false)
-object(c)#%d (1) {
-  ["storage":"c":private]=>
-  array(1) {
-    ["data"]=>
-    array(1) {
-      ["foo"]=>
-      int(1)
-    }
-  }
-}
-object(c)#%d (1) {
-  ["storage":"c":private]=>
-  array(1) {
-    ["data"]=>
-    array(5) {
-      ["foo"]=>
-      int(1)
-      [0]=>
-      int(1)
-      [1]=>
-      int(2)
-      [2]=>
-      int(3)
-      ["bar"]=>
-      array(2) {
-        [0]=>
-        int(123)
-        [1]=>
-        int(456)
-      }
-    }
-  }
-}
-object(c)#%d (1) {
-  ["storage":"c":private]=>
-  array(1) {
-    ["data"]=>
-    array(5) {
-      ["foo"]=>
-      int(1)
-      [0]=>
-      int(1)
-      [1]=>
-      int(2)
-      [2]=>
-      int(3)
-      ["bar"]=>
-      array(1) {
-        [1]=>
-        int(456)
-      }
-    }
-  }
-}
-DONE
---TEST--
-property proxy
---SKIPIF--
-<?php 
-extension_loaded("propro") || print "skip";
-?>
---FILE--
-<?php 
-echo "Test\n";
-
-class t {
-       private $ref;
-       function __get($v) {
-               return new php\PropertyProxy($this, $v);
-       } 
-}
-
-$t = new t;
-$r = &$t->ref;
-$r = 1;
-var_dump($t);
-$t->ref[] = 2;
-var_dump($t);
-?>
-===DONE===
---EXPECTF--
-Test
-object(t)#%d (1) {
-  ["ref":"t":private]=>
-  int(1)
-}
-object(t)#%d (1) {
-  ["ref":"t":private]=>
-  array(2) {
-    [0]=>
-    int(1)
-    [1]=>
-    int(2)
-  }
-}
-===DONE===®,øÿÅ\ 5míP\1d\12\ 5Vð¼Üò\10çc\ 2\0\0\0GBMB
\ No newline at end of file
diff --git a/travis/propro-master.ext.phar b/travis/propro-master.ext.phar
new file mode 100755 (executable)
index 0000000..cae49e7
--- /dev/null
@@ -0,0 +1,5695 @@
+#!/usr/bin/env php
+<?php
+
+/**
+ * The installer sub-stub for extension phars
+ */
+
+namespace pharext;
+
+define("PHAREXT_PHAR", __FILE__);
+
+spl_autoload_register(function($c) {
+       return include strtr($c, "\\_", "//") . ".php";
+});
+
+
+
+namespace pharext;
+
+class Exception extends \Exception
+{
+       public function __construct($message = null, $code = 0, $previous = null) {
+               if (!isset($message)) {
+                       $last_error = error_get_last();
+                       $message = $last_error["message"];
+                       if (!$code) {
+                               $code = $last_error["type"];
+                       }
+               }
+               parent::__construct($message, $code, $previous);
+       }
+}
+
+
+
+namespace pharext;
+
+use pharext\Exception;
+
+/**
+ * A temporary file/directory name
+ */
+class Tempname
+{
+       /**
+        * @var string
+        */
+       private $name;
+
+       /**
+        * @param string $prefix uniqid() prefix
+        * @param string $suffix e.g. file extension
+        */
+       public function __construct($prefix, $suffix = null) {
+               $temp = sys_get_temp_dir() . "/pharext-" . $this->getUser();
+               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
+                       throw new Exception;
+               }
+               $this->name = $temp ."/". uniqid($prefix) . $suffix;
+       }
+
+       private function getUser() {
+               if (extension_loaded("posix") && function_exists("posix_getpwuid")) {
+                       return posix_getpwuid(posix_getuid())["name"];
+               }
+               return trim(`whoami 2>/dev/null`)
+                       ?: trim(`id -nu 2>/dev/null`)
+                       ?: getenv("USER")
+                       ?: get_current_user();
+       }
+
+       /**
+        * @return string
+        */
+       public function __toString() {
+               return (string) $this->name;
+       }
+}
+
+
+namespace pharext;
+
+/**
+ * Create a new temporary file
+ */
+class Tempfile extends \SplFileInfo
+{
+       /**
+        * @var resource
+        */
+       private $handle;
+
+       /**
+        * @param string $prefix uniqid() prefix
+        * @param string $suffix e.g. file extension
+        * @throws \pharext\Exception
+        */
+       public function __construct($prefix, $suffix = ".tmp") {
+               $tries = 0;
+               $omask = umask(077);
+               do {
+                       $path = new Tempname($prefix, $suffix);
+                       $this->handle = fopen($path, "x");
+               } while (!is_resource($this->handle) && $tries++ < 10);
+               umask($omask);
+               
+               if (!is_resource($this->handle)) {
+                       throw new Exception("Could not create temporary file");
+               }
+               
+               parent::__construct($path);
+       }
+
+       /**
+        * Unlink the file
+        */
+       public function __destruct() {
+               if (is_file($this->getPathname())) {
+                       @unlink($this->getPathname());
+               }
+       }
+
+       /**
+        * Close the stream
+        */
+       public function closeStream() {
+               fclose($this->handle);
+       }
+
+       /**
+        * Retrieve the stream resource
+        * @return resource
+        */
+       public function getStream() {
+               return $this->handle;
+       }
+}
+
+
+
+namespace pharext;
+
+/**
+ * Create a temporary directory
+ */
+class Tempdir extends \SplFileInfo
+{
+       /**
+        * @param string $prefix prefix to uniqid()
+        * @throws \pharext\Exception
+        */
+       public function __construct($prefix) {
+               $temp = new Tempname($prefix);
+               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
+                       throw new Exception("Could not create tempdir: ".error_get_last()["message"]);
+               }
+               parent::__construct($temp);
+       }
+}
+
+
+
+namespace pharext;
+
+use ArrayAccess;
+use IteratorAggregate;
+use RecursiveDirectoryIterator;
+use SplFileInfo;
+
+use pharext\Exception;
+
+class Archive implements ArrayAccess, IteratorAggregate
+{
+       const HALT_COMPILER = "\137\137\150\141\154\164\137\143\157\155\160\151\154\145\162\50\51\73";
+       const SIGNED = 0x10000;
+       const SIG_MD5    = 0x0001;
+       const SIG_SHA1   = 0x0002;
+       const SIG_SHA256 = 0x0003;
+       const SIG_SHA512 = 0x0004;
+       const SIG_OPENSSL= 0x0010;
+
+       private static $siglen = [
+               self::SIG_MD5    => 16,
+               self::SIG_SHA1   => 20,
+               self::SIG_SHA256 => 32,
+               self::SIG_SHA512 => 64,
+               self::SIG_OPENSSL=> 0
+       ];
+
+       private static $sigalg = [
+               self::SIG_MD5    => "md5",
+               self::SIG_SHA1   => "sha1",
+               self::SIG_SHA256 => "sha256",
+               self::SIG_SHA512 => "sha512",
+               self::SIG_OPENSSL=> "openssl"
+       ];
+
+       private static $sigtyp = [
+               self::SIG_MD5    => "MD5",
+               self::SIG_SHA1   => "SHA-1",
+               self::SIG_SHA256 => "SHA-256",
+               self::SIG_SHA512 => "SHA-512",
+               self::SIG_OPENSSL=> "OpenSSL",
+       ];
+
+       const PERM_FILE_MASK = 0x01ff;
+       const COMP_FILE_MASK = 0xf000;
+       const COMP_GZ_FILE   = 0x1000;
+       const COMP_BZ2_FILE  = 0x2000;
+
+       const COMP_PHAR_MASK= 0xf000;
+       const COMP_PHAR_GZ  = 0x1000;
+       const COMP_PHAR_BZ2 = 0x2000;
+
+       private $file;
+       private $fd;
+       private $stub;
+       private $manifest;
+       private $signature;
+       private $extracted;
+
+       function __construct($file = null) {
+               if (strlen($file)) {
+                       $this->open($file);
+               }
+       }
+
+       function open($file) {
+               if (!$this->fd = @fopen($file, "r")) {
+                       throw new Exception;
+               }
+               $this->file = $file;
+               $this->stub = $this->readStub();
+               $this->manifest = $this->readManifest();
+               $this->signature = $this->readSignature();
+       }
+
+       function getIterator() {
+               return new RecursiveDirectoryIterator($this->extract());
+       }
+
+       function extract() {
+               return $this->extracted ?: $this->extractTo(new Tempdir("archive"));
+       }
+
+       function extractTo($dir) {
+               if ((string) $this->extracted == (string) $dir) {
+                       return $this->extracted;
+               }
+               foreach ($this->manifest["entries"] as $file => $entry) {
+                       fseek($this->fd, $this->manifest["offset"]+$entry["offset"]);
+                       $path = "$dir/$file";
+                       $copy = stream_copy_to_stream($this->fd, $this->outFd($path, $entry["flags"]), $entry["csize"]);
+                       if ($entry["osize"] != $copy) {
+                               throw new Exception("Copied '$copy' of '$file', expected '{$entry["osize"]}' from '{$entry["csize"]}");
+                       }
+
+                       $crc = hexdec(hash_file("crc32b", $path));
+                       if ($crc !== $entry["crc32"]) {
+                               throw new Exception("CRC mismatch of '$file': '$crc' != '{$entry["crc32"]}");
+                       }
+
+                       chmod($path, $entry["flags"] & self::PERM_FILE_MASK);
+                       touch($path, $entry["stamp"]);
+               }
+               return $this->extracted = $dir;
+       }
+
+       function offsetExists($o) {
+               return isset($this->entries[$o]);
+       }
+
+       function offsetGet($o) {
+               $this->extract();
+               return new SplFileInfo($this->extracted."/$o");
+       }
+
+       function offsetSet($o, $v) {
+               throw new Exception("Archive is read-only");
+       }
+
+       function offsetUnset($o) {
+               throw new Exception("Archive is read-only");
+       }
+
+       function getSignature() {
+               /* compatible with Phar::getSignature() */
+               return [
+                       "hash_type" => self::$sigtyp[$this->signature["flags"]],
+                       "hash" => strtoupper(bin2hex($this->signature["hash"])),
+               ];
+       }
+
+       function getPath() {
+               /* compatible with Phar::getPath() */
+               return new SplFileInfo($this->file);
+       }
+
+       function getMetadata($key = null) {
+               if (isset($key)) {
+                       return $this->manifest["meta"][$key];
+               }
+               return $this->manifest["meta"];
+       }
+
+       private function outFd($path, $flags) {
+                       $dirn = dirname($path);
+                       if (!is_dir($dirn) && !@mkdir($dirn, 0777, true)) {
+                               throw new Exception;
+                       }
+                       if (!$fd = @fopen($path, "w")) {
+                               throw new Exception;
+                       }
+                       switch ($flags & self::COMP_FILE_MASK) {
+                       case self::COMP_GZ_FILE:
+                               if (!@stream_filter_append($fd, "zlib.inflate")) {
+                                       throw new Exception;
+                               }
+                               break;
+                       case self::COMP_BZ2_FILE:
+                               if (!@stream_filter_append($fd, "bz2.decompress")) {
+                                       throw new Exception;
+                               }
+                               break;
+                       }
+
+       }
+       private function readVerified($fd, $len) {
+               if ($len != strlen($data = fread($fd, $len))) {
+                       throw new Exception("Unexpected EOF");
+               }
+               return $data;
+       }
+
+       private function readFormat($format, $fd, $len) {
+               if (false === ($data = @unpack($format, $this->readVerified($fd, $len)))) {
+                       throw new Exception;
+               }
+               return $data;
+       }
+
+       private function readSingleFormat($format, $fd, $len) {
+               return current($this->readFormat($format, $fd, $len));
+       }
+
+       private function readStringBinary($fd) {
+               if (($length = $this->readSingleFormat("V", $fd, 4))) {
+                       return $this->readVerified($this->fd, $length);
+               }
+               return null;
+       }
+
+       private function readSerializedBinary($fd) {
+               if (($length = $this->readSingleFormat("V", $fd, 4))) {
+                       if (false === ($data = unserialize($this->readVerified($fd, $length)))) {
+                               throw new Exception;
+                       }
+                       return $data;
+               }
+               return null;
+       }
+
+       private function readStub() {
+               $stub = "";
+               while (!feof($this->fd)) {
+                       $line = fgets($this->fd);
+                       $stub .= $line;
+                       if (false !== stripos($line, self::HALT_COMPILER)) {
+                               /* check for '?>' on a separate line */
+                               if ('?>' === $this->readVerified($this->fd, 2)) {
+                                       $stub .= '?>' . fgets($this->fd);
+                               } else {
+                                       fseek($this->fd, -2, SEEK_CUR);
+                               }
+                               break;
+                       }
+               }
+               return $stub;
+       }
+
+       private function readManifest() {
+               $current = ftell($this->fd);
+               $header = $this->readFormat("Vlen/Vnum/napi/Vflags", $this->fd, 14);
+               $alias = $this->readStringBinary($this->fd);
+               $meta = $this->readSerializedBinary($this->fd);
+               $entries = [];
+               for ($i = 0; $i < $header["num"]; ++$i) {
+                       $this->readEntry($entries);
+               }
+               $offset = ftell($this->fd);
+               if (($length = $offset - $current - 4) != $header["len"]) {
+                       throw new Exception("Manifest length read was '$length', expected '{$header["len"]}'");
+               }
+               return $header + compact("alias", "meta", "entries", "offset");
+       }
+
+       private function readEntry(array &$entries) {
+               if (!count($entries)) {
+                       $offset = 0;
+               } else {
+                       $last = end($entries);
+                       $offset = $last["offset"] + $last["csize"];
+               }
+               $file = $this->readStringBinary($this->fd);
+               if (!strlen($file)) {
+                       throw new Exception("Empty file name encountered at offset '$offset'");
+               }
+               $header = $this->readFormat("Vosize/Vstamp/Vcsize/Vcrc32/Vflags", $this->fd, 20);
+               $meta = $this->readSerializedBinary($this->fd);
+               $entries[$file] =  $header + compact("meta", "offset");
+       }
+
+       private function readSignature() {
+               fseek($this->fd, -8, SEEK_END);
+               $sig = $this->readFormat("Vflags/Z4magic", $this->fd, 8);
+               $end = ftell($this->fd);
+
+               if ($sig["magic"] !== "GBMB") {
+                       throw new Exception("Invalid signature magic value '{$sig["magic"]}");
+               }
+
+               switch ($sig["flags"]) {
+               case self::SIG_OPENSSL:
+                       fseek($this->fd, -12, SEEK_END);
+                       if (($hash = $this->readSingleFormat("V", $this->fd, 4))) {
+                               $offset = 4 + $hash;
+                               fseek($this->fd, -$offset, SEEK_CUR);
+                               $hash = $this->readVerified($this->fd, $hash);
+                               fseek($this->fd, 0, SEEK_SET);
+                               $valid = openssl_verify($this->readVerified($this->fd, $end - $offset - 8),
+                                       $hash, @file_get_contents($this->file.".pubkey")) === 1;
+                       }
+                       break;
+
+               case self::SIG_MD5:
+               case self::SIG_SHA1:
+               case self::SIG_SHA256:
+               case self::SIG_SHA512:
+                       $offset = 8 + self::$siglen[$sig["flags"]];
+                       fseek($this->fd, -$offset, SEEK_END);
+                       $hash = $this->readVerified($this->fd, self::$siglen[$sig["flags"]]);
+                       $algo = hash_init(self::$sigalg[$sig["flags"]]);
+                       fseek($this->fd, 0, SEEK_SET);
+                       hash_update_stream($algo, $this->fd, $end - $offset);
+                       $valid = hash_final($algo, true) === $hash;
+                       break;
+
+               default:
+                       throw new Exception("Invalid signature type '{$sig["flags"]}");
+               }
+
+               return $sig + compact("hash", "valid");
+       }
+}
+
+
+namespace pharext;
+
+if (extension_loaded("Phar")) {
+       \Phar::interceptFileFuncs();
+       \Phar::mapPhar();
+       $phardir = "phar://".__FILE__;
+} else {
+       $archive = new Archive(__FILE__);
+       $phardir = $archive->extract();
+}
+
+set_include_path("$phardir:". get_include_path());
+
+$installer = new Installer();
+$installer->run($argc, $argv);
+
+__HALT_COMPILER(); ?>\r
\10\0\08\0\0\0\11\0\0\0\ 1\0\0\0\0\0*\ 6\0\0a:7:{s:7:"version";s:5:"4.1.1";s:6:"header";s:49:"pharext v4.1.1 (c) Michael Wallner <mike@php.net>";s:4:"date";s:10:"2015-09-28";s:4:"name";s:6:"propro";s:7:"release";s:6:"master";s:7:"license";s:1345:"Copyright (c) 2013, Michael Wallner <mike@php.net>.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, 
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright 
+      notice, this list of conditions and the following disclaimer in the 
+      documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+";s:4:"type";s:9:"extension";}\13\0\0\0pharext/Archive.php\18\1e\0\0 l    V\18\1e\0\04-ÔI¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Cli/Args/Help.phpÉ\f\0\0 l    VÉ\f\0\0gX'\1f\ 1\0\0\0\0\0\0\14\0\0\0pharext/Cli/Args.php\ f\1d\0\0 l V\ f\1d\0\0?n\9dö¶\ 1\0\0\0\0\0\0\17\0\0\0pharext/Cli/Command.phpk   \0\0 l    Vk      \0\0d\84aê¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/Command.php\12\ 4\0\0 l     V\12\ 4\0\0Ôm`Ͷ\ 1\0\0\0\0\0\0\15\0\0\0pharext/Exception.phpc\ 1\0\0 l        Vc\ 1\0\0U\86Ï{¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/ExecCmd.php\1c\ e\0\0 l  V\1c\ e\0\0¹l\94ʶ\ 1\0\0\0\0\0\0\15\0\0\0pharext/Installer.php&\18\0\0 l        V&\18\0\0ød&À¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/License.php\93\ 4\0\0 l  V\93\ 4\0\0î\ 4òE¶\ 1\0\0\0\0\0\0\14\0\0\0pharext/Metadata.php\95\ 1\0\0 l V\95\ 1\0\0¿Ú\90\9e\ 1\0\0\0\0\0\0\1e\0\0\0pharext/Openssl/PrivateKey.phpÁ\ 4\0\0 l       VÁ\ 4\0\0&æP\1a\ 1\0\0\0\0\0\0\14\0\0\0pharext/Packager.phpÌ!\0\0 l VÌ!\0\00\ 2\ 3\ 1\0\0\0\0\0\0\e\0\0\0pharext/SourceDir/Basic.phpz\ 5\0\0 l  Vz\ 5\0\0÷+Ôâ¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/SourceDir/Git.phpZ\ 6\0\0 l    VZ\ 6\0\0É\bÎ\¶\ 1\0\0\0\0\0\0\1a\0\0\0pharext/SourceDir/Pecl.phpø\11\0\0 l   Vø\11\0\0ã\bùж\ 1\0\0\0\0\0\0\15\0\0\0pharext/SourceDir.php½\ 2\0\0 l        V½\ 2\0\03·#\ f\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/Activate.phpÜ\v\0\0 l    VÜ\v\0\0I\93\1c\18\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Askpass.phpU\ 2\0\0 l     VU\ 2\0\0\87*\1e\90\ 1\0\0\0\0\0\0 \0\0\0pharext/Task/BundleGenerator.php}\ 2\0\0 l     V}\ 2\0\0 ï`Y¶\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Cleanup.php\1e\ 4\0\0 l     V\1e\ 4\0\0ÉI\80\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/Configure.phpT\ 4\0\0 l   VT\ 4\0\0}\17Ëì¶\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Extract.phpp\ 3\0\0 l     Vp\ 3\0\0[¨Û̶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/GitClone.phpm\ 3\0\0 l    Vm\ 3\0\0óyµ@¶\ 1\0\0\0\0\0\0\15\0\0\0pharext/Task/Make.phpª\ 4\0\0 l        Vª\ 4\0\0\9cç6\r\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PaxFixup.php¬\ 3\0\0 l    V¬\ 3\0\0yâ¯\e\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/PeclFixup.php\9c\ 4\0\0 l   V\9c\ 4\0\0eùt\9a\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/PharBuild.phpâ\a\0\0 l   Vâ\a\0\0ζ0ɶ\ 1\0\0\0\0\0\0\1d\0\0\0pharext/Task/PharCompress.phpc\ 4\0\0 l        Vc\ 4\0\0½\10³Ï¶\ 1\0\0\0\0\0\0\e\0\0\0pharext/Task/PharRename.phpä\ 3\0\0 l  Vä\ 3\0\0\8a[Þ˶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PharSign.php¨\ 3\0\0 l    V¨\ 3\0\0Ûº¦i¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PharStub.phpæ\ 3\0\0 l    Væ\ 3\0\0Y|­\9b\ 1\0\0\0\0\0\0\17\0\0\0pharext/Task/Phpize.php\ f\ 4\0\0 l      V\ f\ 4\0\0ù\f2Ѷ\ 1\0\0\0\0\0\0\1c\0\0\0pharext/Task/StreamFetch.php\10\a\0\0 l V\10\a\0\0\88îs\¶\ 1\0\0\0\0\0\0\10\0\0\0pharext/Task.phpw\0\0\0 l     Vw\0\0\0 ÄIǶ\ 1\0\0\0\0\0\0\13\0\0\0pharext/Tempdir.phpµ\ 1\0\0 l  Vµ\ 1\0\0ë\7f\96\ 1\0\0\0\0\0\0\14\0\0\0pharext/Tempfile.php\ f\ 4\0\0 l V\ f\ 4\0\0\0®ô\1e\ 1\0\0\0\0\0\0\14\0\0\0pharext/Tempname.phpt\ 3\0\0 l Vt\ 3\0\0\9en<\8d\ 1\0\0\0\0\0\0\13\0\0\0pharext/Updater.php\8d\10\0\0 l  V\8d\10\0\0\9eÏv\16\ 1\0\0\0\0\0\0\15\0\0\0pharext_installer.phpÝ\ 2\0\0 l        VÝ\ 2\0\0\19\8cÞq¶\ 1\0\0\0\0\0\0\14\0\0\0pharext_packager.phpb\ 3\0\0 l Vb\ 3\0\0îVÓ϶\ 1\0\0\0\0\0\0\13\0\0\0pharext_updater.phph\ 3\0\0 l  Vh\ 3\0\0 Êúj¶\ 1\0\0\0\0\0\0\ e\0\0\0.gitattributes2\0\0\0 l       V2\0\0\0¡øNt¶\ 1\0\0\0\0\0\0
+\0\0\0.gitignoreº\0\0\0 l    Vº\0\0\0\9cÆwg¶\ 1\0\0\0\0\0\0\a\0\0\0CREDITS\ 6\0\0\0 l      V\ 6\0\0\0u÷Bζ\ 1\0\0\0\0\0\0\b\0\0\0Doxyfilea*\0\0 l     Va*\0\0\ 1¯d\16\ 1\0\0\0\0\0\0\a\0\0\0LICENSEA\ 5\0\0 l      VA\ 5\0\0¾¬Jþ¶\ 1\0\0\0\0\0\0       \0\0\0README.mdñ\ 2\0\0 l      Vñ\ 2\0\0-\81)u¶\ 1\0\0\0\0\0\0       \0\0\0config.m4\1c\ 1\0\0 l      V\1c\ 1\0\0\13  k"¶\ 1\0\0\0\0\0\0
+\0\0\0config.w32Ö\0\0\0 l    VÖ\0\0\0È5\13²¶\ 1\0\0\0\0\0\0\v\0\0\0package.xmlµ\ 6\0\0 l  Vµ\ 6\0\0\1fÈjg¶\ 1\0\0\0\0\0\0\f\0\0\0php_propro.c08\0\0 l V08\0\0\99ÿ^\ 1\ 1\0\0\0\0\0\0\f\0\0\0php_propro.hO\ 5\0\0 l VO\ 5\0\0G+\18\99\ 1\0\0\0\0\0\0\10\0\0\0php_propro_api.hý\ e\0\0 l     Vý\ e\0\0´\r#\95\ 1\0\0\0\0\0\0\ e\0\0\0tests/001.phpt9\ 3\0\0 l       V9\ 3\0\02Õ½A¶\ 1\0\0\0\0\0\0\ e\0\0\0tests/002.phpt8\ 5\0\0 l       V8\ 5\0\0L\18Â\ f\ 1\0\0\0\0\0\0\ e\0\0\0tests/003.phptï\ 1\0\0 l       Vï\ 1\0\0U8Ìå¶\ 1\0\0\0\0\0\0<?php
+
+namespace pharext;
+
+use ArrayAccess;
+use IteratorAggregate;
+use RecursiveDirectoryIterator;
+use SplFileInfo;
+
+use pharext\Exception;
+
+class Archive implements ArrayAccess, IteratorAggregate
+{
+       const HALT_COMPILER = "\137\137\150\141\154\164\137\143\157\155\160\151\154\145\162\50\51\73";
+       const SIGNED = 0x10000;
+       const SIG_MD5    = 0x0001;
+       const SIG_SHA1   = 0x0002;
+       const SIG_SHA256 = 0x0003;
+       const SIG_SHA512 = 0x0004;
+       const SIG_OPENSSL= 0x0010;
+
+       private static $siglen = [
+               self::SIG_MD5    => 16,
+               self::SIG_SHA1   => 20,
+               self::SIG_SHA256 => 32,
+               self::SIG_SHA512 => 64,
+               self::SIG_OPENSSL=> 0
+       ];
+
+       private static $sigalg = [
+               self::SIG_MD5    => "md5",
+               self::SIG_SHA1   => "sha1",
+               self::SIG_SHA256 => "sha256",
+               self::SIG_SHA512 => "sha512",
+               self::SIG_OPENSSL=> "openssl"
+       ];
+
+       private static $sigtyp = [
+               self::SIG_MD5    => "MD5",
+               self::SIG_SHA1   => "SHA-1",
+               self::SIG_SHA256 => "SHA-256",
+               self::SIG_SHA512 => "SHA-512",
+               self::SIG_OPENSSL=> "OpenSSL",
+       ];
+
+       const PERM_FILE_MASK = 0x01ff;
+       const COMP_FILE_MASK = 0xf000;
+       const COMP_GZ_FILE   = 0x1000;
+       const COMP_BZ2_FILE  = 0x2000;
+
+       const COMP_PHAR_MASK= 0xf000;
+       const COMP_PHAR_GZ  = 0x1000;
+       const COMP_PHAR_BZ2 = 0x2000;
+
+       private $file;
+       private $fd;
+       private $stub;
+       private $manifest;
+       private $signature;
+       private $extracted;
+
+       function __construct($file = null) {
+               if (strlen($file)) {
+                       $this->open($file);
+               }
+       }
+
+       function open($file) {
+               if (!$this->fd = @fopen($file, "r")) {
+                       throw new Exception;
+               }
+               $this->file = $file;
+               $this->stub = $this->readStub();
+               $this->manifest = $this->readManifest();
+               $this->signature = $this->readSignature();
+       }
+
+       function getIterator() {
+               return new RecursiveDirectoryIterator($this->extract());
+       }
+
+       function extract() {
+               return $this->extracted ?: $this->extractTo(new Tempdir("archive"));
+       }
+
+       function extractTo($dir) {
+               if ((string) $this->extracted == (string) $dir) {
+                       return $this->extracted;
+               }
+               foreach ($this->manifest["entries"] as $file => $entry) {
+                       fseek($this->fd, $this->manifest["offset"]+$entry["offset"]);
+                       $path = "$dir/$file";
+                       $copy = stream_copy_to_stream($this->fd, $this->outFd($path, $entry["flags"]), $entry["csize"]);
+                       if ($entry["osize"] != $copy) {
+                               throw new Exception("Copied '$copy' of '$file', expected '{$entry["osize"]}' from '{$entry["csize"]}");
+                       }
+
+                       $crc = hexdec(hash_file("crc32b", $path));
+                       if ($crc !== $entry["crc32"]) {
+                               throw new Exception("CRC mismatch of '$file': '$crc' != '{$entry["crc32"]}");
+                       }
+
+                       chmod($path, $entry["flags"] & self::PERM_FILE_MASK);
+                       touch($path, $entry["stamp"]);
+               }
+               return $this->extracted = $dir;
+       }
+
+       function offsetExists($o) {
+               return isset($this->entries[$o]);
+       }
+
+       function offsetGet($o) {
+               $this->extract();
+               return new SplFileInfo($this->extracted."/$o");
+       }
+
+       function offsetSet($o, $v) {
+               throw new Exception("Archive is read-only");
+       }
+
+       function offsetUnset($o) {
+               throw new Exception("Archive is read-only");
+       }
+
+       function getSignature() {
+               /* compatible with Phar::getSignature() */
+               return [
+                       "hash_type" => self::$sigtyp[$this->signature["flags"]],
+                       "hash" => strtoupper(bin2hex($this->signature["hash"])),
+               ];
+       }
+
+       function getPath() {
+               /* compatible with Phar::getPath() */
+               return new SplFileInfo($this->file);
+       }
+
+       function getMetadata($key = null) {
+               if (isset($key)) {
+                       return $this->manifest["meta"][$key];
+               }
+               return $this->manifest["meta"];
+       }
+
+       private function outFd($path, $flags) {
+                       $dirn = dirname($path);
+                       if (!is_dir($dirn) && !@mkdir($dirn, 0777, true)) {
+                               throw new Exception;
+                       }
+                       if (!$fd = @fopen($path, "w")) {
+                               throw new Exception;
+                       }
+                       switch ($flags & self::COMP_FILE_MASK) {
+                       case self::COMP_GZ_FILE:
+                               if (!@stream_filter_append($fd, "zlib.inflate")) {
+                                       throw new Exception;
+                               }
+                               break;
+                       case self::COMP_BZ2_FILE:
+                               if (!@stream_filter_append($fd, "bz2.decompress")) {
+                                       throw new Exception;
+                               }
+                               break;
+                       }
+
+       }
+       private function readVerified($fd, $len) {
+               if ($len != strlen($data = fread($fd, $len))) {
+                       throw new Exception("Unexpected EOF");
+               }
+               return $data;
+       }
+
+       private function readFormat($format, $fd, $len) {
+               if (false === ($data = @unpack($format, $this->readVerified($fd, $len)))) {
+                       throw new Exception;
+               }
+               return $data;
+       }
+
+       private function readSingleFormat($format, $fd, $len) {
+               return current($this->readFormat($format, $fd, $len));
+       }
+
+       private function readStringBinary($fd) {
+               if (($length = $this->readSingleFormat("V", $fd, 4))) {
+                       return $this->readVerified($this->fd, $length);
+               }
+               return null;
+       }
+
+       private function readSerializedBinary($fd) {
+               if (($length = $this->readSingleFormat("V", $fd, 4))) {
+                       if (false === ($data = unserialize($this->readVerified($fd, $length)))) {
+                               throw new Exception;
+                       }
+                       return $data;
+               }
+               return null;
+       }
+
+       private function readStub() {
+               $stub = "";
+               while (!feof($this->fd)) {
+                       $line = fgets($this->fd);
+                       $stub .= $line;
+                       if (false !== stripos($line, self::HALT_COMPILER)) {
+                               /* check for '?>' on a separate line */
+                               if ('?>' === $this->readVerified($this->fd, 2)) {
+                                       $stub .= '?>' . fgets($this->fd);
+                               } else {
+                                       fseek($this->fd, -2, SEEK_CUR);
+                               }
+                               break;
+                       }
+               }
+               return $stub;
+       }
+
+       private function readManifest() {
+               $current = ftell($this->fd);
+               $header = $this->readFormat("Vlen/Vnum/napi/Vflags", $this->fd, 14);
+               $alias = $this->readStringBinary($this->fd);
+               $meta = $this->readSerializedBinary($this->fd);
+               $entries = [];
+               for ($i = 0; $i < $header["num"]; ++$i) {
+                       $this->readEntry($entries);
+               }
+               $offset = ftell($this->fd);
+               if (($length = $offset - $current - 4) != $header["len"]) {
+                       throw new Exception("Manifest length read was '$length', expected '{$header["len"]}'");
+               }
+               return $header + compact("alias", "meta", "entries", "offset");
+       }
+
+       private function readEntry(array &$entries) {
+               if (!count($entries)) {
+                       $offset = 0;
+               } else {
+                       $last = end($entries);
+                       $offset = $last["offset"] + $last["csize"];
+               }
+               $file = $this->readStringBinary($this->fd);
+               if (!strlen($file)) {
+                       throw new Exception("Empty file name encountered at offset '$offset'");
+               }
+               $header = $this->readFormat("Vosize/Vstamp/Vcsize/Vcrc32/Vflags", $this->fd, 20);
+               $meta = $this->readSerializedBinary($this->fd);
+               $entries[$file] =  $header + compact("meta", "offset");
+       }
+
+       private function readSignature() {
+               fseek($this->fd, -8, SEEK_END);
+               $sig = $this->readFormat("Vflags/Z4magic", $this->fd, 8);
+               $end = ftell($this->fd);
+
+               if ($sig["magic"] !== "GBMB") {
+                       throw new Exception("Invalid signature magic value '{$sig["magic"]}");
+               }
+
+               switch ($sig["flags"]) {
+               case self::SIG_OPENSSL:
+                       fseek($this->fd, -12, SEEK_END);
+                       if (($hash = $this->readSingleFormat("V", $this->fd, 4))) {
+                               $offset = 4 + $hash;
+                               fseek($this->fd, -$offset, SEEK_CUR);
+                               $hash = $this->readVerified($this->fd, $hash);
+                               fseek($this->fd, 0, SEEK_SET);
+                               $valid = openssl_verify($this->readVerified($this->fd, $end - $offset - 8),
+                                       $hash, @file_get_contents($this->file.".pubkey")) === 1;
+                       }
+                       break;
+
+               case self::SIG_MD5:
+               case self::SIG_SHA1:
+               case self::SIG_SHA256:
+               case self::SIG_SHA512:
+                       $offset = 8 + self::$siglen[$sig["flags"]];
+                       fseek($this->fd, -$offset, SEEK_END);
+                       $hash = $this->readVerified($this->fd, self::$siglen[$sig["flags"]]);
+                       $algo = hash_init(self::$sigalg[$sig["flags"]]);
+                       fseek($this->fd, 0, SEEK_SET);
+                       hash_update_stream($algo, $this->fd, $end - $offset);
+                       $valid = hash_final($algo, true) === $hash;
+                       break;
+
+               default:
+                       throw new Exception("Invalid signature type '{$sig["flags"]}");
+               }
+
+               return $sig + compact("hash", "valid");
+       }
+}
+<?php
+
+namespace pharext\Cli\Args;
+
+use pharext\Cli\Args;
+
+class Help
+{
+       private $args;
+
+       function __construct($prog, Args $args) {
+               $this->prog = $prog;
+               $this->args = $args;
+       }
+
+       function __toString() {
+               $usage = "Usage:\n\n  \$ ";
+               $usage .= $this->prog;
+
+               list($flags, $required, $optional, $positional) = $this->listSpec();
+               if ($flags) {
+                       $usage .= $this->dumpFlags($flags);
+               }
+               if ($required) {
+                       $usage .= $this->dumpRequired($required);
+               }
+               if ($optional) {
+                       $usage .= $this->dumpOptional($optional);
+               }
+               if ($positional) {
+                       $usage .= $this->dumpPositional($positional);
+               }
+
+               $help = $this->dumpHelp($positional);
+
+               return $usage . "\n\n" . $help . "\n";
+       }
+
+       function listSpec() {
+               $flags = [];
+               $required = [];
+               $optional = [];
+               $positional = [];
+               foreach ($this->args->getSpec() as $spec) {
+                       if (is_numeric($spec[0])) {
+                               $positional[] = $spec;
+                       } elseif ($spec[3] & Args::REQUIRED) {
+                               $required[] = $spec;
+                       } elseif ($spec[3] & (Args::OPTARG|Args::REQARG)) {
+                               $optional[] = $spec;
+                       } else {
+                               $flags[] = $spec;
+                       }
+               }
+
+               return [$flags, $required, $optional, $positional]
+                       + compact("flags", "required", "optional", "positional");
+       }
+
+       function dumpFlags(array $flags) {
+               return sprintf(" [-%s]", implode("", array_column($flags, 0)));
+       }
+
+       function dumpRequired(array $required) {
+               $dump = "";
+               foreach ($required as $req) {
+                       $dump .= sprintf(" -%s <%s>", $req[0], $req[1]);
+               }
+               return $dump;
+       }
+
+       function dumpOptional(array $optional) {
+               $req = array_filter($optional, function($a) {
+                       return $a[3] & Args::REQARG;
+               });
+               $opt = array_filter($optional, function($a) {
+                       return $a[3] & Args::OPTARG;
+               });
+
+               $dump = "";
+               if ($req) {
+                       $dump .= sprintf(" [-%s <arg>]", implode("|-", array_column($req, 0)));
+               }
+               if ($opt) {
+                       $dump .= sprintf(" [-%s [<arg>]]", implode("|-", array_column($opt, 0)));
+               }
+               return $dump;
+       }
+
+       function dumpPositional(array $positional) {
+               $dump = " [--]";
+               foreach ($positional as $pos) {
+                       if ($pos[3] & Args::REQUIRED) {
+                               $dump .= sprintf(" <%s>", $pos[1]);
+                       } else {
+                               $dump .= sprintf(" [<%s>]", $pos[1]);
+                       }
+                       if ($pos[3] & Args::MULTI) {
+                               $dump .= sprintf(" [<%s>]...", $pos[1]);
+                       }
+               }
+               return $dump;
+       }
+
+       function calcMaxLen() {
+               $spc = $this->args->getSpec();
+               $max = max(array_map("strlen", array_column($spc, 1)));
+               $max += $max % 8 + 2;
+               return $max;
+       }
+
+       function dumpHelp() {
+               $max = $this->calcMaxLen();
+               $dump = "";
+               foreach ($this->args->getSpec() as $spec) {
+                       $dump .= "    ";
+                       if (is_numeric($spec[0])) {
+                               $dump .= sprintf("--   %s ", $spec[1]);
+                       } elseif (isset($spec[0])) {
+                               $dump .= sprintf("-%s|", $spec[0]);
+                       }
+                       if (!is_numeric($spec[0])) {
+                               $dump .= sprintf("--%s ", $spec[1]);
+                       }
+                       if ($spec[3] & Args::REQARG) {
+                               $dump .= "<arg>  ";
+                       } elseif ($spec[3] & Args::OPTARG) {
+                               $dump .= "[<arg>]";
+                       } else {
+                               $dump .= "       ";
+                       }
+
+                       $dump .= str_repeat(" ", $max-strlen($spec[1])+3*!isset($spec[0]));
+                       $dump .= $spec[2];
+
+                       if ($spec[3] & Args::REQUIRED) {
+                               $dump .= " (REQUIRED)";
+                       }
+                       if ($spec[3] & Args::MULTI) {
+                               $dump .= " (MULTIPLE)";
+                       }
+                       if (isset($spec[4])) {
+                               $dump .= sprintf(" [%s]", $spec[4]);
+                       }
+                       $dump .= "\n";
+               }
+               return $dump;
+       }
+}
+<?php
+
+namespace pharext\Cli;
+
+/**
+ * Command line arguments
+ */
+class Args implements \ArrayAccess
+{
+       /**
+        * Optional option
+        */
+       const OPTIONAL = 0x000;
+
+       /**
+        * Required Option
+        */
+       const REQUIRED = 0x001;
+
+       /**
+        * Only one value, even when used multiple times
+        */
+       const SINGLE = 0x000;
+
+       /**
+        * Aggregate an array, when used multiple times
+        */
+       const MULTI = 0x010;
+
+       /**
+        * Option takes no argument
+        */
+       const NOARG = 0x000;
+
+       /**
+        * Option requires an argument
+        */
+       const REQARG = 0x100;
+
+       /**
+        * Option takes an optional argument
+        */
+       const OPTARG = 0x200;
+
+       /**
+        * Option halts processing
+        */
+       const HALT = 0x10000000;
+
+       /**
+        * Original option spec
+        * @var array
+        */
+       private $orig = [];
+
+       /**
+        * Compiled spec
+        * @var array
+        */
+       private $spec = [];
+
+       /**
+        * Parsed args
+        * @var array
+        */
+       private $args = [];
+
+       /**
+        * Compile the original spec
+        * @param array|Traversable $spec
+        */
+       public function __construct($spec = null) {
+               if (is_array($spec) || $spec instanceof Traversable) {
+                       $this->compile($spec);
+               }
+
+       }
+
+       /**
+        * Compile the original spec
+        * @param array|Traversable $spec
+        * @return pharext\Cli\Args self
+        */
+       public function compile($spec) {
+               foreach ($spec as $arg) {
+                       if (isset($arg[0]) && is_numeric($arg[0])) {
+                               $arg[3] &= ~0xf00;
+                               $this->spec["--".$arg[0]] = $arg;
+                       } elseif (isset($arg[0])) {
+                               $this->spec["-".$arg[0]] = $arg;
+                               $this->spec["--".$arg[1]] = $arg;
+                       } else {
+                               $this->spec["--".$arg[1]] = $arg;
+                       }
+                       $this->orig[] = $arg;
+               }
+               return $this;
+       }
+
+       /**
+        * Get original spec
+        * @return array
+        */
+       public function getSpec() {
+               return $this->orig;
+       }
+
+       /**
+        * Get compiled spec
+        * @return array
+        */
+       public function getCompiledSpec() {
+               return $this->spec;
+       }
+
+       /**
+        * Parse command line arguments according to the compiled spec.
+        *
+        * The Generator yields any parsing errors.
+        * Parsing will stop when all arguments are processed or the first option
+        * flagged Cli\Args::HALT was encountered.
+        *
+        * @param int $argc
+        * @param array $argv
+        * @return Generator
+        */
+       public function parse($argc, array $argv) {
+               for ($f = false, $p = 0, $i = 0; $i < $argc; ++$i) {
+                       $o = $argv[$i];
+
+                       if ($o{0} === "-" && strlen($o) > 2 && $o{1} !== "-") {
+                               // multiple short opts, e.g. -vps
+                               $argc += strlen($o) - 2;
+                               array_splice($argv, $i, 1, array_map(function($s) {
+                                       return "-$s";
+                               }, str_split(substr($o, 1))));
+                               $o = $argv[$i];
+                       } elseif ($o{0} === "-" && strlen($o) > 2 && $o{1} === "-" && 0 < ($eq = strpos($o, "="))) {
+                               // long opt with argument, e.g. --foo=bar
+                               $argc++;
+                               array_splice($argv, $i, 1, [
+                                       substr($o, 0, $eq++),
+                                       substr($o, $eq)
+                               ]);
+                               $o = $argv[$i];
+                       } elseif ($o === "--") {
+                               // only positional args following
+                               $f = true;
+                               continue;
+                       }
+
+                       if ($f || !isset($this->spec[$o])) {
+                               if ($o{0} !== "-" && isset($this->spec["--$p"])) {
+                                       $this[$p] = $o;
+                                       if (!$this->optIsMulti($p)) {
+                                               ++$p;
+                                       }
+                               } else {
+                                       yield sprintf("Unknown option %s", $o);
+                               }
+                       } elseif (!$this->optAcceptsArg($o)) {
+                               $this[$o] = true;
+                       } elseif ($i+1 < $argc && !isset($this->spec[$argv[$i+1]])) {
+                               $this[$o] = $argv[++$i];
+                       } elseif ($this->optRequiresArg($o)) {
+                               yield sprintf("Option --%s requires an argument", $this->optLongName($o));
+                       } else {
+                               // OPTARG
+                               $this[$o] = $this->optDefaultArg($o);
+                       }
+
+                       if ($this->optHalts($o)) {
+                               return;
+                       }
+               }
+       }
+
+       /**
+        * Validate that all required options were given.
+        *
+        * The Generator yields any validation errors.
+        *
+        * @return Generator
+        */
+       public function validate() {
+               $required = array_filter($this->orig, function($spec) {
+                       return $spec[3] & self::REQUIRED;
+               });
+               foreach ($required as $req) {
+                       if ($req[3] & self::MULTI) {
+                               if (is_array($this[$req[0]])) {
+                                       continue;
+                               }
+                       } elseif (strlen($this[$req[0]])) {
+                               continue;
+                       }
+                       if (is_numeric($req[0])) {
+                               yield sprintf("Argument <%s> is required", $req[1]);
+                       } else {
+                               yield sprintf("Option --%s is required", $req[1]);
+                       }
+               }
+       }
+
+
+       public function toArray() {
+               $args = [];
+               foreach ($this->spec as $spec) {
+                       $opt = $this->opt($spec[1]);
+                       $args[$opt] = $this[$opt];
+               }
+               return $args;
+       }
+
+       /**
+        * Retreive the default argument of an option
+        * @param string $o
+        * @return mixed
+        */
+       private function optDefaultArg($o) {
+               $o = $this->opt($o);
+               if (isset($this->spec[$o][4])) {
+                       return $this->spec[$o][4];
+               }
+               return null;
+       }
+
+       /**
+        * Retrieve the help message of an option
+        * @param string $o
+        * @return string
+        */
+       private function optHelp($o) {
+               $o = $this->opt($o);
+               if (isset($this->spec[$o][2])) {
+                       return $this->spec[$o][2];
+               }
+               return "";
+       }
+
+       /**
+        * Retrieve option's flags
+        * @param string $o
+        * @return int
+        */
+       private function optFlags($o) {
+               $o = $this->opt($o);
+               if (isset($this->spec[$o])) {
+                       return $this->spec[$o][3];
+               }
+               return null;
+       }
+
+       /**
+        * Check whether an option is flagged for halting argument processing
+        * @param string $o
+        * @return boolean
+        */
+       private function optHalts($o) {
+               return $this->optFlags($o) & self::HALT;
+       }
+
+       /**
+        * Check whether an option needs an argument
+        * @param string $o
+        * @return boolean
+        */
+       private function optRequiresArg($o) {
+               return $this->optFlags($o) & self::REQARG;
+       }
+
+       /**
+        * Check wether an option accepts any argument
+        * @param string $o
+        * @return boolean
+        */
+       private function optAcceptsArg($o) {
+               return $this->optFlags($o) & 0xf00;
+       }
+
+       /**
+        * Check whether an option can be used more than once
+        * @param string $o
+        * @return boolean
+        */
+       private function optIsMulti($o) {
+               return $this->optFlags($o) & self::MULTI;
+       }
+
+       /**
+        * Retreive the long name of an option
+        * @param string $o
+        * @return string
+        */
+       private function optLongName($o) {
+               $o = $this->opt($o);
+               return is_numeric($this->spec[$o][0]) ? $this->spec[$o][0] : $this->spec[$o][1];
+       }
+
+       /**
+        * Retreive the short name of an option
+        * @param string $o
+        * @return string
+        */
+       private function optShortName($o) {
+               $o = $this->opt($o);
+               return is_numeric($this->spec[$o][0]) ? null : $this->spec[$o][0];
+       }
+
+       /**
+        * Retreive the canonical name (--long-name) of an option
+        * @param string $o
+        * @return string
+        */
+       private function opt($o) {
+               if (is_numeric($o)) {
+                       return "--$o";
+               }
+               if ($o{0} !== '-') {
+                       if (strlen($o) > 1) {
+                               $o = "-$o";
+                       }
+                       $o = "-$o";
+               }
+               return $o;
+       }
+
+       /**@+
+        * Implements ArrayAccess and virtual properties
+        */
+       function offsetExists($o) {
+               $o = $this->opt($o);
+               return isset($this->args[$o]);
+       }
+       function __isset($o) {
+               return $this->offsetExists($o);
+       }
+       function offsetGet($o) {
+               $o = $this->opt($o);
+               if (isset($this->args[$o])) {
+                       return $this->args[$o];
+               }
+               return $this->optDefaultArg($o);
+       }
+       function __get($o) {
+               return $this->offsetGet($o);
+       }
+       function offsetSet($o, $v) {
+               $osn = $this->optShortName($o);
+               $oln = $this->optLongName($o);
+               if ($this->optIsMulti($o)) {
+                       if (isset($osn)) {
+                               $this->args["-$osn"][] = $v;
+                       }
+                       $this->args["--$oln"][] = $v;
+               } else {
+                       if (isset($osn)) {
+                               $this->args["-$osn"] = $v;
+                       }
+                       $this->args["--$oln"] = $v;
+               }
+       }
+       function __set($o, $v) {
+               $this->offsetSet($o, $v);
+       }
+       function offsetUnset($o) {
+               unset($this->args["-".$this->optShortName($o)]);
+               unset($this->args["--".$this->optLongName($o)]);
+       }
+       function __unset($o) {
+               $this->offsetUnset($o);
+       }
+       /**@-*/
+}
+<?php
+
+namespace pharext\Cli;
+
+use pharext\Archive;
+
+use Phar;
+
+trait Command
+{
+       /**
+        * Command line arguments
+        * @var pharext\Cli\Args
+        */
+       private $args;
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::getArgs()
+        */
+       public function getArgs() {
+               return $this->args;
+       }
+
+       /**
+        * Retrieve metadata of the currently running phar
+        * @param string $key
+        * @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;
+       }
+
+       /**
+        * Output pharext vX.Y.Z header
+        */
+       public function header() {
+               if (!headers_sent()) {
+                       /* only display header, if we didn't generate any output yet */
+                       printf("%s\n\n", $this->metadata("header"));
+               }
+       }
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::debug()
+        */
+       public function debug($fmt) {
+               if ($this->args->verbose) {
+                       vprintf($fmt, array_slice(func_get_args(), 1));
+               }
+       }
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::info()
+        */
+       public function info($fmt) {
+               if (!$this->args->quiet) {
+                       vprintf($fmt, array_slice(func_get_args(), 1));
+               }
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::warn()
+        */
+       public function warn($fmt) {
+               if (!$this->args->quiet) {
+                       if (!isset($fmt)) {
+                               $fmt = "%s\n";
+                               $arg = error_get_last()["message"];
+                       } else {
+                               $arg = array_slice(func_get_args(), 1);
+                       }
+                       vfprintf(STDERR, "Warning: $fmt", $arg);
+               }
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::error()
+        */
+       public function error($fmt) {
+               if (!isset($fmt)) {
+                       $fmt = "%s\n";
+                       $arg = error_get_last()["message"];
+               } else {
+                       $arg = array_slice(func_get_args(), 1);
+               }
+               vfprintf(STDERR, "ERROR: $fmt", $arg);
+       }
+
+       /**
+        * Output command line help message
+        * @param string $prog
+        */
+       public function help($prog) {
+               print new Args\Help($prog, $this->args);
+       }
+       
+       /**
+        * Verbosity
+        * @return boolean
+        */
+       public function verbosity() {
+               if ($this->args->verbose) {
+                       return true;
+               } elseif ($this->args->quiet) {
+                       return false;
+               } else {
+                       return null;
+               }
+       }
+}
+<?php
+
+namespace pharext;
+
+/**
+ * Command interface
+ */
+interface Command
+{
+       /**
+        * Argument error
+        */
+       const EARGS = 1;
+       /**
+        * Build error
+        */
+       const EBUILD = 2;
+       /**
+        * Signature error
+        */
+       const ESIGN = 3;
+       /**
+        * Extract/unpack error
+        */
+       const EEXTRACT = 4;
+       /**
+        * Install error
+        */
+       const EINSTALL = 5;
+       
+       /**
+        * Retrieve command line arguments
+        * @return pharext\Cli\Args
+        */
+       public function getArgs();
+       
+       /**
+        * Print debug message
+        * @param string $fmt
+        * @param string ...$args
+        */
+       public function debug($fmt);
+       
+       /**
+        * Print info
+        * @param string $fmt
+        * @param string ...$args
+        */
+       public function info($fmt);
+       
+       /**
+        * Print warning
+        * @param string $fmt
+        * @param string ...$args
+        */
+       public function warn($fmt);
+
+       /**
+        * Print error
+        * @param string $fmt
+        * @param string ...$args
+        */
+       public function error($fmt);
+
+       /**
+        * Execute the command
+        * @param int $argc command line argument count
+        * @param array $argv command line argument list
+        */
+       public function run($argc, array $argv);
+}
+<?php
+
+namespace pharext;
+
+class Exception extends \Exception
+{
+       public function __construct($message = null, $code = 0, $previous = null) {
+               if (!isset($message)) {
+                       $last_error = error_get_last();
+                       $message = $last_error["message"];
+                       if (!$code) {
+                               $code = $last_error["type"];
+                       }
+               }
+               parent::__construct($message, $code, $previous);
+       }
+}
+<?php
+
+namespace pharext;
+
+/**
+ * Execute system command
+ */
+class ExecCmd
+{
+       /**
+        * Sudo command, if the cmd needs escalated privileges
+        * @var string
+        */
+       private $sudo;
+       
+       /**
+        * Executable of the cmd
+        * @var string
+        */
+       private $command;
+       
+       /**
+        * Passthrough cmd output
+        * @var bool
+        */
+       private $verbose;
+       
+       /**
+        * Output of cmd run
+        * @var string
+        */
+       private $output;
+       
+       /**
+        * Return code of cmd run
+        * @var int
+        */
+       private $status;
+
+       /**
+        * @param string $command
+        * @param bool verbose
+        */
+       public function __construct($command, $verbose = false) {
+               $this->command = $command;
+               $this->verbose = $verbose;
+       }
+       
+       /**
+        * (Re-)set sudo command
+        * @param string $sudo
+        */
+       public function setSu($sudo = false) {
+               $this->sudo = $sudo;
+       }
+       
+       /**
+        * Execute a program with escalated privileges handling interactive password prompt
+        * @param string $command
+        * @param bool $verbose
+        * @return int exit status
+        */
+       private function suExec($command, $verbose = null) {
+               if (!($proc = proc_open($command, [STDIN,["pipe","w"],["pipe","w"]], $pipes))) {
+                       $this->status = -1;
+                       throw new Exception("Failed to run {$command}");
+               }
+               
+               $stdout = $pipes[1];
+               $passwd = 0;
+               $checks = 10;
+
+               while (!feof($stdout)) {
+                       $R = [$stdout]; $W = []; $E = [];
+                       if (!stream_select($R, $W, $E, null)) {
+                               continue;
+                       }
+                       $data = fread($stdout, 0x1000);
+                       /* only check a few times */
+                       if ($passwd < $checks) {
+                               $passwd++;
+                               if (stristr($data, "password")) {
+                                       $passwd = $checks + 1;
+                                       printf("\n%s", $data);
+                                       continue;
+                               }
+                       } elseif ($passwd > $checks) {
+                               /* new line after pw entry */
+                               printf("\n");
+                               $passwd = $checks;
+                       }
+                       
+                       if ($verbose === null) {
+                               print $this->progress($data, 0);
+                       } else {
+                               if ($verbose) {
+                                       printf("%s", $data);
+                               }
+                               $this->output .= $data;
+                       }
+               }
+               if ($verbose === null) {
+                       $this->progress("", PHP_OUTPUT_HANDLER_FINAL);
+               }
+               return $this->status = proc_close($proc);
+       }
+
+       /**
+        * Output handler that displays some progress while soaking output
+        * @param string $string
+        * @param int $flags
+        * @return string
+        */
+       private function progress($string, $flags) {
+               static $counter = 0;
+               static $symbols = ["\\","|","/","-"];
+
+               $this->output .= $string;
+               
+               if (false !== strpos($string, "\n")) {
+                       ++$counter;
+               }
+
+               return $flags & PHP_OUTPUT_HANDLER_FINAL
+                       ? "   \r"
+                       : sprintf("  %s\r", $symbols[$counter % 4]);
+       }
+
+       /**
+        * Run the command
+        * @param array $args
+        * @return \pharext\ExecCmd self
+        * @throws \pharext\Exception
+        */
+       public function run(array $args = null) {
+               $exec = escapeshellcmd($this->command);
+               if ($args) {
+                       $exec .= " ". implode(" ", array_map("escapeshellarg", (array) $args));
+               }
+               
+               if ($this->sudo) {
+                       $this->suExec(sprintf($this->sudo." 2>&1", $exec), $this->verbose);
+               } elseif ($this->verbose) {
+                       ob_start(function($s) {
+                               $this->output .= $s;
+                               return $s;
+                       }, 1);
+                       passthru($exec, $this->status);
+                       ob_end_flush();
+               } elseif ($this->verbose !== false /* !quiet */) {
+                       ob_start([$this, "progress"], 1);
+                       passthru($exec . " 2>&1", $this->status);
+                       ob_end_flush();
+               } else {
+                       exec($exec ." 2>&1", $output, $this->status);
+                       $this->output = implode("\n", $output);
+               }
+               
+               if ($this->status) {
+                       throw new Exception("Command {$exec} failed ({$this->status})");
+               }
+
+               return $this;
+       }
+       
+       /**
+        * Retrieve exit code of cmd run
+        * @return int
+        */
+       public function getStatus() {
+               return $this->status;
+       }
+       
+       /**
+        * Retrieve output of cmd run
+        * @return string
+        */
+       public function getOutput() {
+               return $this->output;
+       }
+}
+<?php
+
+namespace pharext;
+
+use Phar;
+use SplObjectStorage;
+
+/**
+ * The extension install command executed by the extension phar
+ */
+class Installer implements Command
+{
+       use Cli\Command;
+
+       /**
+        * Cleanups
+        * @var array
+        */
+       private $cleanup = [];
+
+       /**
+        * Create the command
+        */
+       public function __construct() {
+               $this->args = new Cli\Args([
+                       ["h", "help", "Display help",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       ["v", "verbose", "More output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["q", "quiet", "Less output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["p", "prefix", "PHP installation prefix if phpize is not in \$PATH, e.g. /opt/php7",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["n", "common-name", "PHP common program name, e.g. php5 or zts-php",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG,
+                               "php"],
+                       ["c", "configure", "Additional extension configure flags, e.g. -c --with-flag",
+                               Cli\Args::OPTIONAL|Cli\Args::MULTI|Cli\Args::REQARG],
+                       ["s", "sudo", "Installation might need increased privileges",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::OPTARG,
+                               "sudo -S %s"],
+                       ["i", "ini", "Activate in this php.ini instead of loaded default php.ini",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       [null, "signature", "Show package signature",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "license", "Show package license",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "name", "Show package name",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "date", "Show package release date",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "release", "Show package release version",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "version", "Show pharext version",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+               ]);
+       }
+
+       /**
+        * Perform cleaniup
+        */
+       function __destruct() {
+               foreach ($this->cleanup as $cleanup) {
+                       $cleanup->run();
+               }
+       }
+
+       private function extract($phar) {
+               $temp = (new Task\Extract($phar))->run($this->verbosity());
+               $this->cleanup[] = new Task\Cleanup($temp);
+               return $temp;
+       }
+
+       private function hooks(SplObjectStorage $phars) {
+               $hook = [];
+               foreach ($phars as $phar) {
+                       if (isset($phar["pharext_package.php"])) {
+                               $sdir = include $phar["pharext_package.php"];
+                               if ($sdir instanceof SourceDir) {
+                                       $this->args->compile($sdir->getArgs());
+                                       $hook[] = $sdir;
+                               }
+                       }
+               }
+               return $hook;
+       }
+
+       private function load() {
+               $list = new SplObjectStorage();
+               $phar = extension_loaded("Phar")
+                       ? new Phar(Phar::running(false))
+                       : new Archive(PHAREXT_PHAR);
+               $temp = $this->extract($phar);
+
+               foreach ($phar as $entry) {
+                       $dep_file = $entry->getBaseName();
+                       if (fnmatch("*.ext.phar*", $dep_file)) {
+                               $dep_phar = extension_loaded("Phar")
+                                       ? new Phar("$temp/$dep_file")
+                                       : new Archive("$temp/$dep_file");
+                               $list[$dep_phar] = $this->extract($dep_phar);
+                       }
+               }
+
+               /* the actual ext.phar at last */
+               $list[$phar] = $temp;
+               return $list;
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::run()
+        */
+       public function run($argc, array $argv) {
+               try {
+                       /* load the phar(s) */
+                       $list = $this->load();
+                       /* installer hooks */
+                       $hook = $this->hooks($list);
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EEXTRACT);
+               }
+
+               /* standard arg stuff */
+               $errs = [];
+               $prog = array_shift($argv);
+               foreach ($this->args->parse(--$argc, $argv) as $error) {
+                       $errs[] = $error;
+               }
+
+               if ($this->args["help"]) {
+                       $this->header();
+                       $this->help($prog);
+                       exit;
+               }
+               try {
+                       foreach (["signature", "name", "date", "license", "release", "version"] as $opt) {
+                               if ($this->args[$opt]) {
+                                       printf("%s\n", $this->metadata($opt));
+                                       exit;
+                               }
+                       }
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EARGS);
+               }
+
+               foreach ($this->args->validate() as $error) {
+                       $errs[] = $error;
+               }
+
+               if ($errs) {
+                       if (!$this->args["quiet"]) {
+                               $this->header();
+                       }
+                       foreach ($errs as $err) {
+                               $this->error("%s\n", $err);
+                       }
+                       if (!$this->args["quiet"]) {
+                               $this->help($prog);
+                       }
+                       exit(self::EARGS);
+               }
+
+               try {
+                       /* post process hooks */
+                       foreach ($hook as $sdir) {
+                               $sdir->setArgs($this->args);
+                       }
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EARGS);
+               }
+
+               /* install packages */
+               try {
+                       foreach ($list as $phar) {
+                               $this->info("Installing %s ...\n", basename($phar->getPath()));
+                               $this->install($list[$phar]);
+                               $this->activate($list[$phar]);
+                               $this->info("Successfully installed %s!\n", basename($phar->getPath()));
+                       }
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EINSTALL);
+               }
+       }
+
+       /**
+        * Phpize + trinity
+        */
+       private function install($temp) {
+               // phpize
+               $phpize = new Task\Phpize($temp, $this->args->prefix, $this->args->{"common-name"});
+               $phpize->run($this->verbosity());
+
+               // configure
+               $configure = new Task\Configure($temp, $this->args->configure, $this->args->prefix, $this->args->{"common-name"});
+               $configure->run($this->verbosity());
+
+               // make
+               $make = new Task\Make($temp);
+               $make->run($this->verbosity());
+
+               // install
+               $sudo = isset($this->args->sudo) ? $this->args->sudo : null;
+               $install = new Task\Make($temp, ["install"], $sudo);
+               $install->run($this->verbosity());
+       }
+
+       private function activate($temp) {
+               if ($this->args->ini) {
+                       $files = [$this->args->ini];
+               } else {
+                       $files = array_filter(array_map("trim", explode(",", php_ini_scanned_files())));
+                       $files[] = php_ini_loaded_file();
+               }
+
+               $sudo = isset($this->args->sudo) ? $this->args->sudo : null;
+               $type = $this->metadata("type") ?: "extension";
+
+               $activate = new Task\Activate($temp, $files, $type, $this->args->prefix, $this->args{"common-name"}, $sudo);
+               if (!$activate->run($this->verbosity())) {
+                       $this->info("Extension already activated ...\n");
+               }
+       }
+}
+<?php
+
+namespace pharext;
+
+trait License
+{
+       function findLicense($dir, $file = null) {
+               if (isset($file)) {
+                       return realpath("$dir/$file");
+               }
+
+               $names = [];
+               foreach (["{,UN}LICEN{S,C}{E,ING}", "COPY{,ING,RIGHT}"] as $name) {
+                       $names[] = $this->mergeLicensePattern($name, strtolower($name));
+               }
+               $exts = [];
+               foreach (["t{,e}xt", "rst", "asc{,i,ii}", "m{,ark}d{,own}", "htm{,l}"] as $ext) {
+                       $exts[] = $this->mergeLicensePattern(strtoupper($ext), $ext);
+               }
+               
+               $pattern = "{". implode(",", $names) ."}{,.{". implode(",", $exts) ."}}";
+
+               if (($glob = glob("$dir/$pattern", GLOB_BRACE))) {
+                       return current($glob);
+               }
+       }
+
+       private function mergeLicensePattern($upper, $lower) {
+               $pattern = "";
+               $length = strlen($upper);
+               for ($i = 0; $i < $length; ++$i) {
+                       if ($lower{$i} === $upper{$i}) {
+                               $pattern .= $upper{$i};
+                       } else {
+                               $pattern .= "[" . $upper{$i} . $lower{$i} . "]";
+                       }
+               }
+               return $pattern;
+       }
+
+       public function readLicense($file) {
+               $text = file_get_contents($file);
+               switch (strtolower(pathinfo($file, PATHINFO_EXTENSION))) {
+                       case "htm":
+                       case "html":
+                               $text = strip_tags($text);
+                               break;
+               }
+               return $text;
+       }
+}
+<?php
+
+namespace pharext;
+
+class Metadata
+{
+       static function version() {
+               return "4.1.1";
+       }
+
+       static function header() {
+               return sprintf("pharext v%s (c) Michael Wallner <mike@php.net>", self::version());
+       }
+
+       static function date() {
+               return gmdate("Y-m-d");
+       }
+
+       static function all() {
+               return [
+                       "version" => self::version(),
+                       "header" => self::header(),
+                       "date" => self::date(),
+               ];
+       }
+}
+<?php
+
+namespace pharext\Openssl;
+
+use pharext\Exception;
+
+class PrivateKey
+{
+       /**
+        * Private key
+        * @var string
+        */
+       private $key;
+       
+       /**
+        * Public key
+        * @var string
+        */
+       private $pub;
+
+       /**
+        * Read a private key
+        * @param string $file
+        * @param string $password
+        * @throws \pharext\Exception
+        */
+       function __construct($file, $password) {
+               /* there appears to be a bug with refcount handling of this
+                * resource; when the resource is stored as property, it cannot be
+                * "coerced to a private key" on openssl_sign() later in another method
+                */
+               $key = openssl_pkey_get_private("file://$file", $password);
+               if (!is_resource($key)) {
+                       throw new Exception("Could not load private key");
+               }
+               openssl_pkey_export($key, $this->key);
+               $this->pub = openssl_pkey_get_details($key)["key"];
+       }
+
+       /**
+        * Sign the PHAR
+        * @param \Phar $package
+        */
+       function sign(\Phar $package) {
+               $package->setSignatureAlgorithm(\Phar::OPENSSL, $this->key);
+       }
+
+       /**
+        * Export the public key to a file
+        * @param string $file
+        * @throws \pharext\Exception
+        */
+       function exportPublicKey($file) {
+               if (!file_put_contents("$file.tmp", $this->pub) || !rename("$file.tmp", $file)) {
+                       throw new Exception;
+               }
+       }
+}
+<?php
+
+namespace pharext;
+
+use Phar;
+use pharext\Exception;
+
+/**
+ * The extension packaging command executed by bin/pharext
+ */
+class Packager implements Command
+{
+       use Cli\Command;
+       
+       /**
+        * Extension source directory
+        * @var pharext\SourceDir
+        */
+       private $source;
+       
+       /**
+        * Cleanups
+        * @var array
+        */
+       private $cleanup = [];
+       
+       /**
+        * Create the command
+        */
+       public function __construct() {
+               $this->args = new Cli\Args([
+                       ["h", "help", "Display this help",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       ["v", "verbose", "More output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["q", "quiet", "Less output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["n", "name", "Extension name",
+                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["r", "release", "Extension release version",
+                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["s", "source", "Extension source directory",
+                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["g", "git", "Use `git ls-tree` to determine file list",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["b", "branch", "Checkout this tag/branch",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["p", "pecl", "Use PECL package.xml to determine file list, name and release",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["d", "dest", "Destination directory",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG,
+                               "."],
+                       ["z", "gzip", "Create additional PHAR compressed with gzip",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["Z", "bzip", "Create additional PHAR compressed with bzip",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["S", "sign", "Sign the PHAR with a private key",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["E", "zend", "Mark as Zend Extension",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       [null, "signature", "Show pharext signature",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "license", "Show pharext license",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "version", "Show pharext version",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+               ]);
+       }
+       
+       /**
+        * Perform cleaniup
+        */
+       function __destruct() {
+               foreach ($this->cleanup as $cleanup) {
+                       $cleanup->run();
+               }
+       }
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::run()
+        */
+       public function run($argc, array $argv) {
+               $errs = [];
+               $prog = array_shift($argv);
+               foreach ($this->args->parse(--$argc, $argv) as $error) {
+                       $errs[] = $error;
+               }
+               
+               if ($this->args["help"]) {
+                       $this->header();
+                       $this->help($prog);
+                       exit;
+               }
+               try {
+                       foreach (["signature", "license", "version"] as $opt) {
+                               if ($this->args[$opt]) {
+                                       printf("%s\n", $this->metadata($opt));
+                                       exit;
+                               }
+                       }
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EARGS);
+               }
+
+               try {
+                       /* source needs to be evaluated before Cli\Args validation, 
+                        * so e.g. name and version can be overriden and Cli\Args 
+                        * does not complain about missing arguments
+                        */
+                       $this->loadSource();
+               } catch (\Exception $e) {
+                       $errs[] = $e->getMessage();
+               }
+               
+               foreach ($this->args->validate() as $error) {
+                       $errs[] = $error;
+               }
+               
+               if ($errs) {
+                       if (!$this->args["quiet"]) {
+                               $this->header();
+                       }
+                       foreach ($errs as $err) {
+                               $this->error("%s\n", $err);
+                       }
+                       printf("\n");
+                       if (!$this->args["quiet"]) {
+                               $this->help($prog);
+                       }
+                       exit(self::EARGS);
+               }
+               
+               $this->createPackage();
+       }
+       
+       /**
+        * Download remote source
+        * @param string $source
+        * @return string local source
+        */
+       private function download($source) {
+               if ($this->args->git) {
+                       $task = new Task\GitClone($source, $this->args->branch);
+               } else {
+                       /* print newline only once */
+                       $done = false;
+                       $task = new Task\StreamFetch($source, function($bytes_pct) use(&$done) {
+                               if (!$done) {
+                                       $this->info(" %3d%% [%s>%s] \r",
+                                               floor($bytes_pct*100),
+                                               str_repeat("=", round(50*$bytes_pct)),
+                                               str_repeat(" ", round(50*(1-$bytes_pct)))
+                                       );
+                                       if ($bytes_pct == 1) {
+                                               $done = true;
+                                               $this->info("\n");
+                                       }
+                               }
+                       });
+               }
+               $local = $task->run($this->verbosity());
+
+               $this->cleanup[] = new Task\Cleanup($local);
+               return $local;
+       }
+
+       /**
+        * Extract local archive
+        * @param stirng $source
+        * @return string extracted directory
+        */
+       private function extract($source) {
+               try {
+                       $task = new Task\Extract($source);
+                       $dest = $task->run($this->verbosity());
+               } catch (\Exception $e) {
+                       if (false === strpos($e->getMessage(), "checksum mismatch")) {
+                               throw $e;
+                       }
+                       $dest = (new Task\PaxFixup($source))->run($this->verbosity());
+               }
+               
+               $this->cleanup[] = new Task\Cleanup($dest);
+               return $dest;
+       }
+
+       /**
+        * Localize a possibly remote source
+        * @param string $source
+        * @return string local source directory
+        */
+       private function localize($source) {
+               if (!stream_is_local($source) || ($this->args->git && isset($this->args->branch))) {
+                       $source = $this->download($source);
+                       $this->cleanup[] = new Task\Cleanup($source);
+               }
+               $source = realpath($source);
+               if (!is_dir($source)) {
+                       $source = $this->extract($source);
+                       $this->cleanup[] = new Task\Cleanup($source);
+                       
+                       if (!$this->args->git) {
+                               $source = (new Task\PeclFixup($source))->run($this->verbosity());
+                       }
+               }
+               return $source;
+       }
+
+       /**
+        * Load the source dir
+        * @throws \pharext\Exception
+        */
+       private function loadSource(){
+               if ($this->args["source"]) {
+                       $source = $this->localize($this->args["source"]);
+
+                       if ($this->args["pecl"]) {
+                               $this->source = new SourceDir\Pecl($source);
+                       } elseif ($this->args["git"]) {
+                               $this->source = new SourceDir\Git($source);
+                       } elseif (is_file("$source/pharext_package.php")) {
+                               $this->source = include "$source/pharext_package.php";
+                       } else {
+                               $this->source = new SourceDir\Basic($source);
+                       }
+
+                       if (!$this->source instanceof SourceDir) {
+                               throw new Exception("Unknown source dir $source");
+                       }
+
+                       foreach ($this->source->getPackageInfo() as $key => $val) {
+                               $this->args->$key = $val;
+                       }
+               }
+       }
+
+       /**
+        * Creates the extension phar
+        */
+       private function createPackage() {
+               try {
+                       $meta = array_merge(Metadata::all(), [
+                               "name" => $this->args->name,
+                               "release" => $this->args->release,
+                               "license" => $this->source->getLicense(),
+                               "type" => $this->args->zend ? "zend_extension" : "extension",
+                       ]);
+                       $file = (new Task\PharBuild($this->source, __DIR__."/../pharext_installer.php", $meta))->run($this->verbosity());
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EBUILD);
+               }
+
+               try {
+                       if ($this->args->sign) {
+                               $this->info("Using private key to sign phar ...\n");
+                               $pass = (new Task\Askpass)->run($this->verbosity());
+                               $sign = new Task\PharSign($file, $this->args->sign, $pass);
+                               $pkey = $sign->run($this->verbosity());
+                       }
+
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::ESIGN);
+               }
+
+               if ($this->args->gzip) {
+                       try {
+                               $gzip = (new Task\PharCompress($file, Phar::GZ))->run();
+                               $move = new Task\PharRename($gzip, $this->args->dest, $this->args->name ."-". $this->args->release);
+                               $name = $move->run($this->verbosity());
+
+                               $this->info("Created gzipped phar %s\n", $name);
+
+                               if ($this->args->sign) {
+                                       $sign = new Task\PharSign($name, $this->args->sign, $pass);
+                                       $sign->run($this->verbosity())->exportPublicKey($name.".pubkey");
+                               }
+
+                       } catch (\Exception $e) {
+                               $this->warn("%s\n", $e->getMessage());
+                       }
+               }
+               
+               if ($this->args->bzip) {
+                       try {
+                               $bzip = (new Task\PharCompress($file, Phar::BZ2))->run();
+                               $move = new Task\PharRename($bzip, $this->args->dest, $this->args->name ."-". $this->args->release);
+                               $name = $move->run($this->verbosity());
+
+                               $this->info("Created bzipped phar %s\n", $name);
+
+                               if ($this->args->sign) {
+                                       $sign = new Task\PharSign($name, $this->args->sign, $pass);
+                                       $sign->run($this->verbosity())->exportPublicKey($name.".pubkey");
+                               }
+
+                       } catch (\Exception $e) {
+                               $this->warn("%s\n", $e->getMessage());
+                       }
+               }
+
+               try {
+                       $move = new Task\PharRename($file, $this->args->dest, $this->args->name ."-". $this->args->release);
+                       $name = $move->run($this->verbosity());
+
+                       $this->info("Created executable phar %s\n", $name);
+
+                       if (isset($pkey)) {
+                               $pkey->exportPublicKey($name.".pubkey");
+                       }
+
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EBUILD);
+               }
+       }
+}
+<?php
+
+namespace pharext\SourceDir;
+
+use pharext\Cli\Args;
+use pharext\License;
+use pharext\SourceDir;
+
+use FilesystemIterator;
+use IteratorAggregate;
+use RecursiveCallbackFilterIterator;
+use RecursiveDirectoryIterator;
+use RecursiveIteratorIterator;
+
+
+class Basic implements IteratorAggregate, SourceDir
+{
+       use License;
+       
+       private $path;
+       
+       public function __construct($path) {
+               $this->path = $path;
+       }
+       
+       public function getBaseDir() {
+               return $this->path;
+       }
+       
+       public function getPackageInfo() {
+               return [];
+       }
+       
+       public function getLicense() {
+               if (($file = $this->findLicense($this->getBaseDir()))) {
+                       return $this->readLicense($file);
+               }
+               return "UNKNOWN";
+       }
+
+       public function getArgs() {
+               return [];
+       }
+       
+       public function setArgs(Args $args) {
+       }
+
+       public function filter($current, $key, $iterator) {
+               $sub = $current->getSubPath();
+               if ($sub === ".git" || $sub === ".hg" || $sub === ".svn") {
+                       return false;
+               }
+               return true;
+       }
+       
+       public function getIterator() {
+               $rdi = new RecursiveDirectoryIterator($this->path,
+                               FilesystemIterator::CURRENT_AS_SELF | // needed for 5.5
+                               FilesystemIterator::KEY_AS_PATHNAME |
+                               FilesystemIterator::SKIP_DOTS);
+               $rci = new RecursiveCallbackFilterIterator($rdi, [$this, "filter"]);
+               $rii = new RecursiveIteratorIterator($rci);
+               foreach ($rii as $path => $child) {
+                       if (!$child->isDir()) {
+                               yield realpath($path);
+                       }
+               }
+       }
+}
+<?php
+
+namespace pharext\SourceDir;
+
+use pharext\Cli\Args;
+use pharext\License;
+use pharext\SourceDir;
+
+/**
+ * Extension source directory which is a git repo
+ */
+class Git implements \IteratorAggregate, SourceDir
+{
+       use License;
+       
+       /**
+        * Base directory
+        * @var string
+        */
+       private $path;
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::__construct()
+        */
+       public function __construct($path) {
+               $this->path = $path;
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::getBaseDir()
+        */
+       public function getBaseDir() {
+               return $this->path;
+       }
+
+       /**
+        * @inheritdoc
+        * @return array
+        */
+       public function getPackageInfo() {
+               return [];
+       }
+
+       /**
+        * @inheritdoc
+        * @return string
+        */
+       public function getLicense() {
+               if (($file = $this->findLicense($this->getBaseDir()))) {
+                       return $this->readLicense($file);
+               }
+               return "UNKNOWN";
+       }
+
+       /**
+        * @inheritdoc
+        * @return array
+        */
+       public function getArgs() {
+               return [];
+       }
+
+       /**
+        * @inheritdoc
+        */
+       public function setArgs(Args $args) {
+       }
+
+       /**
+        * Generate a list of files by `git ls-files`
+        * @return Generator
+        */
+       private function generateFiles() {
+               $pwd = getcwd();
+               chdir($this->path);
+               if (($pipe = popen("git ls-tree -r --name-only HEAD", "r"))) {
+                       $path = realpath($this->path);
+                       while (!feof($pipe)) {
+                               if (strlen($file = trim(fgets($pipe)))) {
+                                       /* there may be symlinks, so no realpath here */
+                                       yield "$path/$file";
+                               }
+                       }
+                       pclose($pipe);
+               }
+               chdir($pwd);
+       }
+
+       /**
+        * Implements IteratorAggregate
+        * @see IteratorAggregate::getIterator()
+        */
+       public function getIterator() {
+               return $this->generateFiles();
+       }
+}
+<?php
+
+namespace pharext\SourceDir;
+
+use pharext\Cli\Args;
+use pharext\Exception;
+use pharext\SourceDir;
+use pharext\License;
+
+/**
+ * A PECL extension source directory containing a v2 package.xml
+ */
+class Pecl implements \IteratorAggregate, SourceDir
+{
+       use License;
+       
+       /**
+        * The package.xml
+        * @var SimpleXmlElement
+        */
+       private $sxe;
+       
+       /**
+        * The base directory
+        * @var string
+        */
+       private $path;
+
+       /**
+        * The package.xml
+        * @var string
+        */
+       private $file;
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::__construct()
+        */
+       public function __construct($path) {
+               if (is_file("$path/package2.xml")) {
+                       $sxe = simplexml_load_file($this->file = "$path/package2.xml");
+               } elseif (is_file("$path/package.xml")) {
+                       $sxe = simplexml_load_file($this->file = "$path/package.xml");
+               } else {
+                       throw new Exception("Missing package.xml in $path");
+               }
+               
+               $sxe->registerXPathNamespace("pecl", $sxe->getDocNamespaces()[""]);
+               
+               $this->sxe = $sxe;
+               $this->path = realpath($path);
+       }
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::getBaseDir()
+        */
+       public function getBaseDir() {
+               return $this->path;
+       }
+
+       /**
+        * Retrieve gathered package info
+        * @return Generator
+        */
+       public function getPackageInfo() {
+               if (($name = $this->sxe->xpath("/pecl:package/pecl:name"))) {
+                       yield "name" => (string) $name[0];
+               }
+               if (($release = $this->sxe->xpath("/pecl:package/pecl:version/pecl:release"))) {
+                       yield "release" => (string) $release[0];
+               }
+               if ($this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease")) {
+                       yield "zend" => true;
+               }
+       }
+
+       /**
+        * @inheritdoc
+        * @return string
+        */
+       public function getLicense() {
+               if (($license = $this->sxe->xpath("/pecl:package/pecl:license"))) {
+                       if (($file = $this->findLicense($this->getBaseDir(), $license[0]["filesource"]))) {
+                               return $this->readLicense($file);
+                       }
+               }
+               if (($file = $this->findLicense($this->getBaseDir()))) {
+                       return $this->readLicense($file);
+               }
+               if ($license) {
+                       return $license[0] ." ". $license[0]["uri"];
+               }
+               return "UNKNOWN";
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::getArgs()
+        */
+       public function getArgs() {
+               $configure = $this->sxe->xpath("/pecl:package/pecl:extsrcrelease/pecl:configureoption");
+               foreach ($configure as $cfg) {
+                       yield [null, $cfg["name"], ucfirst($cfg["prompt"]), Args::OPTARG,
+                               strlen($cfg["default"]) ? $cfg["default"] : null];
+               }
+               $configure = $this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease/pecl:configureoption");
+               foreach ($configure as $cfg) {
+                       yield [null, $cfg["name"], ucfirst($cfg["prompt"]), Args::OPTARG,
+                               strlen($cfg["default"]) ? $cfg["default"] : null];
+               }
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::setArgs()
+        */
+       public function setArgs(Args $args) {
+               $configure = $this->sxe->xpath("/pecl:package/pecl:extsrcrelease/pecl:configureoption");
+               foreach ($configure as $cfg) {
+                       if (isset($args[$cfg["name"]])) {
+                               $args->configure = "--{$cfg["name"]}={$args[$cfg["name"]]}";
+                       }
+               }
+               $configure = $this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease/pecl:configureoption");
+               foreach ($configure as $cfg) {
+                       if (isset($args[$cfg["name"]])) {
+                               $args->configure = "--{$cfg["name"]}={$args[$cfg["name"]]}";
+                       }
+               }
+       }
+       
+       /**
+        * Compute the path of a file by parent dir nodes
+        * @param \SimpleXMLElement $ele
+        * @return string
+        */
+       private function dirOf($ele) {
+               $path = "";
+               while (($ele = current($ele->xpath(".."))) && $ele->getName() == "dir") {
+                       $path = trim($ele["name"], "/") ."/". $path ;
+               }
+               return trim($path, "/");
+       }
+
+       /**
+        * Generate a list of files from the package.xml
+        * @return Generator
+        */
+       private function generateFiles() {
+               /* hook  */
+               $temp = tmpfile();
+               fprintf($temp, "<?php\nreturn new %s(__DIR__);\n", get_class($this));
+               rewind($temp);
+               yield "pharext_package.php" => $temp;
+
+               /* deps */
+               $dependencies = $this->sxe->xpath("/pecl:package/pecl:dependencies/pecl:required/pecl:package");
+               foreach ($dependencies as $key => $dep) {
+                       if (($glob = glob("{$this->path}/{$dep->name}-*.ext.phar*"))) {
+                               usort($glob, function($a, $b) {
+                                       return version_compare(
+                                               substr($a, strpos(".ext.phar", $a)),
+                                               substr($b, strpos(".ext.phar", $b))
+                                       );
+                               });
+                               yield end($glob);
+                       }
+               }
+
+               /* files */
+               yield realpath($this->file);
+               foreach ($this->sxe->xpath("//pecl:file") as $file) {
+                       yield realpath($this->path ."/". $this->dirOf($file) ."/". $file["name"]);
+               }
+       }
+       
+       /**
+        * Implements IteratorAggregate
+        * @see IteratorAggregate::getIterator()
+        */
+       public function getIterator() {
+               return $this->generateFiles();
+       }
+}
+<?php
+
+namespace pharext;
+
+/**
+ * Source directory interface, which should yield file names to package on traversal
+ */
+interface SourceDir extends \Traversable
+{
+       /**
+        * Retrieve the base directory
+        * @return string
+        */
+       public function getBaseDir();
+
+       /**
+        * Retrieve gathered package info
+        * @return array|Traversable
+        */
+       public function getPackageInfo();
+
+       /**
+        * Retrieve the full text license
+        * @return string
+        */
+       public function getLicense();
+
+       /**
+        * Provide installer command line args
+        * @return array|Traversable
+        */
+       public function getArgs();
+
+       /**
+        * Process installer command line args
+        * @param \pharext\Cli\Args $args
+        */
+       public function setArgs(Cli\Args $args);
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\ExecCmd;
+use pharext\Task;
+use pharext\Tempfile;
+
+/**
+ * PHP INI activation
+ */
+class Activate implements Task
+{
+       /**
+        * @var string
+        */
+       private $cwd;
+
+       /**
+        * @var array
+        */
+       private $inis;
+
+       /**
+        * @var string
+        */
+       private $type;
+
+       /**
+        * @var string
+        */
+       private $php_config;
+       
+       /**
+        * @var string
+        */
+       private $sudo;
+
+       /**
+        * @param string $cwd working directory
+        * @param array $inis custom INI or list of loaded/scanned INI files
+        * @param string $type extension or zend_extension
+        * @param string $prefix install prefix, e.g. /usr/local
+        * @param string $common_name PHP programs common name, e.g. php5
+        * @param string $sudo sudo command
+        * @throws \pharext\Exception
+        */
+       public function __construct($cwd, array $inis, $type = "extension", $prefix = null, $common_name = "php", $sudo = null) {
+               $this->cwd = $cwd;
+               $this->type = $type;
+               $this->sudo = $sudo;
+               if (!$this->inis = $inis) {
+                       throw new Exception("No PHP INIs given");
+               }
+               $cmd = $common_name . "-config";
+               if (isset($prefix)) {
+                       $cmd = $prefix . "/bin/" . $cmd;
+               }
+               $this->php_config = $cmd;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return boolean false, if extension was already activated
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Running INI activation ...\n");
+               }
+               $extension = basename(current(glob("{$this->cwd}/modules/*.so")));
+
+               if ($this->type === "zend_extension") {
+                       $pattern = preg_quote((new ExecCmd($this->php_config))->run(["--extension-dir"])->getOutput() . "/$extension", "/");
+               } else {
+                       $pattern = preg_quote($extension, "/");
+               }
+
+               foreach ($this->inis as $file) {
+                       if ($verbose) {
+                               printf("Checking %s ...\n", $file);
+                       }
+                       if (!file_exists($file)) {
+                               throw new Exception(sprintf("INI file '%s' does not exist", $file));
+                       }
+                       $temp = new Tempfile("phpini");
+                       foreach (file($file) as $line) {
+                               if (preg_match("/^\s*{$this->type}\s*=\s*[\"']?{$pattern}[\"']?\s*(;.*)?\$/", $line)) {
+                                       return false;
+                               }
+                               fwrite($temp->getStream(), $line);
+                       }
+               }
+
+               /* not found; append to last processed file, which is the main by default */
+               if ($verbose) {
+                       printf("Activating in %s ...\n", $file);
+               }
+               fprintf($temp->getStream(), $this->type . "=%s\n", $extension);
+               $temp->closeStream();
+
+               $path = $temp->getPathname();
+               $stat = stat($file);
+
+               // owner transfer
+               $ugid = sprintf("%d:%d", $stat["uid"], $stat["gid"]);
+               $cmd = new ExecCmd("chown", $verbose);
+               if (isset($this->sudo)) {
+                       $cmd->setSu($this->sudo);
+               }
+               $cmd->run([$ugid, $path]);
+
+               // permission transfer
+               $perm = decoct($stat["mode"] & 0777);
+               $cmd = new ExecCmd("chmod", $verbose);
+               if (isset($this->sudo)) {
+                       $cmd->setSu($this->sudo);
+               }
+               $cmd->run([$perm, $path]);
+
+               // rename
+               $cmd = new ExecCmd("mv", $verbose);
+               if (isset($this->sudo)) {
+                       $cmd->setSu($this->sudo);
+               }
+               $cmd->run([$path, $file]);
+               
+               if ($verbose) {
+                       printf("Replaced %s ...\n", $file);
+               }
+
+               return true;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Task;
+
+/**
+ * Ask password on console
+ */
+class Askpass implements Task
+{
+       /**
+        * @var string
+        */
+       private $prompt;
+
+       /**
+        * @param string $prompt
+        */
+       public function __construct($prompt = "Password:") {
+               $this->prompt = $prompt;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return string
+        */
+       public function run($verbose = false) {
+               system("stty -echo");
+               printf("%s ", $this->prompt);
+               $pass = fgets(STDIN, 1024);
+               printf("\n");
+               system("stty echo");
+               if (substr($pass, -1) == "\n") {
+                       $pass = substr($pass, 0, -1);
+               }
+               return $pass;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Task;
+
+use RecursiveDirectoryIterator;
+use RecursiveIteratorIterator;
+
+/**
+ * List all library files of pharext to bundle with a phar
+ */
+class BundleGenerator implements Task
+{
+       /**
+        * @param bool $verbose
+        * @return Generator
+        */
+       public function run($verbose = false) {
+               if ($verbose) {
+                       printf("Packaging pharext ... \n");
+               }
+               $rdi = new RecursiveDirectoryIterator(dirname(dirname(__DIR__)));
+               $rii = new RecursiveIteratorIterator($rdi);
+               for ($rii->rewind(); $rii->valid(); $rii->next()) {
+                       if (!$rii->isDot()) {
+                               yield $rii->getSubPathname() => $rii->key();
+                       }
+               }
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Task;
+
+use FilesystemIterator;
+use RecursiveDirectoryIterator;
+use RecursiveIteratorIterator;
+
+/**
+ * Recursively cleanup FS entries
+ */
+class Cleanup implements Task
+{
+       /**
+        * @var string
+        */
+       private $rm;
+
+       public function __construct($rm) {
+               $this->rm = $rm;
+       }
+
+       /**
+        * @param bool $verbose
+        */
+       public function run($verbose = false) {
+               if ($verbose) {
+                       printf("Cleaning up %s ...\n", $this->rm);
+               }
+               if ($this->rm instanceof Tempfile) {
+                       unset($this->rm);
+               } elseif (is_dir($this->rm)) {
+                       $rdi = new RecursiveDirectoryIterator($this->rm,
+                               FilesystemIterator::CURRENT_AS_SELF | // needed for 5.5
+                               FilesystemIterator::KEY_AS_PATHNAME |
+                               FilesystemIterator::SKIP_DOTS);
+                       $rii = new RecursiveIteratorIterator($rdi,
+                               RecursiveIteratorIterator::CHILD_FIRST);
+                       foreach ($rii as $path => $child) {
+                               if ($child->isDir()) {
+                                       @rmdir($path);
+                               } else {
+                                       @unlink($path);
+                               }
+                       }
+                       @rmdir($this->rm);
+               } elseif (file_exists($this->rm)) {
+                       @unlink($this->rm);
+               }
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\ExecCmd;
+use pharext\Task;
+
+/**
+ * Runs extension's configure
+ */
+class Configure implements Task
+{
+       /**
+        * @var array
+        */
+       private $args;
+
+       /**
+        * @var string
+        */
+       private $cwd;
+
+       /**
+        * @param string $cwd working directory
+        * @param array $args configure args
+        * @param string $prefix install prefix, e.g. /usr/local
+        * @param string $common_name PHP programs common name, e.g. php5
+        */
+       public function __construct($cwd, array $args = null, $prefix = null, $common_name = "php") {
+               $this->cwd = $cwd;
+               $cmd = $common_name . "-config";
+               if (isset($prefix)) {
+                       $cmd = $prefix . "/bin/" . $cmd;
+               }
+               $this->args =  ["--with-php-config=$cmd"];
+               if ($args) {
+                       $this->args = array_merge($this->args, $args);
+               }
+       }
+
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Running ./configure ...\n");
+               }
+               $pwd = getcwd();
+               if (!chdir($this->cwd)) {
+                       throw new Exception;
+               }
+               try {
+                       $cmd = new ExecCmd("./configure", $verbose);
+                       $cmd->run($this->args);
+               } finally {
+                       chdir($pwd);
+               }
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Archive;
+use pharext\Task;
+use pharext\Tempdir;
+
+use Phar;
+use PharData;
+
+/**
+ * Extract a package archive
+ */
+class Extract implements Task
+{
+       /**
+        * @var Phar(Data)
+        */
+       private $source;
+
+       /**
+        * @param mixed $source archive location
+        */
+       public function __construct($source) {
+               if ($source instanceof Phar || $source instanceof PharData || $source instanceof Archive) {
+                       $this->source = $source;
+               } else {
+                       $this->source = new PharData($source);
+               }
+       }
+
+       /**
+        * @param bool $verbose
+        * @return \pharext\Tempdir
+        */
+       public function run($verbose = false) {
+               if ($verbose) {
+                       printf("Extracting %s ...\n", basename($this->source->getPath()));
+               }
+               if ($this->source instanceof Archive) {
+                       return $this->source->extract();
+               }
+               $dest = new Tempdir("extract");
+               $this->source->extractTo($dest);
+               return $dest;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\ExecCmd;
+use pharext\Task;
+use pharext\Tempdir;
+
+/**
+ * Clone a git repo
+ */
+class GitClone implements Task
+{
+       /**
+        * @var string
+        */
+       private $source;
+       
+       /**
+        * @var string
+        */
+       private $branch;
+
+       /**
+        * @param string $source git repo location
+        */
+       public function __construct($source, $branch = null) {
+               $this->source = $source;
+               $this->branch = $branch;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return \pharext\Tempdir
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Fetching %s ...\n", $this->source);
+               }
+               $local = new Tempdir("gitclone");
+               $cmd = new ExecCmd("git", $verbose);
+               if (strlen($this->branch)) {
+                       $cmd->run(["clone", "--depth", 1, "--branch", $this->branch, $this->source, $local]);
+               } else {
+                       $cmd->run(["clone", $this->source, $local]);
+               }
+               return $local;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\ExecCmd;
+use pharext\Exception;
+use pharext\Task;
+
+/**
+ * Run make in the source dir
+ */
+class Make implements Task
+{
+       /**
+        * @var string
+        */
+       private $cwd;
+
+       /**
+        * @var array
+        */
+       private $args;
+
+       /**
+        * @var string
+        */
+       private $sudo;
+
+       /**
+        *
+        * @param string $cwd working directory
+        * @param array $args make's arguments
+        * @param string $sudo sudo command
+        */
+       public function __construct($cwd, array $args = null, $sudo = null) {
+               $this->cwd = $cwd;
+               $this->sudo = $sudo;
+               $this->args = $args;
+       }
+
+       /**
+        *
+        * @param bool $verbose
+        * @throws \pharext\Exception
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Running make");
+                       if ($this->args) {
+                               foreach ($this->args as $arg) {
+                                       printf(" %s", $arg);
+                               }
+                       }
+                       printf(" ...\n");
+               }
+               $pwd = getcwd();
+               if (!chdir($this->cwd)) {
+                       throw new Exception;
+               }
+               try {
+                       $cmd = new ExecCmd("make", $verbose);
+                       if (isset($this->sudo)) {
+                               $cmd->setSu($this->sudo);
+                       }
+                       $args = $this->args;
+                       if (!$verbose) {
+                               $args = array_merge((array) $args, ["-s"]);
+                       }
+                       $cmd->run($args);
+               } finally {
+                       chdir($pwd);
+               }
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\Task;
+use pharext\Tempfile;
+
+class PaxFixup implements Task
+{
+       private $source;
+
+       public function __construct($source) {
+               $this->source = $source;
+       }
+
+       private function openArchive($source) {
+               $hdr = file_get_contents($source, false, null, 0, 3);
+               if ($hdr === "\x1f\x8b\x08") {
+                       $fd = fopen("compress.zlib://$source", "r");
+               } elseif ($hdr === "BZh") {
+                       $fd = fopen("compress.bzip2://$source", "r");
+               } else {
+                       $fd = fopen($source, "r");
+               }
+               if (!is_resource($fd)) {
+                       throw new Exception;
+               }
+               return $fd;
+       }
+
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Fixing up a tarball with global pax header ...\n");
+               }
+               $temp = new Tempfile("paxfix");
+               stream_copy_to_stream($this->openArchive($this->source),
+                       $temp->getStream(), -1, 1024);
+               $temp->closeStream();
+               return (new Extract((string) $temp))->run($verbose);
+       }
+}<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\Task;
+
+/**
+ * Fixup package.xml files in an extracted PECL dir
+ */
+class PeclFixup implements Task
+{
+       /**
+        * @var string
+        */
+       private $source;
+
+       /**
+        * @param string $source source directory
+        */
+       public function __construct($source) {
+               $this->source = $source;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return string sanitized source location
+        * @throws \pahrext\Exception
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Sanitizing PECL dir ...\n");
+               }
+               $dirs = glob("{$this->source}/*", GLOB_ONLYDIR);
+               $files = array_diff(glob("{$this->source}/*"), $dirs);
+               $check = array_reduce($files, function($r, $v) {
+                       return $v && fnmatch("package*.xml", basename($v));
+               }, true);
+
+               if (count($dirs) !== 1 || !$check) {
+                       throw new Exception("Does not look like an extracted PECL dir: {$this->source}");
+               }
+
+               $dest = current($dirs);
+
+               foreach ($files as $file) {
+                       if ($verbose) {
+                               printf("Moving %s into %s ...\n", basename($file), basename($dest));
+                       }
+                       if (!rename($file, "$dest/" . basename($file))) {
+                               throw new Exception;
+                       }
+               }
+
+               return $dest;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\SourceDir;
+use pharext\Task;
+use pharext\Tempname;
+
+use Phar;
+
+/**
+ * Build phar
+ */
+class PharBuild implements Task
+{
+       /**
+        * @var \pharext\SourceDir
+        */
+       private $source;
+
+       /**
+        * @var string
+        */
+       private $stub;
+
+       /**
+        * @var array
+        */
+       private $meta;
+
+       /**
+        * @var bool
+        */
+       private $readonly;
+
+       /**
+        * @param SourceDir $source extension source directory
+        * @param string $stub path to phar stub
+        * @param array $meta phar meta data
+        * @param bool $readonly whether the stub has -dphar.readonly=1 set
+        */
+       public function __construct(SourceDir $source = null, $stub, array $meta = null, $readonly = true) {
+               $this->source = $source;
+               $this->stub = $stub;
+               $this->meta = $meta;
+               $this->readonly = $readonly;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return \pharext\Tempname
+        * @throws \pharext\Exception
+        */
+       public function run($verbose = false) {
+               /* Phar::compress() and ::convert*() use strtok("."), ugh!
+                * so, be sure to not use any other dots in the filename
+                * except for .phar
+                */
+               $temp = new Tempname("", "-pharext.phar");
+
+               $phar = new Phar($temp);
+               $phar->startBuffering();
+
+               if ($this->meta) {
+                       $phar->setMetadata($this->meta);
+               }
+               if ($this->stub) {
+                       (new PharStub($phar, $this->stub))->run($verbose);
+               }
+
+               $phar->buildFromIterator((new Task\BundleGenerator)->run());
+
+               if ($this->source) {
+                       if ($verbose) {
+                               $bdir = $this->source->getBaseDir();
+                               $blen = strlen($bdir);
+                               foreach ($this->source as $index => $file) {
+                                       if (is_resource($file)) {
+                                               printf("Packaging %s ...\n", $index);
+                                               $phar[$index] = $file;
+                                       } else {
+                                               printf("Packaging %s ...\n", $index = trim(substr($file, $blen), "/"));
+                                               $phar->addFile($file, $index);
+                                       }
+                               }
+                       } else {
+                               $phar->buildFromIterator($this->source, $this->source->getBaseDir());
+                       }
+               }
+
+               $phar->stopBuffering();
+               
+               if (!chmod($temp, fileperms($temp) | 0111)) {
+                       throw new Exception;
+               }
+               
+               return $temp;
+       }
+}<?php
+
+namespace pharext\Task;
+
+use pharext\Task;
+
+use Phar;
+
+/**
+ * Clone a compressed copy of a phar
+ */
+class PharCompress implements Task
+{
+       /**
+        * @var string
+        */
+       private $file;
+
+       /**
+        * @var Phar
+        */
+       private $package;
+
+       /**
+        * @var int
+        */
+       private $encoding;
+
+       /**
+        * @var string
+        */
+       private $extension;
+
+       /**
+        * @param string $file path to the original phar
+        * @param int $encoding Phar::GZ or Phar::BZ2
+        */
+       public function __construct($file, $encoding) {
+               $this->file = $file;
+               $this->package = new Phar($file);
+               $this->encoding = $encoding;
+
+               switch ($encoding) {
+                       case Phar::GZ:
+                               $this->extension = ".gz";
+                               break;
+                       case Phar::BZ2:
+                               $this->extension = ".bz2";
+                               break;
+               }
+       }
+
+       /**
+        * @param bool $verbose
+        * @return string
+        */
+       public function run($verbose = false) {
+               if ($verbose) {
+                       printf("Compressing %s ...\n", basename($this->package->getPath()));
+               }
+               /* stop shebang */
+               $stub = $this->package->getStub();
+               $phar = $this->package->compress($this->encoding);
+               $phar->setStub(substr($stub, strpos($stub, "\n")+1));
+               return $this->file . $this->extension;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\Task;
+
+/**
+ * Rename the phar archive
+ */
+class PharRename implements Task
+{
+       /**
+        * @var string
+        */
+       private $phar;
+
+       /**
+        * @var string
+        */
+       private $dest;
+
+       /**
+        * @var string
+        */
+       private $name;
+
+       /**
+        * @param string $phar path to phar
+        * @param string $dest destination dir
+        * @param string $name package name
+        */
+       public function __construct($phar, $dest, $name) {
+               $this->phar = $phar;
+               $this->dest = $dest;
+               $this->name = $name;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return string path to renamed phar
+        * @throws \pharext\Exception
+        */
+       public function run($verbose = false) {
+               $extension = substr(strstr($this->phar, "-pharext.phar"), 8);
+               $name = sprintf("%s/%s.ext%s", $this->dest, $this->name, $extension);
+               
+               if ($verbose) {
+                       printf("Renaming %s to %s ...\n", basename($this->phar), basename($name));
+               }
+
+               if (!rename($this->phar, $name)) {
+                       throw new Exception;
+               }
+
+               return $name;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Openssl;
+use pharext\Task;
+
+use Phar;
+
+/**
+ * Sign the phar with a private key
+ */
+class PharSign implements Task
+{
+       /**
+        * @var Phar
+        */
+       private $phar;
+
+       /**
+        * @var \pharext\Openssl\PrivateKey
+        */
+       private $pkey;
+
+       /**
+        *
+        * @param mixed $phar phar instance or path to phar
+        * @param string $pkey path to private key
+        * @param string $pass password for the private key
+        */
+       public function __construct($phar, $pkey, $pass) {
+               if ($phar instanceof Phar || $phar instanceof PharData) {
+                       $this->phar = $phar;
+               } else {
+                       $this->phar = new Phar($phar);
+               }
+               $this->pkey = new Openssl\PrivateKey($pkey, $pass);
+       }
+
+       /**
+        * @param bool $verbose
+        * @return \pharext\Openssl\PrivateKey
+        */
+       public function run($verbose = false) {
+               if ($verbose) {
+                       printf("Signing %s ...\n", basename($this->phar->getPath()));
+               }
+               $this->pkey->sign($this->phar);
+               return $this->pkey;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use Phar;
+use pharext\Exception;
+use pharext\Task;
+
+/**
+ * Set the phar's stub
+ */
+class PharStub implements Task
+{
+       /**
+        * @var \Phar
+        */
+       private $phar;
+
+       /**
+        * @var string
+        */
+       private $stub;
+
+       /**
+        * @param \Phar $phar
+        * @param string $stub file path to the stub
+        * @throws \pharext\Exception
+        */
+       function __construct(Phar $phar, $stub) {
+               $this->phar = $phar;
+               if (!file_exists($this->stub = $stub)) {
+                       throw new Exception("File '$stub' does not exist");
+               }
+       }
+
+       /**
+        * @param bool $verbose
+        */
+       function run($verbose = false) {
+               if ($verbose) {
+                       printf("Using stub '%s'...\n", basename($this->stub));
+               }
+               $stub = preg_replace_callback('/^#include <([^>]+)>/m', function($includes) {
+                       return file_get_contents($includes[1], true, null, 5);
+               }, file_get_contents($this->stub));
+               if ($this->phar->isCompressed() && substr($stub, 0, 2) === "#!") {
+                       $stub = substr($stub, strpos($stub, "\n")+1);
+               }
+               $this->phar->setStub($stub);
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\ExecCmd;
+use pharext\Task;
+
+/**
+ * Run phpize in the extension source directory
+ */
+class Phpize implements Task
+{
+       /**
+        * @var string
+        */
+       private $phpize;
+
+       /**
+        *
+        * @var string
+        */
+       private $cwd;
+
+       /**
+        * @param string $cwd working directory
+        * @param string $prefix install prefix, e.g. /usr/local
+        * @param string $common_name PHP program common name, e.g. php5
+        */
+       public function __construct($cwd, $prefix = null,  $common_name = "php") {
+               $this->cwd = $cwd;
+               $cmd = $common_name . "ize";
+               if (isset($prefix)) {
+                       $cmd = $prefix . "/bin/" . $cmd;
+               }
+               $this->phpize = $cmd;
+       }
+
+       /**
+        * @param bool $verbose
+        * @throws \pharext\Exception
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Running %s ...\n", $this->phpize);
+               }
+               $pwd = getcwd();
+               if (!chdir($this->cwd)) {
+                       throw new Exception;
+               }
+               try {
+                       $cmd = new ExecCmd($this->phpize, $verbose);
+                       $cmd->run();
+               } finally {
+                       chdir($pwd);
+               }
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\Task;
+use pharext\Tempfile;
+
+/**
+ * Fetch a remote archive
+ */
+class StreamFetch implements Task
+{
+       /**
+        * @var string
+        */
+       private $source;
+
+       /**
+        * @var callable
+        */
+       private $progress;
+
+       /**
+        * @param string $source remote file location
+        * @param callable $progress progress callback
+        */
+       public function __construct($source, callable $progress) {
+               $this->source = $source;
+               $this->progress = $progress;
+       }
+
+       private function createStreamContext() {
+               $progress = $this->progress;
+
+               /* avoid bytes_max bug of older PHP versions */
+               $maxbytes = 0;
+               return stream_context_create([],["notification" => function($notification, $severity, $message, $code, $bytes_cur, $bytes_max) use($progress, &$maxbytes) {
+                       if ($bytes_max > $maxbytes) {
+                               $maxbytes = $bytes_max;
+                       }
+                       switch ($notification) {
+                               case STREAM_NOTIFY_CONNECT:
+                                       $progress(0);
+                                       break;
+                               case STREAM_NOTIFY_PROGRESS:
+                                       $progress($maxbytes > 0 ? $bytes_cur/$maxbytes : .5);
+                                       break;
+                               case STREAM_NOTIFY_COMPLETED:
+                                       /* this is sometimes not generated, why? */
+                                       $progress(1);
+                                       break;
+                       }
+               }]);
+       }
+
+       /**
+        * @param bool $verbose
+        * @return \pharext\Task\Tempfile
+        * @throws \pharext\Exception
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Fetching %s ...\n", $this->source);
+               }
+               $context = $this->createStreamContext();
+
+               if (!$remote = fopen($this->source, "r", false, $context)) {
+                       throw new Exception;
+               }
+               
+               $local = new Tempfile("remote");
+               if (!stream_copy_to_stream($remote, $local->getStream())) {
+                       throw new Exception;
+               }
+               $local->closeStream();
+
+               /* STREAM_NOTIFY_COMPLETED is not generated, see above */
+               call_user_func($this->progress, 1);
+
+               return $local;
+       }
+}
+<?php
+
+namespace pharext;
+
+/**
+ * Simple task interface
+ */
+interface Task
+{
+       public function run($verbose = false);
+}
+<?php
+
+namespace pharext;
+
+/**
+ * Create a temporary directory
+ */
+class Tempdir extends \SplFileInfo
+{
+       /**
+        * @param string $prefix prefix to uniqid()
+        * @throws \pharext\Exception
+        */
+       public function __construct($prefix) {
+               $temp = new Tempname($prefix);
+               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
+                       throw new Exception("Could not create tempdir: ".error_get_last()["message"]);
+               }
+               parent::__construct($temp);
+       }
+}
+<?php 
+
+namespace pharext;
+
+/**
+ * Create a new temporary file
+ */
+class Tempfile extends \SplFileInfo
+{
+       /**
+        * @var resource
+        */
+       private $handle;
+
+       /**
+        * @param string $prefix uniqid() prefix
+        * @param string $suffix e.g. file extension
+        * @throws \pharext\Exception
+        */
+       public function __construct($prefix, $suffix = ".tmp") {
+               $tries = 0;
+               $omask = umask(077);
+               do {
+                       $path = new Tempname($prefix, $suffix);
+                       $this->handle = fopen($path, "x");
+               } while (!is_resource($this->handle) && $tries++ < 10);
+               umask($omask);
+               
+               if (!is_resource($this->handle)) {
+                       throw new Exception("Could not create temporary file");
+               }
+               
+               parent::__construct($path);
+       }
+
+       /**
+        * Unlink the file
+        */
+       public function __destruct() {
+               if (is_file($this->getPathname())) {
+                       @unlink($this->getPathname());
+               }
+       }
+
+       /**
+        * Close the stream
+        */
+       public function closeStream() {
+               fclose($this->handle);
+       }
+
+       /**
+        * Retrieve the stream resource
+        * @return resource
+        */
+       public function getStream() {
+               return $this->handle;
+       }
+}
+<?php
+
+namespace pharext;
+
+use pharext\Exception;
+
+/**
+ * A temporary file/directory name
+ */
+class Tempname
+{
+       /**
+        * @var string
+        */
+       private $name;
+
+       /**
+        * @param string $prefix uniqid() prefix
+        * @param string $suffix e.g. file extension
+        */
+       public function __construct($prefix, $suffix = null) {
+               $temp = sys_get_temp_dir() . "/pharext-" . $this->getUser();
+               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
+                       throw new Exception;
+               }
+               $this->name = $temp ."/". uniqid($prefix) . $suffix;
+       }
+
+       private function getUser() {
+               if (extension_loaded("posix") && function_exists("posix_getpwuid")) {
+                       return posix_getpwuid(posix_getuid())["name"];
+               }
+               return trim(`whoami 2>/dev/null`)
+                       ?: trim(`id -nu 2>/dev/null`)
+                       ?: getenv("USER")
+                       ?: get_current_user();
+       }
+
+       /**
+        * @return string
+        */
+       public function __toString() {
+               return (string) $this->name;
+       }
+}
+<?php
+
+namespace pharext;
+
+use Phar;
+use PharFileInfo;
+use SplFileInfo;
+use pharext\Exception;
+
+class Updater implements Command
+{
+       use Cli\Command;
+
+       /**
+        * Create the command
+        */
+       public function __construct() {
+               $this->args = new Cli\Args([
+                       ["h", "help", "Display this help",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       ["v", "verbose", "More output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["q", "quiet", "Less output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       [null, "signature", "Show pharext signature",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "license", "Show pharext license",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "version", "Show pharext version",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [0, "path", "Path to .ext.phar to update",
+                               Cli\Args::REQUIRED|Cli\Args::MULTI],
+               ]);
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::run()
+        */
+       public function run($argc, array $argv) {
+               $errs = [];
+               $prog = array_shift($argv);
+               foreach ($this->args->parse(--$argc, $argv) as $error) {
+                       $errs[] = $error;
+               }
+
+               if ($this->args["help"]) {
+                       $this->header();
+                       $this->help($prog);
+                       exit;
+               }
+
+               try {
+                       foreach (["signature", "license", "version"] as $opt) {
+                               if ($this->args[$opt]) {
+                                       printf("%s\n", $this->metadata($opt));
+                                       exit;
+                               }
+                       }
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EARGS);
+               }
+
+
+               foreach ($this->args->validate() as $error) {
+                       $errs[] = $error;
+               }
+
+               if ($errs) {
+                       if (!$this->args["quiet"]) {
+                               $this->header();
+                       }
+                       foreach ($errs as $err) {
+                               $this->error("%s\n", $err);
+                       }
+                       printf("\n");
+                       if (!$this->args["quiet"]) {
+                               $this->help($prog);
+                       }
+                       exit(self::EARGS);
+               }
+
+               foreach ($this->args[0] as $file) {
+                       $info = new SplFileInfo($file);
+
+                       while ($info->isLink()) {
+                               $info = new SplFileInfo($info->getLinkTarget());
+                       }
+                       
+                       if ($info->isFile()) {
+                               if (!$this->updatePackage($info)) {
+                                       $this->warn("Cannot upgrade pre-v3 packages\n");
+                               }
+                       } else {
+                               $this->error("File '%s' does not exist\n", $file);
+                               exit(self::EARGS);
+                       }
+               }
+       }
+
+       /**
+        * Replace the pharext core in an .ext.phar package
+        * @param string $temp path to temp phar
+        * @return boolean FALSE if the package is too old (pre-v3) to upgrade
+        */
+       private function replacePharext($temp) {
+               $phar = new Phar($temp, Phar::CURRENT_AS_SELF);
+               $phar->startBuffering();
+
+               if (!$meta = $phar->getMetadata()) {
+                       // don't upgrade pre-v3 packages
+                       return false;
+               }
+
+               // replace current pharext files
+               $core = (new Task\BundleGenerator)->run($this->verbosity());
+               $phar->buildFromIterator($core);
+               $stub = __DIR__."/../pharext_installer.php";
+               (new Task\PharStub($phar, $stub))->run($this->verbosity());
+
+               // check dependencies
+               foreach ($phar as $info) {
+                       if (fnmatch("*.ext.phar*", $info->getBasename())) {
+                               $this->updatePackage($info, $phar);
+                       }
+               }
+               
+               $phar->stopBuffering();
+
+               $phar->setMetadata([
+                       "version" => Metadata::version(),
+                       "header" => Metadata::header(),
+               ] + $meta);
+
+               $this->info("Updated pharext version from '%s' to '%s'\n",
+                       isset($meta["version"]) ? $meta["version"] : "(unknown)",
+                       $phar->getMetadata()["version"]);
+
+               return true;
+       }
+
+       /**
+        * Update an .ext.phar package to the current pharext version
+        * @param SplFileInfo $file
+        * @param Phar $phar the parent phar containing $file as dependency
+        * @return boolean FALSE if the package is too old (pre-v3) to upgrade
+        * @throws Exception
+        */
+       private function updatePackage(SplFileInfo $file, Phar $phar = null) {
+               $this->info("Updating pharext core in '%s'...\n", basename($file));
+
+               $temp = new Tempname("update", substr(strstr($file, ".ext.phar"), 4));
+
+               if (!copy($file->getPathname(), $temp)) {
+                       throw new Exception;
+               }
+               if (!chmod($temp, $file->getPerms())) {
+                       throw new Exception;
+               }
+               
+               if (!$this->replacePharext($temp)) {
+                       return false;
+               }
+
+               if ($phar) {
+                       $phar->addFile($temp, $file);
+               } elseif (!rename($temp, $file->getPathname())) {
+                       throw new Exception;
+               }
+
+               return true;
+       }
+}
+#!/usr/bin/env php
+<?php
+
+/**
+ * The installer sub-stub for extension phars
+ */
+
+namespace pharext;
+
+define("PHAREXT_PHAR", __FILE__);
+
+spl_autoload_register(function($c) {
+       return include strtr($c, "\\_", "//") . ".php";
+});
+
+#include <pharext/Exception.php>
+#include <pharext/Tempname.php>
+#include <pharext/Tempfile.php>
+#include <pharext/Tempdir.php>
+#include <pharext/Archive.php>
+
+namespace pharext;
+
+if (extension_loaded("Phar")) {
+       \Phar::interceptFileFuncs();
+       \Phar::mapPhar();
+       $phardir = "phar://".__FILE__;
+} else {
+       $archive = new Archive(__FILE__);
+       $phardir = $archive->extract();
+}
+
+set_include_path("$phardir:". get_include_path());
+
+$installer = new Installer();
+$installer->run($argc, $argv);
+
+__HALT_COMPILER();
+#!/usr/bin/php -dphar.readonly=0
+<?php
+
+/**
+ * The packager sub-stub for bin/pharext
+ */
+
+namespace pharext;
+
+spl_autoload_register(function($c) {
+       return include strtr($c, "\\_", "//") . ".php";
+});
+
+set_include_path('phar://' . __FILE__ .":". get_include_path());
+
+if (!extension_loaded("Phar")) {
+       fprintf(STDERR, "ERROR: Phar extension not loaded\n\n");
+       fprintf(STDERR, "\tPlease load the phar extension in your php.ini\n".
+                                       "\tor rebuild PHP with the --enable-phar flag.\n\n");
+       exit(1);
+}
+
+if (ini_get("phar.readonly")) {
+       fprintf(STDERR, "ERROR: Phar is configured read-only\n\n");
+       fprintf(STDERR, "\tPlease specify phar.readonly=0 in your php.ini\n".
+                                       "\tor run this command with php -dphar.readonly=0\n\n");
+       exit(1);
+}
+
+\Phar::interceptFileFuncs();
+\Phar::mapPhar();
+
+$packager = new Packager();
+$packager->run($argc, $argv);
+
+__HALT_COMPILER();
+#!/usr/bin/php -dphar.readonly=0
+<?php
+
+/**
+ * The installer updater stub for extension phars
+ */
+
+namespace pharext;
+
+spl_autoload_register(function($c) {
+       return include strtr($c, "\\_", "//") . ".php";
+});
+
+set_include_path('phar://' . __FILE__ .":". get_include_path());
+
+if (!extension_loaded("Phar")) {
+       fprintf(STDERR, "ERROR: Phar extension not loaded\n\n");
+       fprintf(STDERR, "\tPlease load the phar extension in your php.ini\n".
+                                       "\tor rebuild PHP with the --enable-phar flag.\n\n");
+       exit(1);
+}
+
+if (ini_get("phar.readonly")) {
+       fprintf(STDERR, "ERROR: Phar is configured read-only\n\n");
+       fprintf(STDERR, "\tPlease specify phar.readonly=0 in your php.ini\n".
+                                       "\tor run this command with php -dphar.readonly=0\n\n");
+       exit(1);
+}
+
+\Phar::interceptFileFuncs();
+\Phar::mapPhar();
+
+$updater = new Updater();
+$updater->run($argc, $argv);
+
+__HALT_COMPILER();
+package.xml            merge=touch
+php_propro.h   merge=touch
+
+# /
+*~
+/*.tgz
+/.deps
+/*.lo
+/*.la
+/config.[^wm]*
+/configure*
+/lib*
+/ac*.m4
+/ltmain.sh
+/install-sh
+/Make*
+/mk*
+/missing
+/.libs
+/build
+/include
+/modules
+/autom4te*
+/.dep.inc
+run-tests.php
+propro# Doxyfile 1.8.5
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING      = UTF-8
+PROJECT_NAME           = "Property proxy API"
+PROJECT_NUMBER         =
+PROJECT_BRIEF          = "A facility to manage extension object properties tied to C-struct members"
+PROJECT_LOGO           = 
+OUTPUT_DIRECTORY       = 
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       =
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = YES
+STRIP_FROM_PATH        =
+STRIP_FROM_INC_PATH    =
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = YES
+QT_AUTOBRIEF           = NO
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS           = YES
+SEPARATE_MEMBER_PAGES  = NO
+TAB_SIZE               = 4
+ALIASES                =
+TCL_SUBST              =
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+OPTIMIZE_FOR_FORTRAN   = NO
+OPTIMIZE_OUTPUT_VHDL   = NO
+EXTENSION_MAPPING      =
+MARKDOWN_SUPPORT       = YES
+AUTOLINK_SUPPORT       = YES
+BUILTIN_STL_SUPPORT    = NO
+CPP_CLI_SUPPORT        = NO
+SIP_SUPPORT            = NO
+IDL_PROPERTY_SUPPORT   = YES
+DISTRIBUTE_GROUP_DOC   = NO
+SUBGROUPING            = YES
+INLINE_GROUPED_CLASSES = NO
+INLINE_SIMPLE_STRUCTS  = YES
+TYPEDEF_HIDES_STRUCT   = NO
+LOOKUP_CACHE_SIZE      = 0
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_PACKAGE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+EXTRACT_ANON_NSPACES   = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+FORCE_LOCAL_INCLUDES   = NO
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES       = NO
+SORT_BY_SCOPE_NAME     = NO
+STRICT_PROTO_MATCHING  = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       =
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_FILES             = YES
+SHOW_NAMESPACES        = YES
+FILE_VERSION_FILTER    =
+LAYOUT_FILE            =
+CITE_BIB_FILES         =
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           =
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = php_propro.h
+INPUT_ENCODING         = UTF-8
+FILE_PATTERNS          =
+RECURSIVE              = NO
+EXCLUDE                =
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       =
+EXCLUDE_SYMBOLS        =
+EXAMPLE_PATH           =
+EXAMPLE_PATTERNS       =
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             =
+INPUT_FILTER           =
+FILTER_PATTERNS        =
+FILTER_SOURCE_FILES    = NO
+FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE =
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = NO
+REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS        = YES
+USE_HTAGS              = NO
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = YES
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          =
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            =
+HTML_FOOTER            =
+HTML_STYLESHEET        =
+HTML_EXTRA_STYLESHEET  =
+HTML_EXTRA_FILES       =
+HTML_COLORSTYLE_HUE    = 220
+HTML_COLORSTYLE_SAT    = 100
+HTML_COLORSTYLE_GAMMA  = 80
+HTML_TIMESTAMP         = NO
+HTML_DYNAMIC_SECTIONS  = NO
+HTML_INDEX_NUM_ENTRIES = 100
+GENERATE_DOCSET        = NO
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+DOCSET_PUBLISHER_NAME  = Publisher
+GENERATE_HTMLHELP      = NO
+CHM_FILE               =
+HHC_LOCATION           =
+GENERATE_CHI           = NO
+CHM_INDEX_ENCODING     =
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+GENERATE_QHP           = NO
+QCH_FILE               =
+QHP_NAMESPACE          = org.doxygen.Project
+QHP_VIRTUAL_FOLDER     = doc
+QHP_CUST_FILTER_NAME   =
+QHP_CUST_FILTER_ATTRS  =
+QHP_SECT_FILTER_ATTRS  =
+QHG_LOCATION           =
+GENERATE_ECLIPSEHELP   = NO
+ECLIPSE_DOC_ID         = org.doxygen.Project
+DISABLE_INDEX          = NO
+GENERATE_TREEVIEW      = YES
+ENUM_VALUES_PER_LINE   = 4
+TREEVIEW_WIDTH         = 250
+EXT_LINKS_IN_WINDOW    = NO
+FORMULA_FONTSIZE       = 10
+FORMULA_TRANSPARENT    = YES
+USE_MATHJAX            = NO
+MATHJAX_FORMAT         = HTML-CSS
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+MATHJAX_EXTENSIONS     =
+MATHJAX_CODEFILE       =
+SEARCHENGINE           = YES
+SERVER_BASED_SEARCH    = NO
+EXTERNAL_SEARCH        = NO
+SEARCHENGINE_URL       =
+SEARCHDATA_FILE        = searchdata.xml
+EXTERNAL_SEARCH_ID     =
+EXTRA_SEARCH_MAPPINGS  =
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4
+EXTRA_PACKAGES         =
+LATEX_HEADER           =
+LATEX_FOOTER           =
+LATEX_EXTRA_FILES      =
+PDF_HYPERLINKS         = YES
+USE_PDFLATEX           = YES
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+LATEX_SOURCE_CODE      = NO
+LATEX_BIB_STYLE        = plain
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    =
+RTF_EXTENSIONS_FILE    =
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             =
+XML_DTD                =
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+GENERATE_DOCBOOK       = NO
+DOCBOOK_OUTPUT         = docbook
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           =
+INCLUDE_FILE_PATTERNS  =
+PREDEFINED             = DOXYGEN TSRMLS_C= TSRMLS_D= TSRMLS_CC= TSRMLS_DC= PHP_PROPRO_API=
+EXPAND_AS_DEFINED      =
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+TAGFILES               =
+GENERATE_TAGFILE       =
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+EXTERNAL_PAGES         = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+MSCGEN_PATH            =
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = YES
+DOT_NUM_THREADS        = 0
+DOT_FONTNAME           = Helvetica
+DOT_FONTSIZE           = 10
+DOT_FONTPATH           =
+CLASS_GRAPH            = NO
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+UML_LIMIT_NUM_FIELDS   = 10
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = YES
+CALLER_GRAPH           = YES
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+INTERACTIVE_SVG        = NO
+DOT_PATH               =
+DOTFILE_DIRS           =
+MSCFILE_DIRS           =
+DOT_GRAPH_MAX_NODES    = 50
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+Copyright (c) 2013, Michael Wallner <mike@php.net>.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, 
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright 
+      notice, this list of conditions and the following disclaimer in the 
+      documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# pecl/propro
+
+## About:
+
+The "Property Proxy" extension provides a fairly transparent proxy for internal object properties hidden in custom non-zval implementations.
+
+## Installation:
+
+This extension is hosted at [PECL](http://pecl.php.net) and can be installed with [PEAR](http://pear.php.net)'s pecl command:
+
+    # pecl install propro
+
+Also, watch out for self-installing [pharext](https://github.com/m6w6/pharext) packages attached to [releases](https://github.com/m6w6/ext-propro/releases).
+
+## Internals:
+
+> ***NOTE:***
+  This extension mostly only provides infrastructure for other extensions.
+  See the [API docs here](http://m6w6.github.io/ext-propro/).
+
+## Documentation
+
+Userland documentation can be found at https://mdref.m6w6.name/propro
+PHP_ARG_ENABLE(propro, whether to enable property proxy support,
+[  --enable-propro           Enable property proxy support])
+
+if test "$PHP_PROPRO" != "no"; then
+       PHP_INSTALL_HEADERS(ext/propro, php_propro.h php_propro_api.h)
+       PHP_NEW_EXTENSION(propro, php_propro.c, $ext_shared)
+fi
+\r
+ARG_ENABLE("propro", "for propro support", "no");\r
+\r
+if (PHP_PROPRO == "yes") {\r
+               EXTENSION("propro", "php_propro.c");\r
+\r
+               AC_DEFINE("HAVE_PROPRO", 1);\r
+               PHP_INSTALL_HEADERS("ext/propro", "php_propro.h");\r
+}\r
+<?xml version="1.0" encoding="UTF-8"?>
+<package 
+ packagerversion="1.4.11" 
+ version="2.0" 
+ xmlns="http://pear.php.net/dtd/package-2.0" 
+ xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" 
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+ xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
+ <name>propro</name>
+ <channel>pecl.php.net</channel>
+ <summary>Property proxy</summary>
+ <description>A reusable split-off of pecl_http's property proxy API.</description>
+ <lead>
+  <name>Michael Wallner</name>
+  <user>mike</user>
+  <email>mike@php.net</email>
+  <active>yes</active>
+ </lead>
+ <date>2013-12-05</date>
+ <version>
+  <release>2.0.0-dev</release>
+  <api>2.0.0</api>
+ </version>
+ <stability>
+  <release>stable</release>
+  <api>stable</api>
+ </stability>
+ <license>BSD, revised</license>
+ <notes><![CDATA[
+]]></notes>
+ <contents>
+  <dir name="/">
+   <file role="doc" name="CREDITS" />
+   <file role="doc" name="LICENSE" />
+   <file role="doc" name="Doxyfile" />
+   <file role="src" name="config.m4" />
+   <file role="src" name="config.w32" />
+   <file role="src" name="php_propro.h" />
+   <file role="src" name="php_propro_api.h" />
+   <file role="src" name="php_propro.c" />
+   <dir name="tests">
+    <file role="test" name="001.phpt" />
+    <file role="test" name="002.phpt" />
+    <file role="test" name="003.phpt" />
+   </dir>
+  </dir>
+ </contents>
+ <dependencies>
+  <required>
+   <php>
+    <min>7.0.0</min>
+   </php>
+   <pearinstaller>
+    <min>1.4.0</min>
+   </pearinstaller>
+  </required>
+ </dependencies>
+ <providesextension>propro</providesextension>
+ <extsrcrelease/>
+</package>
+
+/*
+    +--------------------------------------------------------------------+
+    | PECL :: propro                                                     |
+    +--------------------------------------------------------------------+
+    | Redistribution and use in source and binary forms, with or without |
+    | modification, are permitted provided that the conditions mentioned |
+    | in the accompanying LICENSE file are met.                          |
+    +--------------------------------------------------------------------+
+    | Copyright (c) 2013 Michael Wallner <mike@php.net>                  |
+    +--------------------------------------------------------------------+
+*/
+
+
+#ifdef HAVE_CONFIG_H
+#      include "config.h"
+#endif
+
+#include <php.h>
+#include <ext/standard/info.h>
+
+#include "php_propro_api.h"
+
+#define DEBUG_PROPRO 0
+
+static inline zval *get_referenced_zval(zval *ref)
+{
+       while (Z_ISREF_P(ref)) {
+               ref = Z_REFVAL_P(ref);
+       }
+       return ref;
+}
+
+php_property_proxy_t *php_property_proxy_init(zval *container, zend_string *member)
+{
+       php_property_proxy_t *proxy = ecalloc(1, sizeof(*proxy));
+
+       ZVAL_COPY(&proxy->container, get_referenced_zval(container));
+       proxy->member = zend_string_copy(member);
+
+       return proxy;
+}
+
+void php_property_proxy_free(php_property_proxy_t **proxy)
+{
+       if (*proxy) {
+               zval_ptr_dtor(&(*proxy)->container);
+               zend_string_release((*proxy)->member);
+               efree(*proxy);
+               *proxy = NULL;
+       }
+}
+
+static zend_class_entry *php_property_proxy_class_entry;
+static zend_object_handlers php_property_proxy_object_handlers;
+
+zend_class_entry *php_property_proxy_get_class_entry(void)
+{
+       return php_property_proxy_class_entry;
+}
+
+static inline php_property_proxy_object_t *get_propro(zval *object);
+static zval *get_parent_proxied_value(zval *object, zval *return_value);
+static zval *get_proxied_value(zval *object, zval *return_value);
+static zval *read_dimension(zval *object, zval *offset, int type, zval *return_value);
+static ZEND_RESULT_CODE cast_proxied_value(zval *object, zval *return_value, int type);
+static void write_dimension(zval *object, zval *offset, zval *value);
+static void set_proxied_value(zval *object, zval *value);
+
+#if DEBUG_PROPRO
+/* we do not really care about TS when debugging */
+static int level = 1;
+static const char space[] = "                               ";
+static const char *inoutstr[] = {"< return","="," > enter"};
+
+static void _walk(php_property_proxy_object_t *obj)
+{
+       if (obj) {
+               if (!Z_ISUNDEF(obj->parent)) {
+                       _walk(get_propro(&obj->parent));
+               }
+               if (obj->proxy) {
+                       fprintf(stderr, ".%s", obj->proxy->member->val);
+               }
+       }
+}
+
+static void debug_propro(int inout, const char *f,
+               php_property_proxy_object_t *obj, zval *offset, zval *value TSRMLS_DC)
+{
+       fprintf(stderr, "#PP %p %s %s %s ", obj, &space[sizeof(space)-level],
+                       inoutstr[inout+1], f);
+
+       level += inout;
+
+       _walk(obj);
+
+       if (*f++=='d'
+       &&      *f++=='i'
+       &&      *f++=='m'
+       ) {
+               char *offset_str = "[]";
+               zval *o = offset;
+
+               if (o) {
+                       convert_to_string_ex(o);
+                       offset_str = Z_STRVAL_P(o);
+               }
+
+               fprintf(stderr, ".%s", offset_str);
+
+               if (o && o != offset) {
+                       zval_ptr_dtor(o);
+               }
+       }
+       if (value && !Z_ISUNDEF_P(value)) {
+               const char *t[] = {
+                               "UNDEF",
+                               "NULL",
+                               "FALSE",
+                               "TRUE",
+                               "int",
+                               "float",
+                               "string",
+                               "Array",
+                               "Object",
+                               "resource",
+                               "reference",
+                               "constant",
+                               "constant AST",
+                               "_BOOL",
+                               "callable",
+                               "indirect",
+                               "---",
+                               "pointer"
+               };
+               fprintf(stderr, " = (%s) ", t[Z_TYPE_P(value)&0xf]);
+               if (!Z_ISUNDEF_P(value) && Z_TYPE_P(value) != IS_INDIRECT) {
+                       zend_print_flat_zval_r(value TSRMLS_CC);
+               }
+       }
+
+       fprintf(stderr, "\n");
+}
+#else
+#define debug_propro(l, f, obj, off, val)
+#endif
+
+php_property_proxy_object_t *php_property_proxy_object_new_ex(
+               zend_class_entry *ce, php_property_proxy_t *proxy)
+{
+       php_property_proxy_object_t *o;
+
+       if (!ce) {
+               ce = php_property_proxy_class_entry;
+       }
+
+       o = ecalloc(1, sizeof(*o) + sizeof(zval) * (ce->default_properties_count - 1));
+       zend_object_std_init(&o->zo, ce);
+       object_properties_init(&o->zo, ce);
+
+       o->proxy = proxy;
+       o->zo.handlers = &php_property_proxy_object_handlers;
+
+       debug_propro(0, "init", o, NULL, NULL);
+
+       return o;
+}
+
+zend_object *php_property_proxy_object_new(zend_class_entry *ce)
+{
+       return &php_property_proxy_object_new_ex(ce, NULL)->zo;
+}
+
+static void destroy_obj(zend_object *object)
+{
+       php_property_proxy_object_t *o = PHP_PROPRO_PTR(object);
+
+       debug_propro(0, "dtor", o, NULL, NULL);
+
+       if (o->proxy) {
+               php_property_proxy_free(&o->proxy);
+       }
+       if (!Z_ISUNDEF(o->parent)) {
+               zval_ptr_dtor(&o->parent);
+               ZVAL_UNDEF(&o->parent);
+       }
+       zend_object_std_dtor(object);
+}
+
+static inline php_property_proxy_object_t *get_propro(zval *object)
+{
+       object = get_referenced_zval(object);
+       switch (Z_TYPE_P(object)) {
+       case IS_OBJECT:
+               break;
+
+       EMPTY_SWITCH_DEFAULT_CASE();
+       }
+       return PHP_PROPRO_PTR(Z_OBJ_P(object));
+}
+
+static inline zend_bool got_value(zval *container, zval *value)
+{
+       zval identical;
+
+       if (!Z_ISUNDEF_P(value)) {
+               if (SUCCESS == is_identical_function(&identical, value, container)) {
+                       if (Z_TYPE(identical) != IS_TRUE) {
+                               return 1;
+                       }
+               }
+       }
+
+       return 0;
+}
+
+static zval *get_parent_proxied_value(zval *object, zval *return_value)
+{
+       php_property_proxy_object_t *obj;
+
+       obj = get_propro(object);
+       debug_propro(1, "parent_get", obj, NULL, NULL);
+
+       if (obj->proxy) {
+               if (!Z_ISUNDEF(obj->parent)) {
+                       get_proxied_value(&obj->parent, return_value);
+               }
+       }
+
+       debug_propro(-1, "parent_get", obj, NULL, return_value);
+
+       return return_value;
+}
+
+static zval *get_proxied_value(zval *object, zval *return_value)
+{
+       zval *hash_value, *ref, prop_tmp;
+       php_property_proxy_object_t *obj;
+
+       obj = get_propro(object);
+       debug_propro(1, "get", obj, NULL, NULL);
+
+       if (obj->proxy) {
+               if (!Z_ISUNDEF(obj->parent)) {
+                       zval parent_value;
+
+                       ZVAL_UNDEF(&parent_value);
+                       get_parent_proxied_value(object, &parent_value);
+
+                       if (got_value(&obj->proxy->container, &parent_value)) {
+                               zval_ptr_dtor(&obj->proxy->container);
+                               ZVAL_COPY(&obj->proxy->container, &parent_value);
+                       }
+               }
+
+               ref = get_referenced_zval(&obj->proxy->container);
+
+               switch (Z_TYPE_P(ref)) {
+               case IS_OBJECT:
+                       RETVAL_ZVAL(zend_read_property(Z_OBJCE_P(ref), ref,
+                                       obj->proxy->member->val, obj->proxy->member->len, 0, &prop_tmp),
+                                       0, 0);
+                       break;
+
+               case IS_ARRAY:
+                       hash_value = zend_symtable_find(Z_ARRVAL_P(ref), obj->proxy->member);
+
+                       if (hash_value) {
+                               RETVAL_ZVAL(hash_value, 0, 0);
+                       }
+                       break;
+               }
+       }
+
+       debug_propro(-1, "get", obj, NULL, return_value);
+
+       return return_value;
+}
+
+static ZEND_RESULT_CODE cast_proxied_value(zval *object, zval *return_value,
+               int type)
+{
+       get_proxied_value(object, return_value);
+
+       debug_propro(0, "cast", get_propro(object), NULL, return_value);
+
+       if (!Z_ISUNDEF_P(return_value)) {
+               convert_to_explicit_type_ex(return_value, type);
+               return SUCCESS;
+       }
+
+       return FAILURE;
+}
+
+static void set_proxied_value(zval *object, zval *value)
+{
+       php_property_proxy_object_t *obj;
+       zval *ref;
+
+       obj = get_propro(object);
+       debug_propro(1, "set", obj, NULL, value TSRMLS_CC);
+
+       if (obj->proxy) {
+               if (!Z_ISUNDEF(obj->parent)) {
+                       zval parent_value;
+
+                       ZVAL_UNDEF(&parent_value);
+                       get_parent_proxied_value(object, &parent_value);
+
+                       if (got_value(&obj->proxy->container, &parent_value)) {
+                               zval_ptr_dtor(&obj->proxy->container);
+                               ZVAL_COPY(&obj->proxy->container, &parent_value);
+                       }
+               }
+
+               ref = get_referenced_zval(&obj->proxy->container);
+
+               switch (Z_TYPE_P(ref)) {
+               case IS_OBJECT:
+                       zend_update_property(Z_OBJCE_P(ref), ref, obj->proxy->member->val,
+                                       obj->proxy->member->len, value);
+                       break;
+
+               default:
+                       convert_to_array(ref);
+                       /* no break */
+
+               case IS_ARRAY:
+                       Z_TRY_ADDREF_P(value);
+                       zend_symtable_update(Z_ARRVAL_P(ref), obj->proxy->member, value);
+                       break;
+               }
+
+               if (!Z_ISUNDEF(obj->parent)) {
+                       set_proxied_value(&obj->parent, &obj->proxy->container);
+               }
+       }
+
+       debug_propro(-1, "set", obj, NULL, NULL);
+}
+
+static zval *read_dimension(zval *object, zval *offset, int type, zval *return_value)
+{
+       zval proxied_value;
+       zend_string *member = offset ? zval_get_string(offset) : NULL;
+
+       debug_propro(1, type == BP_VAR_R ? "dim_read" : "dim_read_ref",
+                       get_propro(object), offset, NULL);
+
+       ZVAL_UNDEF(&proxied_value);
+       get_proxied_value(object, &proxied_value);
+
+       if (BP_VAR_R == type && member && !Z_ISUNDEF(proxied_value)) {
+               if (Z_TYPE(proxied_value) == IS_ARRAY) {
+                       zval *hash_value = zend_symtable_find(Z_ARRVAL(proxied_value),
+                                       member);
+
+                       if (hash_value) {
+                               RETVAL_ZVAL(hash_value, 1, 0);
+                       }
+               }
+       } else {
+               php_property_proxy_t *proxy;
+               php_property_proxy_object_t *proxy_obj;
+
+               if (!Z_ISUNDEF(proxied_value)) {
+                       convert_to_array(&proxied_value);
+                       Z_ADDREF(proxied_value);
+               } else {
+                       array_init(&proxied_value);
+                       set_proxied_value(object, &proxied_value);
+               }
+
+               if (!member) {
+                       member = zend_long_to_str(zend_hash_next_free_element(
+                                       Z_ARRVAL(proxied_value)));
+               }
+
+               proxy = php_property_proxy_init(&proxied_value, member);
+               zval_ptr_dtor(&proxied_value);
+
+               proxy_obj = php_property_proxy_object_new_ex(NULL, proxy);
+               ZVAL_COPY(&proxy_obj->parent, object);
+               RETVAL_OBJ(&proxy_obj->zo);
+       }
+
+       if (member) {
+               zend_string_release(member);
+       }
+
+       debug_propro(-1, type == BP_VAR_R ? "dim_read" : "dim_read_ref",
+                       get_propro(object), offset, return_value);
+
+       return return_value;
+}
+
+static int has_dimension(zval *object, zval *offset, int check_empty)
+{
+       zval proxied_value;
+       int exists = 0;
+
+       debug_propro(1, "dim_exists", get_propro(object), offset, NULL);
+
+       ZVAL_UNDEF(&proxied_value);
+       get_proxied_value(object, &proxied_value);
+       if (Z_ISUNDEF(proxied_value)) {
+               exists = 0;
+       } else {
+               zend_string *zs = zval_get_string(offset);
+
+               if (Z_TYPE(proxied_value) == IS_ARRAY) {
+                       zval *zentry = zend_symtable_find(Z_ARRVAL(proxied_value), zs);
+
+                       if (!zentry) {
+                               exists = 0;
+                       } else {
+                               if (check_empty) {
+                                       exists = !Z_ISNULL_P(zentry);
+                               } else {
+                                       exists = 1;
+                               }
+                       }
+               }
+
+               zend_string_release(zs);
+       }
+
+       debug_propro(-1, "dim_exists", get_propro(object), offset, NULL);
+
+       return exists;
+}
+
+static void write_dimension(zval *object, zval *offset, zval *value)
+{
+       zval proxied_value;
+
+       debug_propro(1, "dim_write", get_propro(object), offset, value);
+
+       ZVAL_UNDEF(&proxied_value);
+       get_proxied_value(object, &proxied_value);
+
+       if (!Z_ISUNDEF(proxied_value)) {
+               if (Z_TYPE(proxied_value) == IS_ARRAY) {
+                       Z_ADDREF(proxied_value);
+               } else {
+                       convert_to_array(&proxied_value);
+               }
+       } else {
+               array_init(&proxied_value);
+       }
+
+       SEPARATE_ZVAL(value);
+       Z_TRY_ADDREF_P(value);
+
+       if (offset) {
+               zend_string *zs = zval_get_string(offset);
+               zend_symtable_update(Z_ARRVAL(proxied_value), zs, value);
+               zend_string_release(zs);
+       } else {
+               zend_hash_next_index_insert(Z_ARRVAL(proxied_value), value);
+       }
+
+       set_proxied_value(object, &proxied_value);
+
+       debug_propro(-1, "dim_write", get_propro(object), offset, &proxied_value);
+
+       zval_ptr_dtor(&proxied_value);
+}
+
+static void unset_dimension(zval *object, zval *offset)
+{
+       zval proxied_value;
+
+       debug_propro(1, "dim_unset", get_propro(object), offset, NULL);
+
+       ZVAL_UNDEF(&proxied_value);
+       get_proxied_value(object, &proxied_value);
+
+       if (Z_TYPE(proxied_value) == IS_ARRAY) {
+               zval *o = offset;
+               ZEND_RESULT_CODE rv;
+
+               convert_to_string_ex(o);
+               rv = zend_symtable_del(Z_ARRVAL(proxied_value), Z_STR_P(o));
+               if (SUCCESS == rv) {
+                       set_proxied_value(object, &proxied_value);
+               }
+
+               if (o != offset) {
+                       zval_ptr_dtor(o);
+               }
+       }
+
+       debug_propro(-1, "dim_unset", get_propro(object), offset, &proxied_value);
+}
+
+ZEND_BEGIN_ARG_INFO_EX(ai_propro_construct, 0, 0, 2)
+       ZEND_ARG_INFO(1, object)
+       ZEND_ARG_INFO(0, member)
+       ZEND_ARG_OBJ_INFO(0, parent, php\\PropertyProxy, 1)
+ZEND_END_ARG_INFO();
+static PHP_METHOD(propro, __construct) {
+       zend_error_handling zeh;
+       zval *container, *parent = NULL;
+       zend_string *member;
+
+       zend_replace_error_handling(EH_THROW, NULL, &zeh);
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "zS|O!",
+                       &container, &member, &parent,
+                       php_property_proxy_class_entry)) {
+               php_property_proxy_object_t *obj;
+               zval *ref = get_referenced_zval(container);
+
+               switch (Z_TYPE_P(ref)) {
+               case IS_OBJECT:
+               case IS_ARRAY:
+                       break;
+               default:
+                       convert_to_array(ref);
+               }
+               obj = get_propro(getThis());
+               obj->proxy = php_property_proxy_init(container, member);
+               if (parent) {
+                       ZVAL_COPY(&obj->parent, parent);
+               }
+       }
+       zend_restore_error_handling(&zeh);
+}
+
+static const zend_function_entry php_property_proxy_method_entry[] = {
+       PHP_ME(propro, __construct, ai_propro_construct, ZEND_ACC_PUBLIC)
+       {0}
+};
+
+static PHP_MINIT_FUNCTION(propro)
+{
+       zend_class_entry ce = {0};
+
+       INIT_NS_CLASS_ENTRY(ce, "php", "PropertyProxy",
+                       php_property_proxy_method_entry);
+       php_property_proxy_class_entry = zend_register_internal_class(&ce);
+       php_property_proxy_class_entry->create_object = php_property_proxy_object_new;
+       php_property_proxy_class_entry->ce_flags |= ZEND_ACC_FINAL;
+
+       memcpy(&php_property_proxy_object_handlers, zend_get_std_object_handlers(),
+                       sizeof(zend_object_handlers));
+       php_property_proxy_object_handlers.offset = XtOffsetOf(php_property_proxy_object_t, zo);
+       php_property_proxy_object_handlers.free_obj = destroy_obj;
+       php_property_proxy_object_handlers.set = set_proxied_value;
+       php_property_proxy_object_handlers.get = get_proxied_value;
+       php_property_proxy_object_handlers.cast_object = cast_proxied_value;
+       php_property_proxy_object_handlers.read_dimension = read_dimension;
+       php_property_proxy_object_handlers.write_dimension = write_dimension;
+       php_property_proxy_object_handlers.has_dimension = has_dimension;
+       php_property_proxy_object_handlers.unset_dimension = unset_dimension;
+
+       return SUCCESS;
+}
+
+PHP_MINFO_FUNCTION(propro)
+{
+       php_info_print_table_start();
+       php_info_print_table_header(2, "Property proxy support", "enabled");
+       php_info_print_table_row(2, "Extension version", PHP_PROPRO_VERSION);
+       php_info_print_table_end();
+}
+
+static const zend_function_entry propro_functions[] = {
+       {0}
+};
+
+zend_module_entry propro_module_entry = {
+       STANDARD_MODULE_HEADER,
+       "propro",
+       propro_functions,
+       PHP_MINIT(propro),
+       NULL,
+       NULL,
+       NULL,
+       PHP_MINFO(propro),
+       PHP_PROPRO_VERSION,
+       STANDARD_MODULE_PROPERTIES
+};
+
+#ifdef COMPILE_DL_PROPRO
+ZEND_GET_MODULE(propro)
+#endif
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+/*
+    +--------------------------------------------------------------------+
+    | PECL :: propro                                                     |
+    +--------------------------------------------------------------------+
+    | Redistribution and use in source and binary forms, with or without |
+    | modification, are permitted provided that the conditions mentioned |
+    | in the accompanying LICENSE file are met.                          |
+    +--------------------------------------------------------------------+
+    | Copyright (c) 2013 Michael Wallner <mike@php.net>                  |
+    +--------------------------------------------------------------------+
+*/
+
+#ifndef PHP_PROPRO_H
+#define PHP_PROPRO_H
+
+extern zend_module_entry propro_module_entry;
+#define phpext_propro_ptr &propro_module_entry
+
+#define PHP_PROPRO_VERSION "2.0.0dev"
+
+#ifdef PHP_WIN32
+#      define PHP_PROPRO_API __declspec(dllexport)
+#elif defined(__GNUC__) && __GNUC__ >= 4
+#      define PHP_PROPRO_API extern __attribute__ ((visibility("default")))
+#else
+#      define PHP_PROPRO_API extern
+#endif
+
+#ifdef ZTS
+#      include <TSRM/TSRM.h>
+#endif
+
+#define PHP_PROPRO_PTR(zo) (void*)(((char*)(zo))-(zo)->handlers->offset)
+
+#endif /* PHP_PROPRO_H */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+/*
+    +--------------------------------------------------------------------+
+    | PECL :: propro                                                     |
+    +--------------------------------------------------------------------+
+    | Redistribution and use in source and binary forms, with or without |
+    | modification, are permitted provided that the conditions mentioned |
+    | in the accompanying LICENSE file are met.                          |
+    +--------------------------------------------------------------------+
+    | Copyright (c) 2013 Michael Wallner <mike@php.net>                  |
+    +--------------------------------------------------------------------+
+*/
+
+#ifndef PHP_PROPRO_API_H
+#define PHP_PROPRO_API_H
+
+#include "php_propro.h"
+
+/**
+ * The internal property proxy.
+ *
+ * Container for the object/array holding the proxied property.
+ */
+struct php_property_proxy {
+       /** The container holding the property */
+       zval container;
+       /** The name of the proxied property */
+       zend_string *member;
+};
+typedef struct php_property_proxy php_property_proxy_t;
+
+/**
+ * The userland object.
+ *
+ * Return an object instance of php\\PropertyProxy to make your C-struct
+ * member accessible by reference from PHP userland.
+ *
+ * Example:
+ * ~~~~~~~~~~{.c}
+ * static zval *my_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *tmp)
+ * {
+ *    zval *return_value;
+ *    zend_string *member_name = zval_get_string(member);
+ *    my_prophandler_t *handler = my_get_prophandler(member_name);
+ *
+ *    if (!handler || type == BP_VAR_R || type == BP_VAR_IS) {
+ *     return_value = zend_get_std_object_handlers()->read_property(object, member, type, cache_slot, tmp);
+ *
+ *     if (handler) {
+ *             handler->read(object, tmp);
+ *
+ *             zval_ptr_dtor(return_value);
+ *             ZVAL_COPY_VALUE(return_value, tmp);
+ *     }
+ *    } else {
+ *     return_value = php_property_proxy_zval(object, member_name);
+ *    }
+ *
+ *    zend_string_release(member_name);
+ *
+ *    return return_value;
+ * }
+ * ~~~~~~~~~~
+ */
+struct php_property_proxy_object {
+       /** The actual property proxy */
+       php_property_proxy_t *proxy;
+       /** Any parent property proxy object */
+       zval parent;
+       /** The std zend_object */
+       zend_object zo;
+};
+typedef struct php_property_proxy_object php_property_proxy_object_t;
+
+/**
+ * Create a property proxy
+ *
+ * The property proxy will forward reads and writes to itself to the
+ * proxied property with name \a member_str of \a container.
+ *
+ * @param container the container holding the property
+ * @param member the name of the proxied property
+ * @return a new property proxy
+ */
+PHP_PROPRO_API php_property_proxy_t *php_property_proxy_init(zval *container,
+               zend_string *member);
+
+/**
+ * Destroy and free a property proxy.
+ *
+ * The destruction of the property proxy object calls this.
+ *
+ * @param proxy a pointer to the allocated property proxy
+ */
+PHP_PROPRO_API void php_property_proxy_free(php_property_proxy_t **proxy);
+
+/**
+ * Get the zend_class_entry of php\\PropertyProxy
+ * @return the class entry pointer
+ */
+PHP_PROPRO_API zend_class_entry *php_property_proxy_get_class_entry(void);
+
+/**
+ * Instantiate a new php\\PropertyProxy
+ * @param ce the property proxy or derived class entry
+ * @return the zend object
+ */
+PHP_PROPRO_API zend_object *php_property_proxy_object_new(zend_class_entry *ce);
+
+/**
+ * Instantiate a new php\\PropertyProxy with \a proxy
+ * @param ce the property proxy or derived class entry
+ * @param proxy the internal property proxy
+ * @return the property proxy
+ */
+PHP_PROPRO_API php_property_proxy_object_t *php_property_proxy_object_new_ex(
+               zend_class_entry *ce, php_property_proxy_t *proxy);
+
+#endif /* PHP_PROPRO_API_H */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+--TEST--
+property proxy
+--SKIPIF--
+<?php if (!extension_loaded("propro")) print "skip"; ?>
+--FILE--
+<?php
+
+echo "Test\n";
+
+class c {
+       private $prop;
+       private $anon;
+       function __get($p) {
+               return new php\PropertyProxy($this, $p);
+       }
+}
+
+$c = new c;
+
+$p = $c->prop;
+$a = $c->anon;
+
+var_dump($c);
+
+echo "set\n";
+$a = 123; 
+echo "get\n";
+echo $a,"\n";
+
+$p["foo"] = 123;
+$p["bar"]["baz"]["a"]["b"]=987;
+
+var_dump($c);
+
+?>
+DONE
+--EXPECTF--
+Test
+object(c)#%d (2) {
+  ["prop":"c":private]=>
+  NULL
+  ["anon":"c":private]=>
+  NULL
+}
+set
+get
+123
+object(c)#%d (2) {
+  ["prop":"c":private]=>
+  array(2) {
+    ["foo"]=>
+    int(123)
+    ["bar"]=>
+    array(1) {
+      ["baz"]=>
+      array(1) {
+        ["a"]=>
+        array(1) {
+          ["b"]=>
+          int(987)
+        }
+      }
+    }
+  }
+  ["anon":"c":private]=>
+  int(123)
+}
+DONE
+--TEST--
+property proxy
+--SKIPIF--
+<?php if (!extension_loaded("propro")) print "skip"; ?>
+--FILE--
+<?php
+
+echo "Test\n";
+
+class c {
+       private $storage = array();
+       function __get($p) {
+               return new php\PropertyProxy($this->storage, $p);
+       }
+       function __set($p, $v) {
+               $this->storage[$p] = $v;
+       }
+}
+
+$c = new c;
+$c->data["foo"] = 1;
+var_dump(
+       isset($c->data["foo"]),
+       isset($c->data["bar"])
+);
+
+var_dump($c);
+
+$c->data[] = 1;
+$c->data[] = 2;
+$c->data[] = 3;
+$c->data["bar"][] = 123;
+$c->data["bar"][] = 456;
+
+var_dump($c);
+unset($c->data["bar"][0]);
+
+var_dump($c);
+
+?>
+DONE
+--EXPECTF--
+Test
+bool(true)
+bool(false)
+object(c)#%d (1) {
+  ["storage":"c":private]=>
+  array(1) {
+    ["data"]=>
+    array(1) {
+      ["foo"]=>
+      int(1)
+    }
+  }
+}
+object(c)#%d (1) {
+  ["storage":"c":private]=>
+  array(1) {
+    ["data"]=>
+    array(5) {
+      ["foo"]=>
+      int(1)
+      [0]=>
+      int(1)
+      [1]=>
+      int(2)
+      [2]=>
+      int(3)
+      ["bar"]=>
+      array(2) {
+        [0]=>
+        int(123)
+        [1]=>
+        int(456)
+      }
+    }
+  }
+}
+object(c)#%d (1) {
+  ["storage":"c":private]=>
+  array(1) {
+    ["data"]=>
+    array(5) {
+      ["foo"]=>
+      int(1)
+      [0]=>
+      int(1)
+      [1]=>
+      int(2)
+      [2]=>
+      int(3)
+      ["bar"]=>
+      array(1) {
+        [1]=>
+        int(456)
+      }
+    }
+  }
+}
+DONE
+--TEST--
+property proxy
+--SKIPIF--
+<?php 
+extension_loaded("propro") || print "skip";
+?>
+--FILE--
+<?php 
+echo "Test\n";
+
+class t {
+       private $ref;
+       function __get($v) {
+               return new php\PropertyProxy($this, $v);
+       } 
+}
+
+$t = new t;
+$r = &$t->ref;
+$r = 1;
+var_dump($t);
+$t->ref[] = 2;
+var_dump($t);
+?>
+===DONE===
+--EXPECTF--
+Test
+object(t)#%d (1) {
+  ["ref":"t":private]=>
+  int(1)
+}
+object(t)#%d (1) {
+  ["ref":"t":private]=>
+  array(2) {
+    [0]=>
+    int(1)
+    [1]=>
+    int(2)
+  }
+}
+===DONE===\1f\9ehz%Ý dþ¨éñ ÜRÃ`Ç\95ý\ 2\0\0\0GBMB
\ No newline at end of file
diff --git a/travis/raphf-2.0.0-dev.ext.phar b/travis/raphf-2.0.0-dev.ext.phar
deleted file mode 100755 (executable)
index ec4d0d4..0000000
+++ /dev/null
@@ -1,6208 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-/**
- * The installer sub-stub for extension phars
- */
-
-namespace pharext;
-
-define("PHAREXT_PHAR", __FILE__);
-
-spl_autoload_register(function($c) {
-       return include strtr($c, "\\_", "//") . ".php";
-});
-
-
-
-namespace pharext;
-
-class Exception extends \Exception
-{
-       public function __construct($message = null, $code = 0, $previous = null) {
-               if (!isset($message)) {
-                       $last_error = error_get_last();
-                       $message = $last_error["message"];
-                       if (!$code) {
-                               $code = $last_error["type"];
-                       }
-               }
-               parent::__construct($message, $code, $previous);
-       }
-}
-
-
-
-namespace pharext;
-
-use pharext\Exception;
-
-/**
- * A temporary file/directory name
- */
-class Tempname
-{
-       /**
-        * @var string
-        */
-       private $name;
-
-       /**
-        * @param string $prefix uniqid() prefix
-        * @param string $suffix e.g. file extension
-        */
-       public function __construct($prefix, $suffix = null) {
-               $temp = sys_get_temp_dir() . "/pharext-" . $this->getUser();
-               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
-                       throw new Exception;
-               }
-               $this->name = $temp ."/". uniqid($prefix) . $suffix;
-       }
-
-       private function getUser() {
-               if (extension_loaded("posix") && function_exists("posix_getpwuid")) {
-                       return posix_getpwuid(posix_getuid())["name"];
-               }
-               return trim(`whoami 2>/dev/null`)
-                       ?: trim(`id -nu 2>/dev/null`)
-                       ?: getenv("USER")
-                       ?: get_current_user();
-       }
-
-       /**
-        * @return string
-        */
-       public function __toString() {
-               return (string) $this->name;
-       }
-}
-
-
-namespace pharext;
-
-/**
- * Create a new temporary file
- */
-class Tempfile extends \SplFileInfo
-{
-       /**
-        * @var resource
-        */
-       private $handle;
-
-       /**
-        * @param string $prefix uniqid() prefix
-        * @param string $suffix e.g. file extension
-        * @throws \pharext\Exception
-        */
-       public function __construct($prefix, $suffix = ".tmp") {
-               $tries = 0;
-               $omask = umask(077);
-               do {
-                       $path = new Tempname($prefix, $suffix);
-                       $this->handle = fopen($path, "x");
-               } while (!is_resource($this->handle) && $tries++ < 10);
-               umask($omask);
-               
-               if (!is_resource($this->handle)) {
-                       throw new Exception("Could not create temporary file");
-               }
-               
-               parent::__construct($path);
-       }
-
-       /**
-        * Unlink the file
-        */
-       public function __destruct() {
-               if (is_file($this->getPathname())) {
-                       @unlink($this->getPathname());
-               }
-       }
-
-       /**
-        * Close the stream
-        */
-       public function closeStream() {
-               fclose($this->handle);
-       }
-
-       /**
-        * Retrieve the stream resource
-        * @return resource
-        */
-       public function getStream() {
-               return $this->handle;
-       }
-}
-
-
-
-namespace pharext;
-
-/**
- * Create a temporary directory
- */
-class Tempdir extends \SplFileInfo
-{
-       /**
-        * @param string $prefix prefix to uniqid()
-        * @throws \pharext\Exception
-        */
-       public function __construct($prefix) {
-               $temp = new Tempname($prefix);
-               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
-                       throw new Exception("Could not create tempdir: ".error_get_last()["message"]);
-               }
-               parent::__construct($temp);
-       }
-}
-
-
-
-namespace pharext;
-
-use ArrayAccess;
-use IteratorAggregate;
-use RecursiveDirectoryIterator;
-use SplFileInfo;
-
-use pharext\Exception;
-
-class Archive implements ArrayAccess, IteratorAggregate
-{
-       const HALT_COMPILER = "\137\137\150\141\154\164\137\143\157\155\160\151\154\145\162\50\51\73";
-       const SIGNED = 0x10000;
-       const SIG_MD5    = 0x0001;
-       const SIG_SHA1   = 0x0002;
-       const SIG_SHA256 = 0x0003;
-       const SIG_SHA512 = 0x0004;
-       const SIG_OPENSSL= 0x0010;
-
-       private static $siglen = [
-               self::SIG_MD5    => 16,
-               self::SIG_SHA1   => 20,
-               self::SIG_SHA256 => 32,
-               self::SIG_SHA512 => 64,
-               self::SIG_OPENSSL=> 0
-       ];
-
-       private static $sigalg = [
-               self::SIG_MD5    => "md5",
-               self::SIG_SHA1   => "sha1",
-               self::SIG_SHA256 => "sha256",
-               self::SIG_SHA512 => "sha512",
-               self::SIG_OPENSSL=> "openssl"
-       ];
-
-       private static $sigtyp = [
-               self::SIG_MD5    => "MD5",
-               self::SIG_SHA1   => "SHA-1",
-               self::SIG_SHA256 => "SHA-256",
-               self::SIG_SHA512 => "SHA-512",
-               self::SIG_OPENSSL=> "OpenSSL",
-       ];
-
-       const PERM_FILE_MASK = 0x01ff;
-       const COMP_FILE_MASK = 0xf000;
-       const COMP_GZ_FILE   = 0x1000;
-       const COMP_BZ2_FILE  = 0x2000;
-
-       const COMP_PHAR_MASK= 0xf000;
-       const COMP_PHAR_GZ  = 0x1000;
-       const COMP_PHAR_BZ2 = 0x2000;
-
-       private $file;
-       private $fd;
-       private $stub;
-       private $manifest;
-       private $signature;
-       private $extracted;
-
-       function __construct($file = null) {
-               if (strlen($file)) {
-                       $this->open($file);
-               }
-       }
-
-       function open($file) {
-               if (!$this->fd = @fopen($file, "r")) {
-                       throw new Exception;
-               }
-               $this->file = $file;
-               $this->stub = $this->readStub();
-               $this->manifest = $this->readManifest();
-               $this->signature = $this->readSignature();
-       }
-
-       function getIterator() {
-               return new RecursiveDirectoryIterator($this->extract());
-       }
-
-       function extract() {
-               return $this->extracted ?: $this->extractTo(new Tempdir("archive"));
-       }
-
-       function extractTo($dir) {
-               if ((string) $this->extracted == (string) $dir) {
-                       return $this->extracted;
-               }
-               foreach ($this->manifest["entries"] as $file => $entry) {
-                       fseek($this->fd, $this->manifest["offset"]+$entry["offset"]);
-                       $path = "$dir/$file";
-                       $copy = stream_copy_to_stream($this->fd, $this->outFd($path, $entry["flags"]), $entry["csize"]);
-                       if ($entry["osize"] != $copy) {
-                               throw new Exception("Copied '$copy' of '$file', expected '{$entry["osize"]}' from '{$entry["csize"]}");
-                       }
-
-                       $crc = hexdec(hash_file("crc32b", $path));
-                       if ($crc !== $entry["crc32"]) {
-                               throw new Exception("CRC mismatch of '$file': '$crc' != '{$entry["crc32"]}");
-                       }
-
-                       chmod($path, $entry["flags"] & self::PERM_FILE_MASK);
-                       touch($path, $entry["stamp"]);
-               }
-               return $this->extracted = $dir;
-       }
-
-       function offsetExists($o) {
-               return isset($this->entries[$o]);
-       }
-
-       function offsetGet($o) {
-               $this->extract();
-               return new SplFileInfo($this->extracted."/$o");
-       }
-
-       function offsetSet($o, $v) {
-               throw new Exception("Archive is read-only");
-       }
-
-       function offsetUnset($o) {
-               throw new Exception("Archive is read-only");
-       }
-
-       function getSignature() {
-               /* compatible with Phar::getSignature() */
-               return [
-                       "hash_type" => self::$sigtyp[$this->signature["flags"]],
-                       "hash" => strtoupper(bin2hex($this->signature["hash"])),
-               ];
-       }
-
-       function getPath() {
-               /* compatible with Phar::getPath() */
-               return new SplFileInfo($this->file);
-       }
-
-       function getMetadata($key = null) {
-               if (isset($key)) {
-                       return $this->manifest["meta"][$key];
-               }
-               return $this->manifest["meta"];
-       }
-
-       private function outFd($path, $flags) {
-                       $dirn = dirname($path);
-                       if (!is_dir($dirn) && !@mkdir($dirn, 0777, true)) {
-                               throw new Exception;
-                       }
-                       if (!$fd = @fopen($path, "w")) {
-                               throw new Exception;
-                       }
-                       switch ($flags & self::COMP_FILE_MASK) {
-                       case self::COMP_GZ_FILE:
-                               if (!@stream_filter_append($fd, "zlib.inflate")) {
-                                       throw new Exception;
-                               }
-                               break;
-                       case self::COMP_BZ2_FILE:
-                               if (!@stream_filter_append($fd, "bz2.decompress")) {
-                                       throw new Exception;
-                               }
-                               break;
-                       }
-
-       }
-       private function readVerified($fd, $len) {
-               if ($len != strlen($data = fread($fd, $len))) {
-                       throw new Exception("Unexpected EOF");
-               }
-               return $data;
-       }
-
-       private function readFormat($format, $fd, $len) {
-               if (false === ($data = @unpack($format, $this->readVerified($fd, $len)))) {
-                       throw new Exception;
-               }
-               return $data;
-       }
-
-       private function readSingleFormat($format, $fd, $len) {
-               return current($this->readFormat($format, $fd, $len));
-       }
-
-       private function readStringBinary($fd) {
-               if (($length = $this->readSingleFormat("V", $fd, 4))) {
-                       return $this->readVerified($this->fd, $length);
-               }
-               return null;
-       }
-
-       private function readSerializedBinary($fd) {
-               if (($length = $this->readSingleFormat("V", $fd, 4))) {
-                       if (false === ($data = unserialize($this->readVerified($fd, $length)))) {
-                               throw new Exception;
-                       }
-                       return $data;
-               }
-               return null;
-       }
-
-       private function readStub() {
-               $stub = "";
-               while (!feof($this->fd)) {
-                       $line = fgets($this->fd);
-                       $stub .= $line;
-                       if (false !== stripos($line, self::HALT_COMPILER)) {
-                               /* check for '?>' on a separate line */
-                               if ('?>' === $this->readVerified($this->fd, 2)) {
-                                       $stub .= '?>' . fgets($this->fd);
-                               } else {
-                                       fseek($this->fd, -2, SEEK_CUR);
-                               }
-                               break;
-                       }
-               }
-               return $stub;
-       }
-
-       private function readManifest() {
-               $current = ftell($this->fd);
-               $header = $this->readFormat("Vlen/Vnum/napi/Vflags", $this->fd, 14);
-               $alias = $this->readStringBinary($this->fd);
-               $meta = $this->readSerializedBinary($this->fd);
-               $entries = [];
-               for ($i = 0; $i < $header["num"]; ++$i) {
-                       $this->readEntry($entries);
-               }
-               $offset = ftell($this->fd);
-               if (($length = $offset - $current - 4) != $header["len"]) {
-                       throw new Exception("Manifest length read was '$length', expected '{$header["len"]}'");
-               }
-               return $header + compact("alias", "meta", "entries", "offset");
-       }
-
-       private function readEntry(array &$entries) {
-               if (!count($entries)) {
-                       $offset = 0;
-               } else {
-                       $last = end($entries);
-                       $offset = $last["offset"] + $last["csize"];
-               }
-               $file = $this->readStringBinary($this->fd);
-               if (!strlen($file)) {
-                       throw new Exception("Empty file name encountered at offset '$offset'");
-               }
-               $header = $this->readFormat("Vosize/Vstamp/Vcsize/Vcrc32/Vflags", $this->fd, 20);
-               $meta = $this->readSerializedBinary($this->fd);
-               $entries[$file] =  $header + compact("meta", "offset");
-       }
-
-       private function readSignature() {
-               fseek($this->fd, -8, SEEK_END);
-               $sig = $this->readFormat("Vflags/Z4magic", $this->fd, 8);
-               $end = ftell($this->fd);
-
-               if ($sig["magic"] !== "GBMB") {
-                       throw new Exception("Invalid signature magic value '{$sig["magic"]}");
-               }
-
-               switch ($sig["flags"]) {
-               case self::SIG_OPENSSL:
-                       fseek($this->fd, -12, SEEK_END);
-                       if (($hash = $this->readSingleFormat("V", $this->fd, 4))) {
-                               $offset = 4 + $hash;
-                               fseek($this->fd, -$offset, SEEK_CUR);
-                               $hash = $this->readVerified($this->fd, $hash);
-                               fseek($this->fd, 0, SEEK_SET);
-                               $valid = openssl_verify($this->readVerified($this->fd, $end - $offset - 8),
-                                       $hash, @file_get_contents($this->file.".pubkey")) === 1;
-                       }
-                       break;
-
-               case self::SIG_MD5:
-               case self::SIG_SHA1:
-               case self::SIG_SHA256:
-               case self::SIG_SHA512:
-                       $offset = 8 + self::$siglen[$sig["flags"]];
-                       fseek($this->fd, -$offset, SEEK_END);
-                       $hash = $this->readVerified($this->fd, self::$siglen[$sig["flags"]]);
-                       $algo = hash_init(self::$sigalg[$sig["flags"]]);
-                       fseek($this->fd, 0, SEEK_SET);
-                       hash_update_stream($algo, $this->fd, $end - $offset);
-                       $valid = hash_final($algo, true) === $hash;
-                       break;
-
-               default:
-                       throw new Exception("Invalid signature type '{$sig["flags"]}");
-               }
-
-               return $sig + compact("hash", "valid");
-       }
-}
-
-
-namespace pharext;
-
-if (extension_loaded("Phar")) {
-       \Phar::interceptFileFuncs();
-       \Phar::mapPhar();
-       $phardir = "phar://".__FILE__;
-} else {
-       $archive = new Archive(__FILE__);
-       $phardir = $archive->extract();
-}
-
-set_include_path("$phardir:". get_include_path());
-
-$installer = new Installer();
-$installer->run($argc, $argv);
-
-__HALT_COMPILER(); ?>\r
\10\0\07\0\0\0\11\0\0\0\ 1\0\0\0\0\0,\ 6\0\0a:7:{s:7:"version";s:5:"4.1.1";s:6:"header";s:49:"pharext v4.1.1 (c) Michael Wallner <mike@php.net>";s:4:"date";s:10:"2015-09-28";s:4:"name";s:5:"raphf";s:7:"release";s:9:"2.0.0-dev";s:7:"license";s:1345:"Copyright (c) 2013, Michael Wallner <mike@php.net>.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without 
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice, 
-      this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright 
-      notice, this list of conditions and the following disclaimer in the 
-      documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-";s:4:"type";s:9:"extension";}\13\0\0\0pharext/Archive.php\18\1e\0\0\94h    V\18\1e\0\04-ÔI¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Cli/Args/Help.phpÉ\f\0\0\94h    VÉ\f\0\0gX'\1f\ 1\0\0\0\0\0\0\14\0\0\0pharext/Cli/Args.php\ f\1d\0\0\94h V\ f\1d\0\0?n\9dö¶\ 1\0\0\0\0\0\0\17\0\0\0pharext/Cli/Command.phpk   \0\0\94h    Vk      \0\0d\84aê¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/Command.php\12\ 4\0\0\94h     V\12\ 4\0\0Ôm`Ͷ\ 1\0\0\0\0\0\0\15\0\0\0pharext/Exception.phpc\ 1\0\0\94h        Vc\ 1\0\0U\86Ï{¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/ExecCmd.php\1c\ e\0\0\94h  V\1c\ e\0\0¹l\94ʶ\ 1\0\0\0\0\0\0\15\0\0\0pharext/Installer.php&\18\0\0\94h        V&\18\0\0ød&À¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/License.php\93\ 4\0\0\94h  V\93\ 4\0\0î\ 4òE¶\ 1\0\0\0\0\0\0\14\0\0\0pharext/Metadata.php\95\ 1\0\0\94h V\95\ 1\0\0¿Ú\90\9e\ 1\0\0\0\0\0\0\1e\0\0\0pharext/Openssl/PrivateKey.phpÁ\ 4\0\0\94h       VÁ\ 4\0\0&æP\1a\ 1\0\0\0\0\0\0\14\0\0\0pharext/Packager.phpÌ!\0\0\94h VÌ!\0\00\ 2\ 3\ 1\0\0\0\0\0\0\e\0\0\0pharext/SourceDir/Basic.phpz\ 5\0\0\94h  Vz\ 5\0\0÷+Ôâ¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/SourceDir/Git.phpZ\ 6\0\0\94h    VZ\ 6\0\0É\bÎ\¶\ 1\0\0\0\0\0\0\1a\0\0\0pharext/SourceDir/Pecl.phpø\11\0\0\94h   Vø\11\0\0ã\bùж\ 1\0\0\0\0\0\0\15\0\0\0pharext/SourceDir.php½\ 2\0\0\94h        V½\ 2\0\03·#\ f\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/Activate.phpÜ\v\0\0\94h    VÜ\v\0\0I\93\1c\18\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Askpass.phpU\ 2\0\0\94h     VU\ 2\0\0\87*\1e\90\ 1\0\0\0\0\0\0 \0\0\0pharext/Task/BundleGenerator.php}\ 2\0\0\94h     V}\ 2\0\0 ï`Y¶\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Cleanup.php\1e\ 4\0\0\94h     V\1e\ 4\0\0ÉI\80\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/Configure.phpT\ 4\0\0\94h   VT\ 4\0\0}\17Ëì¶\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Extract.phpp\ 3\0\0\94h     Vp\ 3\0\0[¨Û̶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/GitClone.phpm\ 3\0\0\94h    Vm\ 3\0\0óyµ@¶\ 1\0\0\0\0\0\0\15\0\0\0pharext/Task/Make.phpª\ 4\0\0\94h        Vª\ 4\0\0\9cç6\r\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PaxFixup.php¬\ 3\0\0\94h    V¬\ 3\0\0yâ¯\e\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/PeclFixup.php\9c\ 4\0\0\94h   V\9c\ 4\0\0eùt\9a\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/PharBuild.phpâ\a\0\0\94h   Vâ\a\0\0ζ0ɶ\ 1\0\0\0\0\0\0\1d\0\0\0pharext/Task/PharCompress.phpc\ 4\0\0\94h        Vc\ 4\0\0½\10³Ï¶\ 1\0\0\0\0\0\0\e\0\0\0pharext/Task/PharRename.phpä\ 3\0\0\94h  Vä\ 3\0\0\8a[Þ˶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PharSign.php¨\ 3\0\0\94h    V¨\ 3\0\0Ûº¦i¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PharStub.phpæ\ 3\0\0\94h    Væ\ 3\0\0Y|­\9b\ 1\0\0\0\0\0\0\17\0\0\0pharext/Task/Phpize.php\ f\ 4\0\0\94h      V\ f\ 4\0\0ù\f2Ѷ\ 1\0\0\0\0\0\0\1c\0\0\0pharext/Task/StreamFetch.php\10\a\0\0\94h V\10\a\0\0\88îs\¶\ 1\0\0\0\0\0\0\10\0\0\0pharext/Task.phpw\0\0\0\94h     Vw\0\0\0 ÄIǶ\ 1\0\0\0\0\0\0\13\0\0\0pharext/Tempdir.phpµ\ 1\0\0\94h  Vµ\ 1\0\0ë\7f\96\ 1\0\0\0\0\0\0\14\0\0\0pharext/Tempfile.php\ f\ 4\0\0\94h V\ f\ 4\0\0\0®ô\1e\ 1\0\0\0\0\0\0\14\0\0\0pharext/Tempname.phpt\ 3\0\0\94h Vt\ 3\0\0\9en<\8d\ 1\0\0\0\0\0\0\13\0\0\0pharext/Updater.php\8d\10\0\0\94h  V\8d\10\0\0\9eÏv\16\ 1\0\0\0\0\0\0\15\0\0\0pharext_installer.phpÝ\ 2\0\0\94h        VÝ\ 2\0\0\19\8cÞq¶\ 1\0\0\0\0\0\0\14\0\0\0pharext_packager.phpb\ 3\0\0\94h Vb\ 3\0\0îVÓ϶\ 1\0\0\0\0\0\0\13\0\0\0pharext_updater.phph\ 3\0\0\94h  Vh\ 3\0\0 Êúj¶\ 1\0\0\0\0\0\0\13\0\0\0pharext_package.php2\0\0\0\94h  V2\0\0\0vSTÒ¶\ 1\0\0\0\0\0\0\v\0\0\0package.xml\1a\a\0\0\94h  V\1a\a\0\0L(\97\ 1\0\0\0\0\0\0\a\0\0\0CREDITS\16\0\0\0\94h      V\16\0\0\0Cµ]²¶\ 1\0\0\0\0\0\0\a\0\0\0LICENSEA\ 5\0\0\94h      VA\ 5\0\0¾¬Jþ¶\ 1\0\0\0\0\0\0\b\0\0\0DoxyfileW,\0\0\94h     VW,\0\0\ 6°¶\ 1\0\0\0\0\0\0       \0\0\0config.m4$\ 1\0\0\94h      V$\ 1\0\0Åê@\9b\ 1\0\0\0\0\0\0
-\0\0\0config.w32Ð\0\0\0\94h    VÐ\0\0\0ýÍ\b\8e\ 1\0\0\0\0\0\0\v\0\0\0php_raphf.h\12\ 5\0\0\94h  V\12\ 5\0\0\bÒ¶\ 1\0\0\0\0\0\0\ f\0\0\0php_raphf_api.h\882\0\0\94h      V\882\0\0J\1a^V¶\ 1\0\0\0\0\0\0\v\0\0\0php_raphf.c\81E\0\0\94h  V\81E\0\0\99P\18\1d\ 1\0\0\0\0\0\0\12\0\0\0tests/http001.phpt\14\ 6\0\0\94h   V\14\ 6\0\0\f\e\ 1\0\0\0\0\0\0\12\0\0\0tests/http002.phptL\ 5\0\0\94h   VL\ 5\0\0\80ÔïS¶\ 1\0\0\0\0\0\0\12\0\0\0tests/http003.phpt^\ 5\0\0\94h   V^\ 5\0\0\14\88\19\ 1\0\0\0\0\0\0\12\0\0\0tests/http004.phpt[\b\0\0\94h   V[\b\0\0\1c«¶\ 1\0\0\0\0\0\0<?php
-
-namespace pharext;
-
-use ArrayAccess;
-use IteratorAggregate;
-use RecursiveDirectoryIterator;
-use SplFileInfo;
-
-use pharext\Exception;
-
-class Archive implements ArrayAccess, IteratorAggregate
-{
-       const HALT_COMPILER = "\137\137\150\141\154\164\137\143\157\155\160\151\154\145\162\50\51\73";
-       const SIGNED = 0x10000;
-       const SIG_MD5    = 0x0001;
-       const SIG_SHA1   = 0x0002;
-       const SIG_SHA256 = 0x0003;
-       const SIG_SHA512 = 0x0004;
-       const SIG_OPENSSL= 0x0010;
-
-       private static $siglen = [
-               self::SIG_MD5    => 16,
-               self::SIG_SHA1   => 20,
-               self::SIG_SHA256 => 32,
-               self::SIG_SHA512 => 64,
-               self::SIG_OPENSSL=> 0
-       ];
-
-       private static $sigalg = [
-               self::SIG_MD5    => "md5",
-               self::SIG_SHA1   => "sha1",
-               self::SIG_SHA256 => "sha256",
-               self::SIG_SHA512 => "sha512",
-               self::SIG_OPENSSL=> "openssl"
-       ];
-
-       private static $sigtyp = [
-               self::SIG_MD5    => "MD5",
-               self::SIG_SHA1   => "SHA-1",
-               self::SIG_SHA256 => "SHA-256",
-               self::SIG_SHA512 => "SHA-512",
-               self::SIG_OPENSSL=> "OpenSSL",
-       ];
-
-       const PERM_FILE_MASK = 0x01ff;
-       const COMP_FILE_MASK = 0xf000;
-       const COMP_GZ_FILE   = 0x1000;
-       const COMP_BZ2_FILE  = 0x2000;
-
-       const COMP_PHAR_MASK= 0xf000;
-       const COMP_PHAR_GZ  = 0x1000;
-       const COMP_PHAR_BZ2 = 0x2000;
-
-       private $file;
-       private $fd;
-       private $stub;
-       private $manifest;
-       private $signature;
-       private $extracted;
-
-       function __construct($file = null) {
-               if (strlen($file)) {
-                       $this->open($file);
-               }
-       }
-
-       function open($file) {
-               if (!$this->fd = @fopen($file, "r")) {
-                       throw new Exception;
-               }
-               $this->file = $file;
-               $this->stub = $this->readStub();
-               $this->manifest = $this->readManifest();
-               $this->signature = $this->readSignature();
-       }
-
-       function getIterator() {
-               return new RecursiveDirectoryIterator($this->extract());
-       }
-
-       function extract() {
-               return $this->extracted ?: $this->extractTo(new Tempdir("archive"));
-       }
-
-       function extractTo($dir) {
-               if ((string) $this->extracted == (string) $dir) {
-                       return $this->extracted;
-               }
-               foreach ($this->manifest["entries"] as $file => $entry) {
-                       fseek($this->fd, $this->manifest["offset"]+$entry["offset"]);
-                       $path = "$dir/$file";
-                       $copy = stream_copy_to_stream($this->fd, $this->outFd($path, $entry["flags"]), $entry["csize"]);
-                       if ($entry["osize"] != $copy) {
-                               throw new Exception("Copied '$copy' of '$file', expected '{$entry["osize"]}' from '{$entry["csize"]}");
-                       }
-
-                       $crc = hexdec(hash_file("crc32b", $path));
-                       if ($crc !== $entry["crc32"]) {
-                               throw new Exception("CRC mismatch of '$file': '$crc' != '{$entry["crc32"]}");
-                       }
-
-                       chmod($path, $entry["flags"] & self::PERM_FILE_MASK);
-                       touch($path, $entry["stamp"]);
-               }
-               return $this->extracted = $dir;
-       }
-
-       function offsetExists($o) {
-               return isset($this->entries[$o]);
-       }
-
-       function offsetGet($o) {
-               $this->extract();
-               return new SplFileInfo($this->extracted."/$o");
-       }
-
-       function offsetSet($o, $v) {
-               throw new Exception("Archive is read-only");
-       }
-
-       function offsetUnset($o) {
-               throw new Exception("Archive is read-only");
-       }
-
-       function getSignature() {
-               /* compatible with Phar::getSignature() */
-               return [
-                       "hash_type" => self::$sigtyp[$this->signature["flags"]],
-                       "hash" => strtoupper(bin2hex($this->signature["hash"])),
-               ];
-       }
-
-       function getPath() {
-               /* compatible with Phar::getPath() */
-               return new SplFileInfo($this->file);
-       }
-
-       function getMetadata($key = null) {
-               if (isset($key)) {
-                       return $this->manifest["meta"][$key];
-               }
-               return $this->manifest["meta"];
-       }
-
-       private function outFd($path, $flags) {
-                       $dirn = dirname($path);
-                       if (!is_dir($dirn) && !@mkdir($dirn, 0777, true)) {
-                               throw new Exception;
-                       }
-                       if (!$fd = @fopen($path, "w")) {
-                               throw new Exception;
-                       }
-                       switch ($flags & self::COMP_FILE_MASK) {
-                       case self::COMP_GZ_FILE:
-                               if (!@stream_filter_append($fd, "zlib.inflate")) {
-                                       throw new Exception;
-                               }
-                               break;
-                       case self::COMP_BZ2_FILE:
-                               if (!@stream_filter_append($fd, "bz2.decompress")) {
-                                       throw new Exception;
-                               }
-                               break;
-                       }
-
-       }
-       private function readVerified($fd, $len) {
-               if ($len != strlen($data = fread($fd, $len))) {
-                       throw new Exception("Unexpected EOF");
-               }
-               return $data;
-       }
-
-       private function readFormat($format, $fd, $len) {
-               if (false === ($data = @unpack($format, $this->readVerified($fd, $len)))) {
-                       throw new Exception;
-               }
-               return $data;
-       }
-
-       private function readSingleFormat($format, $fd, $len) {
-               return current($this->readFormat($format, $fd, $len));
-       }
-
-       private function readStringBinary($fd) {
-               if (($length = $this->readSingleFormat("V", $fd, 4))) {
-                       return $this->readVerified($this->fd, $length);
-               }
-               return null;
-       }
-
-       private function readSerializedBinary($fd) {
-               if (($length = $this->readSingleFormat("V", $fd, 4))) {
-                       if (false === ($data = unserialize($this->readVerified($fd, $length)))) {
-                               throw new Exception;
-                       }
-                       return $data;
-               }
-               return null;
-       }
-
-       private function readStub() {
-               $stub = "";
-               while (!feof($this->fd)) {
-                       $line = fgets($this->fd);
-                       $stub .= $line;
-                       if (false !== stripos($line, self::HALT_COMPILER)) {
-                               /* check for '?>' on a separate line */
-                               if ('?>' === $this->readVerified($this->fd, 2)) {
-                                       $stub .= '?>' . fgets($this->fd);
-                               } else {
-                                       fseek($this->fd, -2, SEEK_CUR);
-                               }
-                               break;
-                       }
-               }
-               return $stub;
-       }
-
-       private function readManifest() {
-               $current = ftell($this->fd);
-               $header = $this->readFormat("Vlen/Vnum/napi/Vflags", $this->fd, 14);
-               $alias = $this->readStringBinary($this->fd);
-               $meta = $this->readSerializedBinary($this->fd);
-               $entries = [];
-               for ($i = 0; $i < $header["num"]; ++$i) {
-                       $this->readEntry($entries);
-               }
-               $offset = ftell($this->fd);
-               if (($length = $offset - $current - 4) != $header["len"]) {
-                       throw new Exception("Manifest length read was '$length', expected '{$header["len"]}'");
-               }
-               return $header + compact("alias", "meta", "entries", "offset");
-       }
-
-       private function readEntry(array &$entries) {
-               if (!count($entries)) {
-                       $offset = 0;
-               } else {
-                       $last = end($entries);
-                       $offset = $last["offset"] + $last["csize"];
-               }
-               $file = $this->readStringBinary($this->fd);
-               if (!strlen($file)) {
-                       throw new Exception("Empty file name encountered at offset '$offset'");
-               }
-               $header = $this->readFormat("Vosize/Vstamp/Vcsize/Vcrc32/Vflags", $this->fd, 20);
-               $meta = $this->readSerializedBinary($this->fd);
-               $entries[$file] =  $header + compact("meta", "offset");
-       }
-
-       private function readSignature() {
-               fseek($this->fd, -8, SEEK_END);
-               $sig = $this->readFormat("Vflags/Z4magic", $this->fd, 8);
-               $end = ftell($this->fd);
-
-               if ($sig["magic"] !== "GBMB") {
-                       throw new Exception("Invalid signature magic value '{$sig["magic"]}");
-               }
-
-               switch ($sig["flags"]) {
-               case self::SIG_OPENSSL:
-                       fseek($this->fd, -12, SEEK_END);
-                       if (($hash = $this->readSingleFormat("V", $this->fd, 4))) {
-                               $offset = 4 + $hash;
-                               fseek($this->fd, -$offset, SEEK_CUR);
-                               $hash = $this->readVerified($this->fd, $hash);
-                               fseek($this->fd, 0, SEEK_SET);
-                               $valid = openssl_verify($this->readVerified($this->fd, $end - $offset - 8),
-                                       $hash, @file_get_contents($this->file.".pubkey")) === 1;
-                       }
-                       break;
-
-               case self::SIG_MD5:
-               case self::SIG_SHA1:
-               case self::SIG_SHA256:
-               case self::SIG_SHA512:
-                       $offset = 8 + self::$siglen[$sig["flags"]];
-                       fseek($this->fd, -$offset, SEEK_END);
-                       $hash = $this->readVerified($this->fd, self::$siglen[$sig["flags"]]);
-                       $algo = hash_init(self::$sigalg[$sig["flags"]]);
-                       fseek($this->fd, 0, SEEK_SET);
-                       hash_update_stream($algo, $this->fd, $end - $offset);
-                       $valid = hash_final($algo, true) === $hash;
-                       break;
-
-               default:
-                       throw new Exception("Invalid signature type '{$sig["flags"]}");
-               }
-
-               return $sig + compact("hash", "valid");
-       }
-}
-<?php
-
-namespace pharext\Cli\Args;
-
-use pharext\Cli\Args;
-
-class Help
-{
-       private $args;
-
-       function __construct($prog, Args $args) {
-               $this->prog = $prog;
-               $this->args = $args;
-       }
-
-       function __toString() {
-               $usage = "Usage:\n\n  \$ ";
-               $usage .= $this->prog;
-
-               list($flags, $required, $optional, $positional) = $this->listSpec();
-               if ($flags) {
-                       $usage .= $this->dumpFlags($flags);
-               }
-               if ($required) {
-                       $usage .= $this->dumpRequired($required);
-               }
-               if ($optional) {
-                       $usage .= $this->dumpOptional($optional);
-               }
-               if ($positional) {
-                       $usage .= $this->dumpPositional($positional);
-               }
-
-               $help = $this->dumpHelp($positional);
-
-               return $usage . "\n\n" . $help . "\n";
-       }
-
-       function listSpec() {
-               $flags = [];
-               $required = [];
-               $optional = [];
-               $positional = [];
-               foreach ($this->args->getSpec() as $spec) {
-                       if (is_numeric($spec[0])) {
-                               $positional[] = $spec;
-                       } elseif ($spec[3] & Args::REQUIRED) {
-                               $required[] = $spec;
-                       } elseif ($spec[3] & (Args::OPTARG|Args::REQARG)) {
-                               $optional[] = $spec;
-                       } else {
-                               $flags[] = $spec;
-                       }
-               }
-
-               return [$flags, $required, $optional, $positional]
-                       + compact("flags", "required", "optional", "positional");
-       }
-
-       function dumpFlags(array $flags) {
-               return sprintf(" [-%s]", implode("", array_column($flags, 0)));
-       }
-
-       function dumpRequired(array $required) {
-               $dump = "";
-               foreach ($required as $req) {
-                       $dump .= sprintf(" -%s <%s>", $req[0], $req[1]);
-               }
-               return $dump;
-       }
-
-       function dumpOptional(array $optional) {
-               $req = array_filter($optional, function($a) {
-                       return $a[3] & Args::REQARG;
-               });
-               $opt = array_filter($optional, function($a) {
-                       return $a[3] & Args::OPTARG;
-               });
-
-               $dump = "";
-               if ($req) {
-                       $dump .= sprintf(" [-%s <arg>]", implode("|-", array_column($req, 0)));
-               }
-               if ($opt) {
-                       $dump .= sprintf(" [-%s [<arg>]]", implode("|-", array_column($opt, 0)));
-               }
-               return $dump;
-       }
-
-       function dumpPositional(array $positional) {
-               $dump = " [--]";
-               foreach ($positional as $pos) {
-                       if ($pos[3] & Args::REQUIRED) {
-                               $dump .= sprintf(" <%s>", $pos[1]);
-                       } else {
-                               $dump .= sprintf(" [<%s>]", $pos[1]);
-                       }
-                       if ($pos[3] & Args::MULTI) {
-                               $dump .= sprintf(" [<%s>]...", $pos[1]);
-                       }
-               }
-               return $dump;
-       }
-
-       function calcMaxLen() {
-               $spc = $this->args->getSpec();
-               $max = max(array_map("strlen", array_column($spc, 1)));
-               $max += $max % 8 + 2;
-               return $max;
-       }
-
-       function dumpHelp() {
-               $max = $this->calcMaxLen();
-               $dump = "";
-               foreach ($this->args->getSpec() as $spec) {
-                       $dump .= "    ";
-                       if (is_numeric($spec[0])) {
-                               $dump .= sprintf("--   %s ", $spec[1]);
-                       } elseif (isset($spec[0])) {
-                               $dump .= sprintf("-%s|", $spec[0]);
-                       }
-                       if (!is_numeric($spec[0])) {
-                               $dump .= sprintf("--%s ", $spec[1]);
-                       }
-                       if ($spec[3] & Args::REQARG) {
-                               $dump .= "<arg>  ";
-                       } elseif ($spec[3] & Args::OPTARG) {
-                               $dump .= "[<arg>]";
-                       } else {
-                               $dump .= "       ";
-                       }
-
-                       $dump .= str_repeat(" ", $max-strlen($spec[1])+3*!isset($spec[0]));
-                       $dump .= $spec[2];
-
-                       if ($spec[3] & Args::REQUIRED) {
-                               $dump .= " (REQUIRED)";
-                       }
-                       if ($spec[3] & Args::MULTI) {
-                               $dump .= " (MULTIPLE)";
-                       }
-                       if (isset($spec[4])) {
-                               $dump .= sprintf(" [%s]", $spec[4]);
-                       }
-                       $dump .= "\n";
-               }
-               return $dump;
-       }
-}
-<?php
-
-namespace pharext\Cli;
-
-/**
- * Command line arguments
- */
-class Args implements \ArrayAccess
-{
-       /**
-        * Optional option
-        */
-       const OPTIONAL = 0x000;
-
-       /**
-        * Required Option
-        */
-       const REQUIRED = 0x001;
-
-       /**
-        * Only one value, even when used multiple times
-        */
-       const SINGLE = 0x000;
-
-       /**
-        * Aggregate an array, when used multiple times
-        */
-       const MULTI = 0x010;
-
-       /**
-        * Option takes no argument
-        */
-       const NOARG = 0x000;
-
-       /**
-        * Option requires an argument
-        */
-       const REQARG = 0x100;
-
-       /**
-        * Option takes an optional argument
-        */
-       const OPTARG = 0x200;
-
-       /**
-        * Option halts processing
-        */
-       const HALT = 0x10000000;
-
-       /**
-        * Original option spec
-        * @var array
-        */
-       private $orig = [];
-
-       /**
-        * Compiled spec
-        * @var array
-        */
-       private $spec = [];
-
-       /**
-        * Parsed args
-        * @var array
-        */
-       private $args = [];
-
-       /**
-        * Compile the original spec
-        * @param array|Traversable $spec
-        */
-       public function __construct($spec = null) {
-               if (is_array($spec) || $spec instanceof Traversable) {
-                       $this->compile($spec);
-               }
-
-       }
-
-       /**
-        * Compile the original spec
-        * @param array|Traversable $spec
-        * @return pharext\Cli\Args self
-        */
-       public function compile($spec) {
-               foreach ($spec as $arg) {
-                       if (isset($arg[0]) && is_numeric($arg[0])) {
-                               $arg[3] &= ~0xf00;
-                               $this->spec["--".$arg[0]] = $arg;
-                       } elseif (isset($arg[0])) {
-                               $this->spec["-".$arg[0]] = $arg;
-                               $this->spec["--".$arg[1]] = $arg;
-                       } else {
-                               $this->spec["--".$arg[1]] = $arg;
-                       }
-                       $this->orig[] = $arg;
-               }
-               return $this;
-       }
-
-       /**
-        * Get original spec
-        * @return array
-        */
-       public function getSpec() {
-               return $this->orig;
-       }
-
-       /**
-        * Get compiled spec
-        * @return array
-        */
-       public function getCompiledSpec() {
-               return $this->spec;
-       }
-
-       /**
-        * Parse command line arguments according to the compiled spec.
-        *
-        * The Generator yields any parsing errors.
-        * Parsing will stop when all arguments are processed or the first option
-        * flagged Cli\Args::HALT was encountered.
-        *
-        * @param int $argc
-        * @param array $argv
-        * @return Generator
-        */
-       public function parse($argc, array $argv) {
-               for ($f = false, $p = 0, $i = 0; $i < $argc; ++$i) {
-                       $o = $argv[$i];
-
-                       if ($o{0} === "-" && strlen($o) > 2 && $o{1} !== "-") {
-                               // multiple short opts, e.g. -vps
-                               $argc += strlen($o) - 2;
-                               array_splice($argv, $i, 1, array_map(function($s) {
-                                       return "-$s";
-                               }, str_split(substr($o, 1))));
-                               $o = $argv[$i];
-                       } elseif ($o{0} === "-" && strlen($o) > 2 && $o{1} === "-" && 0 < ($eq = strpos($o, "="))) {
-                               // long opt with argument, e.g. --foo=bar
-                               $argc++;
-                               array_splice($argv, $i, 1, [
-                                       substr($o, 0, $eq++),
-                                       substr($o, $eq)
-                               ]);
-                               $o = $argv[$i];
-                       } elseif ($o === "--") {
-                               // only positional args following
-                               $f = true;
-                               continue;
-                       }
-
-                       if ($f || !isset($this->spec[$o])) {
-                               if ($o{0} !== "-" && isset($this->spec["--$p"])) {
-                                       $this[$p] = $o;
-                                       if (!$this->optIsMulti($p)) {
-                                               ++$p;
-                                       }
-                               } else {
-                                       yield sprintf("Unknown option %s", $o);
-                               }
-                       } elseif (!$this->optAcceptsArg($o)) {
-                               $this[$o] = true;
-                       } elseif ($i+1 < $argc && !isset($this->spec[$argv[$i+1]])) {
-                               $this[$o] = $argv[++$i];
-                       } elseif ($this->optRequiresArg($o)) {
-                               yield sprintf("Option --%s requires an argument", $this->optLongName($o));
-                       } else {
-                               // OPTARG
-                               $this[$o] = $this->optDefaultArg($o);
-                       }
-
-                       if ($this->optHalts($o)) {
-                               return;
-                       }
-               }
-       }
-
-       /**
-        * Validate that all required options were given.
-        *
-        * The Generator yields any validation errors.
-        *
-        * @return Generator
-        */
-       public function validate() {
-               $required = array_filter($this->orig, function($spec) {
-                       return $spec[3] & self::REQUIRED;
-               });
-               foreach ($required as $req) {
-                       if ($req[3] & self::MULTI) {
-                               if (is_array($this[$req[0]])) {
-                                       continue;
-                               }
-                       } elseif (strlen($this[$req[0]])) {
-                               continue;
-                       }
-                       if (is_numeric($req[0])) {
-                               yield sprintf("Argument <%s> is required", $req[1]);
-                       } else {
-                               yield sprintf("Option --%s is required", $req[1]);
-                       }
-               }
-       }
-
-
-       public function toArray() {
-               $args = [];
-               foreach ($this->spec as $spec) {
-                       $opt = $this->opt($spec[1]);
-                       $args[$opt] = $this[$opt];
-               }
-               return $args;
-       }
-
-       /**
-        * Retreive the default argument of an option
-        * @param string $o
-        * @return mixed
-        */
-       private function optDefaultArg($o) {
-               $o = $this->opt($o);
-               if (isset($this->spec[$o][4])) {
-                       return $this->spec[$o][4];
-               }
-               return null;
-       }
-
-       /**
-        * Retrieve the help message of an option
-        * @param string $o
-        * @return string
-        */
-       private function optHelp($o) {
-               $o = $this->opt($o);
-               if (isset($this->spec[$o][2])) {
-                       return $this->spec[$o][2];
-               }
-               return "";
-       }
-
-       /**
-        * Retrieve option's flags
-        * @param string $o
-        * @return int
-        */
-       private function optFlags($o) {
-               $o = $this->opt($o);
-               if (isset($this->spec[$o])) {
-                       return $this->spec[$o][3];
-               }
-               return null;
-       }
-
-       /**
-        * Check whether an option is flagged for halting argument processing
-        * @param string $o
-        * @return boolean
-        */
-       private function optHalts($o) {
-               return $this->optFlags($o) & self::HALT;
-       }
-
-       /**
-        * Check whether an option needs an argument
-        * @param string $o
-        * @return boolean
-        */
-       private function optRequiresArg($o) {
-               return $this->optFlags($o) & self::REQARG;
-       }
-
-       /**
-        * Check wether an option accepts any argument
-        * @param string $o
-        * @return boolean
-        */
-       private function optAcceptsArg($o) {
-               return $this->optFlags($o) & 0xf00;
-       }
-
-       /**
-        * Check whether an option can be used more than once
-        * @param string $o
-        * @return boolean
-        */
-       private function optIsMulti($o) {
-               return $this->optFlags($o) & self::MULTI;
-       }
-
-       /**
-        * Retreive the long name of an option
-        * @param string $o
-        * @return string
-        */
-       private function optLongName($o) {
-               $o = $this->opt($o);
-               return is_numeric($this->spec[$o][0]) ? $this->spec[$o][0] : $this->spec[$o][1];
-       }
-
-       /**
-        * Retreive the short name of an option
-        * @param string $o
-        * @return string
-        */
-       private function optShortName($o) {
-               $o = $this->opt($o);
-               return is_numeric($this->spec[$o][0]) ? null : $this->spec[$o][0];
-       }
-
-       /**
-        * Retreive the canonical name (--long-name) of an option
-        * @param string $o
-        * @return string
-        */
-       private function opt($o) {
-               if (is_numeric($o)) {
-                       return "--$o";
-               }
-               if ($o{0} !== '-') {
-                       if (strlen($o) > 1) {
-                               $o = "-$o";
-                       }
-                       $o = "-$o";
-               }
-               return $o;
-       }
-
-       /**@+
-        * Implements ArrayAccess and virtual properties
-        */
-       function offsetExists($o) {
-               $o = $this->opt($o);
-               return isset($this->args[$o]);
-       }
-       function __isset($o) {
-               return $this->offsetExists($o);
-       }
-       function offsetGet($o) {
-               $o = $this->opt($o);
-               if (isset($this->args[$o])) {
-                       return $this->args[$o];
-               }
-               return $this->optDefaultArg($o);
-       }
-       function __get($o) {
-               return $this->offsetGet($o);
-       }
-       function offsetSet($o, $v) {
-               $osn = $this->optShortName($o);
-               $oln = $this->optLongName($o);
-               if ($this->optIsMulti($o)) {
-                       if (isset($osn)) {
-                               $this->args["-$osn"][] = $v;
-                       }
-                       $this->args["--$oln"][] = $v;
-               } else {
-                       if (isset($osn)) {
-                               $this->args["-$osn"] = $v;
-                       }
-                       $this->args["--$oln"] = $v;
-               }
-       }
-       function __set($o, $v) {
-               $this->offsetSet($o, $v);
-       }
-       function offsetUnset($o) {
-               unset($this->args["-".$this->optShortName($o)]);
-               unset($this->args["--".$this->optLongName($o)]);
-       }
-       function __unset($o) {
-               $this->offsetUnset($o);
-       }
-       /**@-*/
-}
-<?php
-
-namespace pharext\Cli;
-
-use pharext\Archive;
-
-use Phar;
-
-trait Command
-{
-       /**
-        * Command line arguments
-        * @var pharext\Cli\Args
-        */
-       private $args;
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::getArgs()
-        */
-       public function getArgs() {
-               return $this->args;
-       }
-
-       /**
-        * Retrieve metadata of the currently running phar
-        * @param string $key
-        * @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;
-       }
-
-       /**
-        * Output pharext vX.Y.Z header
-        */
-       public function header() {
-               if (!headers_sent()) {
-                       /* only display header, if we didn't generate any output yet */
-                       printf("%s\n\n", $this->metadata("header"));
-               }
-       }
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::debug()
-        */
-       public function debug($fmt) {
-               if ($this->args->verbose) {
-                       vprintf($fmt, array_slice(func_get_args(), 1));
-               }
-       }
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::info()
-        */
-       public function info($fmt) {
-               if (!$this->args->quiet) {
-                       vprintf($fmt, array_slice(func_get_args(), 1));
-               }
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::warn()
-        */
-       public function warn($fmt) {
-               if (!$this->args->quiet) {
-                       if (!isset($fmt)) {
-                               $fmt = "%s\n";
-                               $arg = error_get_last()["message"];
-                       } else {
-                               $arg = array_slice(func_get_args(), 1);
-                       }
-                       vfprintf(STDERR, "Warning: $fmt", $arg);
-               }
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::error()
-        */
-       public function error($fmt) {
-               if (!isset($fmt)) {
-                       $fmt = "%s\n";
-                       $arg = error_get_last()["message"];
-               } else {
-                       $arg = array_slice(func_get_args(), 1);
-               }
-               vfprintf(STDERR, "ERROR: $fmt", $arg);
-       }
-
-       /**
-        * Output command line help message
-        * @param string $prog
-        */
-       public function help($prog) {
-               print new Args\Help($prog, $this->args);
-       }
-       
-       /**
-        * Verbosity
-        * @return boolean
-        */
-       public function verbosity() {
-               if ($this->args->verbose) {
-                       return true;
-               } elseif ($this->args->quiet) {
-                       return false;
-               } else {
-                       return null;
-               }
-       }
-}
-<?php
-
-namespace pharext;
-
-/**
- * Command interface
- */
-interface Command
-{
-       /**
-        * Argument error
-        */
-       const EARGS = 1;
-       /**
-        * Build error
-        */
-       const EBUILD = 2;
-       /**
-        * Signature error
-        */
-       const ESIGN = 3;
-       /**
-        * Extract/unpack error
-        */
-       const EEXTRACT = 4;
-       /**
-        * Install error
-        */
-       const EINSTALL = 5;
-       
-       /**
-        * Retrieve command line arguments
-        * @return pharext\Cli\Args
-        */
-       public function getArgs();
-       
-       /**
-        * Print debug message
-        * @param string $fmt
-        * @param string ...$args
-        */
-       public function debug($fmt);
-       
-       /**
-        * Print info
-        * @param string $fmt
-        * @param string ...$args
-        */
-       public function info($fmt);
-       
-       /**
-        * Print warning
-        * @param string $fmt
-        * @param string ...$args
-        */
-       public function warn($fmt);
-
-       /**
-        * Print error
-        * @param string $fmt
-        * @param string ...$args
-        */
-       public function error($fmt);
-
-       /**
-        * Execute the command
-        * @param int $argc command line argument count
-        * @param array $argv command line argument list
-        */
-       public function run($argc, array $argv);
-}
-<?php
-
-namespace pharext;
-
-class Exception extends \Exception
-{
-       public function __construct($message = null, $code = 0, $previous = null) {
-               if (!isset($message)) {
-                       $last_error = error_get_last();
-                       $message = $last_error["message"];
-                       if (!$code) {
-                               $code = $last_error["type"];
-                       }
-               }
-               parent::__construct($message, $code, $previous);
-       }
-}
-<?php
-
-namespace pharext;
-
-/**
- * Execute system command
- */
-class ExecCmd
-{
-       /**
-        * Sudo command, if the cmd needs escalated privileges
-        * @var string
-        */
-       private $sudo;
-       
-       /**
-        * Executable of the cmd
-        * @var string
-        */
-       private $command;
-       
-       /**
-        * Passthrough cmd output
-        * @var bool
-        */
-       private $verbose;
-       
-       /**
-        * Output of cmd run
-        * @var string
-        */
-       private $output;
-       
-       /**
-        * Return code of cmd run
-        * @var int
-        */
-       private $status;
-
-       /**
-        * @param string $command
-        * @param bool verbose
-        */
-       public function __construct($command, $verbose = false) {
-               $this->command = $command;
-               $this->verbose = $verbose;
-       }
-       
-       /**
-        * (Re-)set sudo command
-        * @param string $sudo
-        */
-       public function setSu($sudo = false) {
-               $this->sudo = $sudo;
-       }
-       
-       /**
-        * Execute a program with escalated privileges handling interactive password prompt
-        * @param string $command
-        * @param bool $verbose
-        * @return int exit status
-        */
-       private function suExec($command, $verbose = null) {
-               if (!($proc = proc_open($command, [STDIN,["pipe","w"],["pipe","w"]], $pipes))) {
-                       $this->status = -1;
-                       throw new Exception("Failed to run {$command}");
-               }
-               
-               $stdout = $pipes[1];
-               $passwd = 0;
-               $checks = 10;
-
-               while (!feof($stdout)) {
-                       $R = [$stdout]; $W = []; $E = [];
-                       if (!stream_select($R, $W, $E, null)) {
-                               continue;
-                       }
-                       $data = fread($stdout, 0x1000);
-                       /* only check a few times */
-                       if ($passwd < $checks) {
-                               $passwd++;
-                               if (stristr($data, "password")) {
-                                       $passwd = $checks + 1;
-                                       printf("\n%s", $data);
-                                       continue;
-                               }
-                       } elseif ($passwd > $checks) {
-                               /* new line after pw entry */
-                               printf("\n");
-                               $passwd = $checks;
-                       }
-                       
-                       if ($verbose === null) {
-                               print $this->progress($data, 0);
-                       } else {
-                               if ($verbose) {
-                                       printf("%s", $data);
-                               }
-                               $this->output .= $data;
-                       }
-               }
-               if ($verbose === null) {
-                       $this->progress("", PHP_OUTPUT_HANDLER_FINAL);
-               }
-               return $this->status = proc_close($proc);
-       }
-
-       /**
-        * Output handler that displays some progress while soaking output
-        * @param string $string
-        * @param int $flags
-        * @return string
-        */
-       private function progress($string, $flags) {
-               static $counter = 0;
-               static $symbols = ["\\","|","/","-"];
-
-               $this->output .= $string;
-               
-               if (false !== strpos($string, "\n")) {
-                       ++$counter;
-               }
-
-               return $flags & PHP_OUTPUT_HANDLER_FINAL
-                       ? "   \r"
-                       : sprintf("  %s\r", $symbols[$counter % 4]);
-       }
-
-       /**
-        * Run the command
-        * @param array $args
-        * @return \pharext\ExecCmd self
-        * @throws \pharext\Exception
-        */
-       public function run(array $args = null) {
-               $exec = escapeshellcmd($this->command);
-               if ($args) {
-                       $exec .= " ". implode(" ", array_map("escapeshellarg", (array) $args));
-               }
-               
-               if ($this->sudo) {
-                       $this->suExec(sprintf($this->sudo." 2>&1", $exec), $this->verbose);
-               } elseif ($this->verbose) {
-                       ob_start(function($s) {
-                               $this->output .= $s;
-                               return $s;
-                       }, 1);
-                       passthru($exec, $this->status);
-                       ob_end_flush();
-               } elseif ($this->verbose !== false /* !quiet */) {
-                       ob_start([$this, "progress"], 1);
-                       passthru($exec . " 2>&1", $this->status);
-                       ob_end_flush();
-               } else {
-                       exec($exec ." 2>&1", $output, $this->status);
-                       $this->output = implode("\n", $output);
-               }
-               
-               if ($this->status) {
-                       throw new Exception("Command {$exec} failed ({$this->status})");
-               }
-
-               return $this;
-       }
-       
-       /**
-        * Retrieve exit code of cmd run
-        * @return int
-        */
-       public function getStatus() {
-               return $this->status;
-       }
-       
-       /**
-        * Retrieve output of cmd run
-        * @return string
-        */
-       public function getOutput() {
-               return $this->output;
-       }
-}
-<?php
-
-namespace pharext;
-
-use Phar;
-use SplObjectStorage;
-
-/**
- * The extension install command executed by the extension phar
- */
-class Installer implements Command
-{
-       use Cli\Command;
-
-       /**
-        * Cleanups
-        * @var array
-        */
-       private $cleanup = [];
-
-       /**
-        * Create the command
-        */
-       public function __construct() {
-               $this->args = new Cli\Args([
-                       ["h", "help", "Display help",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       ["v", "verbose", "More output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["q", "quiet", "Less output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["p", "prefix", "PHP installation prefix if phpize is not in \$PATH, e.g. /opt/php7",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["n", "common-name", "PHP common program name, e.g. php5 or zts-php",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG,
-                               "php"],
-                       ["c", "configure", "Additional extension configure flags, e.g. -c --with-flag",
-                               Cli\Args::OPTIONAL|Cli\Args::MULTI|Cli\Args::REQARG],
-                       ["s", "sudo", "Installation might need increased privileges",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::OPTARG,
-                               "sudo -S %s"],
-                       ["i", "ini", "Activate in this php.ini instead of loaded default php.ini",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       [null, "signature", "Show package signature",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "license", "Show package license",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "name", "Show package name",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "date", "Show package release date",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "release", "Show package release version",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "version", "Show pharext version",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-               ]);
-       }
-
-       /**
-        * Perform cleaniup
-        */
-       function __destruct() {
-               foreach ($this->cleanup as $cleanup) {
-                       $cleanup->run();
-               }
-       }
-
-       private function extract($phar) {
-               $temp = (new Task\Extract($phar))->run($this->verbosity());
-               $this->cleanup[] = new Task\Cleanup($temp);
-               return $temp;
-       }
-
-       private function hooks(SplObjectStorage $phars) {
-               $hook = [];
-               foreach ($phars as $phar) {
-                       if (isset($phar["pharext_package.php"])) {
-                               $sdir = include $phar["pharext_package.php"];
-                               if ($sdir instanceof SourceDir) {
-                                       $this->args->compile($sdir->getArgs());
-                                       $hook[] = $sdir;
-                               }
-                       }
-               }
-               return $hook;
-       }
-
-       private function load() {
-               $list = new SplObjectStorage();
-               $phar = extension_loaded("Phar")
-                       ? new Phar(Phar::running(false))
-                       : new Archive(PHAREXT_PHAR);
-               $temp = $this->extract($phar);
-
-               foreach ($phar as $entry) {
-                       $dep_file = $entry->getBaseName();
-                       if (fnmatch("*.ext.phar*", $dep_file)) {
-                               $dep_phar = extension_loaded("Phar")
-                                       ? new Phar("$temp/$dep_file")
-                                       : new Archive("$temp/$dep_file");
-                               $list[$dep_phar] = $this->extract($dep_phar);
-                       }
-               }
-
-               /* the actual ext.phar at last */
-               $list[$phar] = $temp;
-               return $list;
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::run()
-        */
-       public function run($argc, array $argv) {
-               try {
-                       /* load the phar(s) */
-                       $list = $this->load();
-                       /* installer hooks */
-                       $hook = $this->hooks($list);
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EEXTRACT);
-               }
-
-               /* standard arg stuff */
-               $errs = [];
-               $prog = array_shift($argv);
-               foreach ($this->args->parse(--$argc, $argv) as $error) {
-                       $errs[] = $error;
-               }
-
-               if ($this->args["help"]) {
-                       $this->header();
-                       $this->help($prog);
-                       exit;
-               }
-               try {
-                       foreach (["signature", "name", "date", "license", "release", "version"] as $opt) {
-                               if ($this->args[$opt]) {
-                                       printf("%s\n", $this->metadata($opt));
-                                       exit;
-                               }
-                       }
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EARGS);
-               }
-
-               foreach ($this->args->validate() as $error) {
-                       $errs[] = $error;
-               }
-
-               if ($errs) {
-                       if (!$this->args["quiet"]) {
-                               $this->header();
-                       }
-                       foreach ($errs as $err) {
-                               $this->error("%s\n", $err);
-                       }
-                       if (!$this->args["quiet"]) {
-                               $this->help($prog);
-                       }
-                       exit(self::EARGS);
-               }
-
-               try {
-                       /* post process hooks */
-                       foreach ($hook as $sdir) {
-                               $sdir->setArgs($this->args);
-                       }
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EARGS);
-               }
-
-               /* install packages */
-               try {
-                       foreach ($list as $phar) {
-                               $this->info("Installing %s ...\n", basename($phar->getPath()));
-                               $this->install($list[$phar]);
-                               $this->activate($list[$phar]);
-                               $this->info("Successfully installed %s!\n", basename($phar->getPath()));
-                       }
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EINSTALL);
-               }
-       }
-
-       /**
-        * Phpize + trinity
-        */
-       private function install($temp) {
-               // phpize
-               $phpize = new Task\Phpize($temp, $this->args->prefix, $this->args->{"common-name"});
-               $phpize->run($this->verbosity());
-
-               // configure
-               $configure = new Task\Configure($temp, $this->args->configure, $this->args->prefix, $this->args->{"common-name"});
-               $configure->run($this->verbosity());
-
-               // make
-               $make = new Task\Make($temp);
-               $make->run($this->verbosity());
-
-               // install
-               $sudo = isset($this->args->sudo) ? $this->args->sudo : null;
-               $install = new Task\Make($temp, ["install"], $sudo);
-               $install->run($this->verbosity());
-       }
-
-       private function activate($temp) {
-               if ($this->args->ini) {
-                       $files = [$this->args->ini];
-               } else {
-                       $files = array_filter(array_map("trim", explode(",", php_ini_scanned_files())));
-                       $files[] = php_ini_loaded_file();
-               }
-
-               $sudo = isset($this->args->sudo) ? $this->args->sudo : null;
-               $type = $this->metadata("type") ?: "extension";
-
-               $activate = new Task\Activate($temp, $files, $type, $this->args->prefix, $this->args{"common-name"}, $sudo);
-               if (!$activate->run($this->verbosity())) {
-                       $this->info("Extension already activated ...\n");
-               }
-       }
-}
-<?php
-
-namespace pharext;
-
-trait License
-{
-       function findLicense($dir, $file = null) {
-               if (isset($file)) {
-                       return realpath("$dir/$file");
-               }
-
-               $names = [];
-               foreach (["{,UN}LICEN{S,C}{E,ING}", "COPY{,ING,RIGHT}"] as $name) {
-                       $names[] = $this->mergeLicensePattern($name, strtolower($name));
-               }
-               $exts = [];
-               foreach (["t{,e}xt", "rst", "asc{,i,ii}", "m{,ark}d{,own}", "htm{,l}"] as $ext) {
-                       $exts[] = $this->mergeLicensePattern(strtoupper($ext), $ext);
-               }
-               
-               $pattern = "{". implode(",", $names) ."}{,.{". implode(",", $exts) ."}}";
-
-               if (($glob = glob("$dir/$pattern", GLOB_BRACE))) {
-                       return current($glob);
-               }
-       }
-
-       private function mergeLicensePattern($upper, $lower) {
-               $pattern = "";
-               $length = strlen($upper);
-               for ($i = 0; $i < $length; ++$i) {
-                       if ($lower{$i} === $upper{$i}) {
-                               $pattern .= $upper{$i};
-                       } else {
-                               $pattern .= "[" . $upper{$i} . $lower{$i} . "]";
-                       }
-               }
-               return $pattern;
-       }
-
-       public function readLicense($file) {
-               $text = file_get_contents($file);
-               switch (strtolower(pathinfo($file, PATHINFO_EXTENSION))) {
-                       case "htm":
-                       case "html":
-                               $text = strip_tags($text);
-                               break;
-               }
-               return $text;
-       }
-}
-<?php
-
-namespace pharext;
-
-class Metadata
-{
-       static function version() {
-               return "4.1.1";
-       }
-
-       static function header() {
-               return sprintf("pharext v%s (c) Michael Wallner <mike@php.net>", self::version());
-       }
-
-       static function date() {
-               return gmdate("Y-m-d");
-       }
-
-       static function all() {
-               return [
-                       "version" => self::version(),
-                       "header" => self::header(),
-                       "date" => self::date(),
-               ];
-       }
-}
-<?php
-
-namespace pharext\Openssl;
-
-use pharext\Exception;
-
-class PrivateKey
-{
-       /**
-        * Private key
-        * @var string
-        */
-       private $key;
-       
-       /**
-        * Public key
-        * @var string
-        */
-       private $pub;
-
-       /**
-        * Read a private key
-        * @param string $file
-        * @param string $password
-        * @throws \pharext\Exception
-        */
-       function __construct($file, $password) {
-               /* there appears to be a bug with refcount handling of this
-                * resource; when the resource is stored as property, it cannot be
-                * "coerced to a private key" on openssl_sign() later in another method
-                */
-               $key = openssl_pkey_get_private("file://$file", $password);
-               if (!is_resource($key)) {
-                       throw new Exception("Could not load private key");
-               }
-               openssl_pkey_export($key, $this->key);
-               $this->pub = openssl_pkey_get_details($key)["key"];
-       }
-
-       /**
-        * Sign the PHAR
-        * @param \Phar $package
-        */
-       function sign(\Phar $package) {
-               $package->setSignatureAlgorithm(\Phar::OPENSSL, $this->key);
-       }
-
-       /**
-        * Export the public key to a file
-        * @param string $file
-        * @throws \pharext\Exception
-        */
-       function exportPublicKey($file) {
-               if (!file_put_contents("$file.tmp", $this->pub) || !rename("$file.tmp", $file)) {
-                       throw new Exception;
-               }
-       }
-}
-<?php
-
-namespace pharext;
-
-use Phar;
-use pharext\Exception;
-
-/**
- * The extension packaging command executed by bin/pharext
- */
-class Packager implements Command
-{
-       use Cli\Command;
-       
-       /**
-        * Extension source directory
-        * @var pharext\SourceDir
-        */
-       private $source;
-       
-       /**
-        * Cleanups
-        * @var array
-        */
-       private $cleanup = [];
-       
-       /**
-        * Create the command
-        */
-       public function __construct() {
-               $this->args = new Cli\Args([
-                       ["h", "help", "Display this help",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       ["v", "verbose", "More output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["q", "quiet", "Less output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["n", "name", "Extension name",
-                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["r", "release", "Extension release version",
-                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["s", "source", "Extension source directory",
-                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["g", "git", "Use `git ls-tree` to determine file list",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["b", "branch", "Checkout this tag/branch",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["p", "pecl", "Use PECL package.xml to determine file list, name and release",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["d", "dest", "Destination directory",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG,
-                               "."],
-                       ["z", "gzip", "Create additional PHAR compressed with gzip",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["Z", "bzip", "Create additional PHAR compressed with bzip",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["S", "sign", "Sign the PHAR with a private key",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
-                       ["E", "zend", "Mark as Zend Extension",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       [null, "signature", "Show pharext signature",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "license", "Show pharext license",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "version", "Show pharext version",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-               ]);
-       }
-       
-       /**
-        * Perform cleaniup
-        */
-       function __destruct() {
-               foreach ($this->cleanup as $cleanup) {
-                       $cleanup->run();
-               }
-       }
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::run()
-        */
-       public function run($argc, array $argv) {
-               $errs = [];
-               $prog = array_shift($argv);
-               foreach ($this->args->parse(--$argc, $argv) as $error) {
-                       $errs[] = $error;
-               }
-               
-               if ($this->args["help"]) {
-                       $this->header();
-                       $this->help($prog);
-                       exit;
-               }
-               try {
-                       foreach (["signature", "license", "version"] as $opt) {
-                               if ($this->args[$opt]) {
-                                       printf("%s\n", $this->metadata($opt));
-                                       exit;
-                               }
-                       }
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EARGS);
-               }
-
-               try {
-                       /* source needs to be evaluated before Cli\Args validation, 
-                        * so e.g. name and version can be overriden and Cli\Args 
-                        * does not complain about missing arguments
-                        */
-                       $this->loadSource();
-               } catch (\Exception $e) {
-                       $errs[] = $e->getMessage();
-               }
-               
-               foreach ($this->args->validate() as $error) {
-                       $errs[] = $error;
-               }
-               
-               if ($errs) {
-                       if (!$this->args["quiet"]) {
-                               $this->header();
-                       }
-                       foreach ($errs as $err) {
-                               $this->error("%s\n", $err);
-                       }
-                       printf("\n");
-                       if (!$this->args["quiet"]) {
-                               $this->help($prog);
-                       }
-                       exit(self::EARGS);
-               }
-               
-               $this->createPackage();
-       }
-       
-       /**
-        * Download remote source
-        * @param string $source
-        * @return string local source
-        */
-       private function download($source) {
-               if ($this->args->git) {
-                       $task = new Task\GitClone($source, $this->args->branch);
-               } else {
-                       /* print newline only once */
-                       $done = false;
-                       $task = new Task\StreamFetch($source, function($bytes_pct) use(&$done) {
-                               if (!$done) {
-                                       $this->info(" %3d%% [%s>%s] \r",
-                                               floor($bytes_pct*100),
-                                               str_repeat("=", round(50*$bytes_pct)),
-                                               str_repeat(" ", round(50*(1-$bytes_pct)))
-                                       );
-                                       if ($bytes_pct == 1) {
-                                               $done = true;
-                                               $this->info("\n");
-                                       }
-                               }
-                       });
-               }
-               $local = $task->run($this->verbosity());
-
-               $this->cleanup[] = new Task\Cleanup($local);
-               return $local;
-       }
-
-       /**
-        * Extract local archive
-        * @param stirng $source
-        * @return string extracted directory
-        */
-       private function extract($source) {
-               try {
-                       $task = new Task\Extract($source);
-                       $dest = $task->run($this->verbosity());
-               } catch (\Exception $e) {
-                       if (false === strpos($e->getMessage(), "checksum mismatch")) {
-                               throw $e;
-                       }
-                       $dest = (new Task\PaxFixup($source))->run($this->verbosity());
-               }
-               
-               $this->cleanup[] = new Task\Cleanup($dest);
-               return $dest;
-       }
-
-       /**
-        * Localize a possibly remote source
-        * @param string $source
-        * @return string local source directory
-        */
-       private function localize($source) {
-               if (!stream_is_local($source) || ($this->args->git && isset($this->args->branch))) {
-                       $source = $this->download($source);
-                       $this->cleanup[] = new Task\Cleanup($source);
-               }
-               $source = realpath($source);
-               if (!is_dir($source)) {
-                       $source = $this->extract($source);
-                       $this->cleanup[] = new Task\Cleanup($source);
-                       
-                       if (!$this->args->git) {
-                               $source = (new Task\PeclFixup($source))->run($this->verbosity());
-                       }
-               }
-               return $source;
-       }
-
-       /**
-        * Load the source dir
-        * @throws \pharext\Exception
-        */
-       private function loadSource(){
-               if ($this->args["source"]) {
-                       $source = $this->localize($this->args["source"]);
-
-                       if ($this->args["pecl"]) {
-                               $this->source = new SourceDir\Pecl($source);
-                       } elseif ($this->args["git"]) {
-                               $this->source = new SourceDir\Git($source);
-                       } elseif (is_file("$source/pharext_package.php")) {
-                               $this->source = include "$source/pharext_package.php";
-                       } else {
-                               $this->source = new SourceDir\Basic($source);
-                       }
-
-                       if (!$this->source instanceof SourceDir) {
-                               throw new Exception("Unknown source dir $source");
-                       }
-
-                       foreach ($this->source->getPackageInfo() as $key => $val) {
-                               $this->args->$key = $val;
-                       }
-               }
-       }
-
-       /**
-        * Creates the extension phar
-        */
-       private function createPackage() {
-               try {
-                       $meta = array_merge(Metadata::all(), [
-                               "name" => $this->args->name,
-                               "release" => $this->args->release,
-                               "license" => $this->source->getLicense(),
-                               "type" => $this->args->zend ? "zend_extension" : "extension",
-                       ]);
-                       $file = (new Task\PharBuild($this->source, __DIR__."/../pharext_installer.php", $meta))->run($this->verbosity());
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EBUILD);
-               }
-
-               try {
-                       if ($this->args->sign) {
-                               $this->info("Using private key to sign phar ...\n");
-                               $pass = (new Task\Askpass)->run($this->verbosity());
-                               $sign = new Task\PharSign($file, $this->args->sign, $pass);
-                               $pkey = $sign->run($this->verbosity());
-                       }
-
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::ESIGN);
-               }
-
-               if ($this->args->gzip) {
-                       try {
-                               $gzip = (new Task\PharCompress($file, Phar::GZ))->run();
-                               $move = new Task\PharRename($gzip, $this->args->dest, $this->args->name ."-". $this->args->release);
-                               $name = $move->run($this->verbosity());
-
-                               $this->info("Created gzipped phar %s\n", $name);
-
-                               if ($this->args->sign) {
-                                       $sign = new Task\PharSign($name, $this->args->sign, $pass);
-                                       $sign->run($this->verbosity())->exportPublicKey($name.".pubkey");
-                               }
-
-                       } catch (\Exception $e) {
-                               $this->warn("%s\n", $e->getMessage());
-                       }
-               }
-               
-               if ($this->args->bzip) {
-                       try {
-                               $bzip = (new Task\PharCompress($file, Phar::BZ2))->run();
-                               $move = new Task\PharRename($bzip, $this->args->dest, $this->args->name ."-". $this->args->release);
-                               $name = $move->run($this->verbosity());
-
-                               $this->info("Created bzipped phar %s\n", $name);
-
-                               if ($this->args->sign) {
-                                       $sign = new Task\PharSign($name, $this->args->sign, $pass);
-                                       $sign->run($this->verbosity())->exportPublicKey($name.".pubkey");
-                               }
-
-                       } catch (\Exception $e) {
-                               $this->warn("%s\n", $e->getMessage());
-                       }
-               }
-
-               try {
-                       $move = new Task\PharRename($file, $this->args->dest, $this->args->name ."-". $this->args->release);
-                       $name = $move->run($this->verbosity());
-
-                       $this->info("Created executable phar %s\n", $name);
-
-                       if (isset($pkey)) {
-                               $pkey->exportPublicKey($name.".pubkey");
-                       }
-
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EBUILD);
-               }
-       }
-}
-<?php
-
-namespace pharext\SourceDir;
-
-use pharext\Cli\Args;
-use pharext\License;
-use pharext\SourceDir;
-
-use FilesystemIterator;
-use IteratorAggregate;
-use RecursiveCallbackFilterIterator;
-use RecursiveDirectoryIterator;
-use RecursiveIteratorIterator;
-
-
-class Basic implements IteratorAggregate, SourceDir
-{
-       use License;
-       
-       private $path;
-       
-       public function __construct($path) {
-               $this->path = $path;
-       }
-       
-       public function getBaseDir() {
-               return $this->path;
-       }
-       
-       public function getPackageInfo() {
-               return [];
-       }
-       
-       public function getLicense() {
-               if (($file = $this->findLicense($this->getBaseDir()))) {
-                       return $this->readLicense($file);
-               }
-               return "UNKNOWN";
-       }
-
-       public function getArgs() {
-               return [];
-       }
-       
-       public function setArgs(Args $args) {
-       }
-
-       public function filter($current, $key, $iterator) {
-               $sub = $current->getSubPath();
-               if ($sub === ".git" || $sub === ".hg" || $sub === ".svn") {
-                       return false;
-               }
-               return true;
-       }
-       
-       public function getIterator() {
-               $rdi = new RecursiveDirectoryIterator($this->path,
-                               FilesystemIterator::CURRENT_AS_SELF | // needed for 5.5
-                               FilesystemIterator::KEY_AS_PATHNAME |
-                               FilesystemIterator::SKIP_DOTS);
-               $rci = new RecursiveCallbackFilterIterator($rdi, [$this, "filter"]);
-               $rii = new RecursiveIteratorIterator($rci);
-               foreach ($rii as $path => $child) {
-                       if (!$child->isDir()) {
-                               yield realpath($path);
-                       }
-               }
-       }
-}
-<?php
-
-namespace pharext\SourceDir;
-
-use pharext\Cli\Args;
-use pharext\License;
-use pharext\SourceDir;
-
-/**
- * Extension source directory which is a git repo
- */
-class Git implements \IteratorAggregate, SourceDir
-{
-       use License;
-       
-       /**
-        * Base directory
-        * @var string
-        */
-       private $path;
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::__construct()
-        */
-       public function __construct($path) {
-               $this->path = $path;
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::getBaseDir()
-        */
-       public function getBaseDir() {
-               return $this->path;
-       }
-
-       /**
-        * @inheritdoc
-        * @return array
-        */
-       public function getPackageInfo() {
-               return [];
-       }
-
-       /**
-        * @inheritdoc
-        * @return string
-        */
-       public function getLicense() {
-               if (($file = $this->findLicense($this->getBaseDir()))) {
-                       return $this->readLicense($file);
-               }
-               return "UNKNOWN";
-       }
-
-       /**
-        * @inheritdoc
-        * @return array
-        */
-       public function getArgs() {
-               return [];
-       }
-
-       /**
-        * @inheritdoc
-        */
-       public function setArgs(Args $args) {
-       }
-
-       /**
-        * Generate a list of files by `git ls-files`
-        * @return Generator
-        */
-       private function generateFiles() {
-               $pwd = getcwd();
-               chdir($this->path);
-               if (($pipe = popen("git ls-tree -r --name-only HEAD", "r"))) {
-                       $path = realpath($this->path);
-                       while (!feof($pipe)) {
-                               if (strlen($file = trim(fgets($pipe)))) {
-                                       /* there may be symlinks, so no realpath here */
-                                       yield "$path/$file";
-                               }
-                       }
-                       pclose($pipe);
-               }
-               chdir($pwd);
-       }
-
-       /**
-        * Implements IteratorAggregate
-        * @see IteratorAggregate::getIterator()
-        */
-       public function getIterator() {
-               return $this->generateFiles();
-       }
-}
-<?php
-
-namespace pharext\SourceDir;
-
-use pharext\Cli\Args;
-use pharext\Exception;
-use pharext\SourceDir;
-use pharext\License;
-
-/**
- * A PECL extension source directory containing a v2 package.xml
- */
-class Pecl implements \IteratorAggregate, SourceDir
-{
-       use License;
-       
-       /**
-        * The package.xml
-        * @var SimpleXmlElement
-        */
-       private $sxe;
-       
-       /**
-        * The base directory
-        * @var string
-        */
-       private $path;
-
-       /**
-        * The package.xml
-        * @var string
-        */
-       private $file;
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::__construct()
-        */
-       public function __construct($path) {
-               if (is_file("$path/package2.xml")) {
-                       $sxe = simplexml_load_file($this->file = "$path/package2.xml");
-               } elseif (is_file("$path/package.xml")) {
-                       $sxe = simplexml_load_file($this->file = "$path/package.xml");
-               } else {
-                       throw new Exception("Missing package.xml in $path");
-               }
-               
-               $sxe->registerXPathNamespace("pecl", $sxe->getDocNamespaces()[""]);
-               
-               $this->sxe = $sxe;
-               $this->path = realpath($path);
-       }
-       
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::getBaseDir()
-        */
-       public function getBaseDir() {
-               return $this->path;
-       }
-
-       /**
-        * Retrieve gathered package info
-        * @return Generator
-        */
-       public function getPackageInfo() {
-               if (($name = $this->sxe->xpath("/pecl:package/pecl:name"))) {
-                       yield "name" => (string) $name[0];
-               }
-               if (($release = $this->sxe->xpath("/pecl:package/pecl:version/pecl:release"))) {
-                       yield "release" => (string) $release[0];
-               }
-               if ($this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease")) {
-                       yield "zend" => true;
-               }
-       }
-
-       /**
-        * @inheritdoc
-        * @return string
-        */
-       public function getLicense() {
-               if (($license = $this->sxe->xpath("/pecl:package/pecl:license"))) {
-                       if (($file = $this->findLicense($this->getBaseDir(), $license[0]["filesource"]))) {
-                               return $this->readLicense($file);
-                       }
-               }
-               if (($file = $this->findLicense($this->getBaseDir()))) {
-                       return $this->readLicense($file);
-               }
-               if ($license) {
-                       return $license[0] ." ". $license[0]["uri"];
-               }
-               return "UNKNOWN";
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::getArgs()
-        */
-       public function getArgs() {
-               $configure = $this->sxe->xpath("/pecl:package/pecl:extsrcrelease/pecl:configureoption");
-               foreach ($configure as $cfg) {
-                       yield [null, $cfg["name"], ucfirst($cfg["prompt"]), Args::OPTARG,
-                               strlen($cfg["default"]) ? $cfg["default"] : null];
-               }
-               $configure = $this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease/pecl:configureoption");
-               foreach ($configure as $cfg) {
-                       yield [null, $cfg["name"], ucfirst($cfg["prompt"]), Args::OPTARG,
-                               strlen($cfg["default"]) ? $cfg["default"] : null];
-               }
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\SourceDir::setArgs()
-        */
-       public function setArgs(Args $args) {
-               $configure = $this->sxe->xpath("/pecl:package/pecl:extsrcrelease/pecl:configureoption");
-               foreach ($configure as $cfg) {
-                       if (isset($args[$cfg["name"]])) {
-                               $args->configure = "--{$cfg["name"]}={$args[$cfg["name"]]}";
-                       }
-               }
-               $configure = $this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease/pecl:configureoption");
-               foreach ($configure as $cfg) {
-                       if (isset($args[$cfg["name"]])) {
-                               $args->configure = "--{$cfg["name"]}={$args[$cfg["name"]]}";
-                       }
-               }
-       }
-       
-       /**
-        * Compute the path of a file by parent dir nodes
-        * @param \SimpleXMLElement $ele
-        * @return string
-        */
-       private function dirOf($ele) {
-               $path = "";
-               while (($ele = current($ele->xpath(".."))) && $ele->getName() == "dir") {
-                       $path = trim($ele["name"], "/") ."/". $path ;
-               }
-               return trim($path, "/");
-       }
-
-       /**
-        * Generate a list of files from the package.xml
-        * @return Generator
-        */
-       private function generateFiles() {
-               /* hook  */
-               $temp = tmpfile();
-               fprintf($temp, "<?php\nreturn new %s(__DIR__);\n", get_class($this));
-               rewind($temp);
-               yield "pharext_package.php" => $temp;
-
-               /* deps */
-               $dependencies = $this->sxe->xpath("/pecl:package/pecl:dependencies/pecl:required/pecl:package");
-               foreach ($dependencies as $key => $dep) {
-                       if (($glob = glob("{$this->path}/{$dep->name}-*.ext.phar*"))) {
-                               usort($glob, function($a, $b) {
-                                       return version_compare(
-                                               substr($a, strpos(".ext.phar", $a)),
-                                               substr($b, strpos(".ext.phar", $b))
-                                       );
-                               });
-                               yield end($glob);
-                       }
-               }
-
-               /* files */
-               yield realpath($this->file);
-               foreach ($this->sxe->xpath("//pecl:file") as $file) {
-                       yield realpath($this->path ."/". $this->dirOf($file) ."/". $file["name"]);
-               }
-       }
-       
-       /**
-        * Implements IteratorAggregate
-        * @see IteratorAggregate::getIterator()
-        */
-       public function getIterator() {
-               return $this->generateFiles();
-       }
-}
-<?php
-
-namespace pharext;
-
-/**
- * Source directory interface, which should yield file names to package on traversal
- */
-interface SourceDir extends \Traversable
-{
-       /**
-        * Retrieve the base directory
-        * @return string
-        */
-       public function getBaseDir();
-
-       /**
-        * Retrieve gathered package info
-        * @return array|Traversable
-        */
-       public function getPackageInfo();
-
-       /**
-        * Retrieve the full text license
-        * @return string
-        */
-       public function getLicense();
-
-       /**
-        * Provide installer command line args
-        * @return array|Traversable
-        */
-       public function getArgs();
-
-       /**
-        * Process installer command line args
-        * @param \pharext\Cli\Args $args
-        */
-       public function setArgs(Cli\Args $args);
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\ExecCmd;
-use pharext\Task;
-use pharext\Tempfile;
-
-/**
- * PHP INI activation
- */
-class Activate implements Task
-{
-       /**
-        * @var string
-        */
-       private $cwd;
-
-       /**
-        * @var array
-        */
-       private $inis;
-
-       /**
-        * @var string
-        */
-       private $type;
-
-       /**
-        * @var string
-        */
-       private $php_config;
-       
-       /**
-        * @var string
-        */
-       private $sudo;
-
-       /**
-        * @param string $cwd working directory
-        * @param array $inis custom INI or list of loaded/scanned INI files
-        * @param string $type extension or zend_extension
-        * @param string $prefix install prefix, e.g. /usr/local
-        * @param string $common_name PHP programs common name, e.g. php5
-        * @param string $sudo sudo command
-        * @throws \pharext\Exception
-        */
-       public function __construct($cwd, array $inis, $type = "extension", $prefix = null, $common_name = "php", $sudo = null) {
-               $this->cwd = $cwd;
-               $this->type = $type;
-               $this->sudo = $sudo;
-               if (!$this->inis = $inis) {
-                       throw new Exception("No PHP INIs given");
-               }
-               $cmd = $common_name . "-config";
-               if (isset($prefix)) {
-                       $cmd = $prefix . "/bin/" . $cmd;
-               }
-               $this->php_config = $cmd;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return boolean false, if extension was already activated
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Running INI activation ...\n");
-               }
-               $extension = basename(current(glob("{$this->cwd}/modules/*.so")));
-
-               if ($this->type === "zend_extension") {
-                       $pattern = preg_quote((new ExecCmd($this->php_config))->run(["--extension-dir"])->getOutput() . "/$extension", "/");
-               } else {
-                       $pattern = preg_quote($extension, "/");
-               }
-
-               foreach ($this->inis as $file) {
-                       if ($verbose) {
-                               printf("Checking %s ...\n", $file);
-                       }
-                       if (!file_exists($file)) {
-                               throw new Exception(sprintf("INI file '%s' does not exist", $file));
-                       }
-                       $temp = new Tempfile("phpini");
-                       foreach (file($file) as $line) {
-                               if (preg_match("/^\s*{$this->type}\s*=\s*[\"']?{$pattern}[\"']?\s*(;.*)?\$/", $line)) {
-                                       return false;
-                               }
-                               fwrite($temp->getStream(), $line);
-                       }
-               }
-
-               /* not found; append to last processed file, which is the main by default */
-               if ($verbose) {
-                       printf("Activating in %s ...\n", $file);
-               }
-               fprintf($temp->getStream(), $this->type . "=%s\n", $extension);
-               $temp->closeStream();
-
-               $path = $temp->getPathname();
-               $stat = stat($file);
-
-               // owner transfer
-               $ugid = sprintf("%d:%d", $stat["uid"], $stat["gid"]);
-               $cmd = new ExecCmd("chown", $verbose);
-               if (isset($this->sudo)) {
-                       $cmd->setSu($this->sudo);
-               }
-               $cmd->run([$ugid, $path]);
-
-               // permission transfer
-               $perm = decoct($stat["mode"] & 0777);
-               $cmd = new ExecCmd("chmod", $verbose);
-               if (isset($this->sudo)) {
-                       $cmd->setSu($this->sudo);
-               }
-               $cmd->run([$perm, $path]);
-
-               // rename
-               $cmd = new ExecCmd("mv", $verbose);
-               if (isset($this->sudo)) {
-                       $cmd->setSu($this->sudo);
-               }
-               $cmd->run([$path, $file]);
-               
-               if ($verbose) {
-                       printf("Replaced %s ...\n", $file);
-               }
-
-               return true;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Task;
-
-/**
- * Ask password on console
- */
-class Askpass implements Task
-{
-       /**
-        * @var string
-        */
-       private $prompt;
-
-       /**
-        * @param string $prompt
-        */
-       public function __construct($prompt = "Password:") {
-               $this->prompt = $prompt;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return string
-        */
-       public function run($verbose = false) {
-               system("stty -echo");
-               printf("%s ", $this->prompt);
-               $pass = fgets(STDIN, 1024);
-               printf("\n");
-               system("stty echo");
-               if (substr($pass, -1) == "\n") {
-                       $pass = substr($pass, 0, -1);
-               }
-               return $pass;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Task;
-
-use RecursiveDirectoryIterator;
-use RecursiveIteratorIterator;
-
-/**
- * List all library files of pharext to bundle with a phar
- */
-class BundleGenerator implements Task
-{
-       /**
-        * @param bool $verbose
-        * @return Generator
-        */
-       public function run($verbose = false) {
-               if ($verbose) {
-                       printf("Packaging pharext ... \n");
-               }
-               $rdi = new RecursiveDirectoryIterator(dirname(dirname(__DIR__)));
-               $rii = new RecursiveIteratorIterator($rdi);
-               for ($rii->rewind(); $rii->valid(); $rii->next()) {
-                       if (!$rii->isDot()) {
-                               yield $rii->getSubPathname() => $rii->key();
-                       }
-               }
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Task;
-
-use FilesystemIterator;
-use RecursiveDirectoryIterator;
-use RecursiveIteratorIterator;
-
-/**
- * Recursively cleanup FS entries
- */
-class Cleanup implements Task
-{
-       /**
-        * @var string
-        */
-       private $rm;
-
-       public function __construct($rm) {
-               $this->rm = $rm;
-       }
-
-       /**
-        * @param bool $verbose
-        */
-       public function run($verbose = false) {
-               if ($verbose) {
-                       printf("Cleaning up %s ...\n", $this->rm);
-               }
-               if ($this->rm instanceof Tempfile) {
-                       unset($this->rm);
-               } elseif (is_dir($this->rm)) {
-                       $rdi = new RecursiveDirectoryIterator($this->rm,
-                               FilesystemIterator::CURRENT_AS_SELF | // needed for 5.5
-                               FilesystemIterator::KEY_AS_PATHNAME |
-                               FilesystemIterator::SKIP_DOTS);
-                       $rii = new RecursiveIteratorIterator($rdi,
-                               RecursiveIteratorIterator::CHILD_FIRST);
-                       foreach ($rii as $path => $child) {
-                               if ($child->isDir()) {
-                                       @rmdir($path);
-                               } else {
-                                       @unlink($path);
-                               }
-                       }
-                       @rmdir($this->rm);
-               } elseif (file_exists($this->rm)) {
-                       @unlink($this->rm);
-               }
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\ExecCmd;
-use pharext\Task;
-
-/**
- * Runs extension's configure
- */
-class Configure implements Task
-{
-       /**
-        * @var array
-        */
-       private $args;
-
-       /**
-        * @var string
-        */
-       private $cwd;
-
-       /**
-        * @param string $cwd working directory
-        * @param array $args configure args
-        * @param string $prefix install prefix, e.g. /usr/local
-        * @param string $common_name PHP programs common name, e.g. php5
-        */
-       public function __construct($cwd, array $args = null, $prefix = null, $common_name = "php") {
-               $this->cwd = $cwd;
-               $cmd = $common_name . "-config";
-               if (isset($prefix)) {
-                       $cmd = $prefix . "/bin/" . $cmd;
-               }
-               $this->args =  ["--with-php-config=$cmd"];
-               if ($args) {
-                       $this->args = array_merge($this->args, $args);
-               }
-       }
-
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Running ./configure ...\n");
-               }
-               $pwd = getcwd();
-               if (!chdir($this->cwd)) {
-                       throw new Exception;
-               }
-               try {
-                       $cmd = new ExecCmd("./configure", $verbose);
-                       $cmd->run($this->args);
-               } finally {
-                       chdir($pwd);
-               }
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Archive;
-use pharext\Task;
-use pharext\Tempdir;
-
-use Phar;
-use PharData;
-
-/**
- * Extract a package archive
- */
-class Extract implements Task
-{
-       /**
-        * @var Phar(Data)
-        */
-       private $source;
-
-       /**
-        * @param mixed $source archive location
-        */
-       public function __construct($source) {
-               if ($source instanceof Phar || $source instanceof PharData || $source instanceof Archive) {
-                       $this->source = $source;
-               } else {
-                       $this->source = new PharData($source);
-               }
-       }
-
-       /**
-        * @param bool $verbose
-        * @return \pharext\Tempdir
-        */
-       public function run($verbose = false) {
-               if ($verbose) {
-                       printf("Extracting %s ...\n", basename($this->source->getPath()));
-               }
-               if ($this->source instanceof Archive) {
-                       return $this->source->extract();
-               }
-               $dest = new Tempdir("extract");
-               $this->source->extractTo($dest);
-               return $dest;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\ExecCmd;
-use pharext\Task;
-use pharext\Tempdir;
-
-/**
- * Clone a git repo
- */
-class GitClone implements Task
-{
-       /**
-        * @var string
-        */
-       private $source;
-       
-       /**
-        * @var string
-        */
-       private $branch;
-
-       /**
-        * @param string $source git repo location
-        */
-       public function __construct($source, $branch = null) {
-               $this->source = $source;
-               $this->branch = $branch;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return \pharext\Tempdir
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Fetching %s ...\n", $this->source);
-               }
-               $local = new Tempdir("gitclone");
-               $cmd = new ExecCmd("git", $verbose);
-               if (strlen($this->branch)) {
-                       $cmd->run(["clone", "--depth", 1, "--branch", $this->branch, $this->source, $local]);
-               } else {
-                       $cmd->run(["clone", $this->source, $local]);
-               }
-               return $local;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\ExecCmd;
-use pharext\Exception;
-use pharext\Task;
-
-/**
- * Run make in the source dir
- */
-class Make implements Task
-{
-       /**
-        * @var string
-        */
-       private $cwd;
-
-       /**
-        * @var array
-        */
-       private $args;
-
-       /**
-        * @var string
-        */
-       private $sudo;
-
-       /**
-        *
-        * @param string $cwd working directory
-        * @param array $args make's arguments
-        * @param string $sudo sudo command
-        */
-       public function __construct($cwd, array $args = null, $sudo = null) {
-               $this->cwd = $cwd;
-               $this->sudo = $sudo;
-               $this->args = $args;
-       }
-
-       /**
-        *
-        * @param bool $verbose
-        * @throws \pharext\Exception
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Running make");
-                       if ($this->args) {
-                               foreach ($this->args as $arg) {
-                                       printf(" %s", $arg);
-                               }
-                       }
-                       printf(" ...\n");
-               }
-               $pwd = getcwd();
-               if (!chdir($this->cwd)) {
-                       throw new Exception;
-               }
-               try {
-                       $cmd = new ExecCmd("make", $verbose);
-                       if (isset($this->sudo)) {
-                               $cmd->setSu($this->sudo);
-                       }
-                       $args = $this->args;
-                       if (!$verbose) {
-                               $args = array_merge((array) $args, ["-s"]);
-                       }
-                       $cmd->run($args);
-               } finally {
-                       chdir($pwd);
-               }
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\Task;
-use pharext\Tempfile;
-
-class PaxFixup implements Task
-{
-       private $source;
-
-       public function __construct($source) {
-               $this->source = $source;
-       }
-
-       private function openArchive($source) {
-               $hdr = file_get_contents($source, false, null, 0, 3);
-               if ($hdr === "\x1f\x8b\x08") {
-                       $fd = fopen("compress.zlib://$source", "r");
-               } elseif ($hdr === "BZh") {
-                       $fd = fopen("compress.bzip2://$source", "r");
-               } else {
-                       $fd = fopen($source, "r");
-               }
-               if (!is_resource($fd)) {
-                       throw new Exception;
-               }
-               return $fd;
-       }
-
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Fixing up a tarball with global pax header ...\n");
-               }
-               $temp = new Tempfile("paxfix");
-               stream_copy_to_stream($this->openArchive($this->source),
-                       $temp->getStream(), -1, 1024);
-               $temp->closeStream();
-               return (new Extract((string) $temp))->run($verbose);
-       }
-}<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\Task;
-
-/**
- * Fixup package.xml files in an extracted PECL dir
- */
-class PeclFixup implements Task
-{
-       /**
-        * @var string
-        */
-       private $source;
-
-       /**
-        * @param string $source source directory
-        */
-       public function __construct($source) {
-               $this->source = $source;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return string sanitized source location
-        * @throws \pahrext\Exception
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Sanitizing PECL dir ...\n");
-               }
-               $dirs = glob("{$this->source}/*", GLOB_ONLYDIR);
-               $files = array_diff(glob("{$this->source}/*"), $dirs);
-               $check = array_reduce($files, function($r, $v) {
-                       return $v && fnmatch("package*.xml", basename($v));
-               }, true);
-
-               if (count($dirs) !== 1 || !$check) {
-                       throw new Exception("Does not look like an extracted PECL dir: {$this->source}");
-               }
-
-               $dest = current($dirs);
-
-               foreach ($files as $file) {
-                       if ($verbose) {
-                               printf("Moving %s into %s ...\n", basename($file), basename($dest));
-                       }
-                       if (!rename($file, "$dest/" . basename($file))) {
-                               throw new Exception;
-                       }
-               }
-
-               return $dest;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\SourceDir;
-use pharext\Task;
-use pharext\Tempname;
-
-use Phar;
-
-/**
- * Build phar
- */
-class PharBuild implements Task
-{
-       /**
-        * @var \pharext\SourceDir
-        */
-       private $source;
-
-       /**
-        * @var string
-        */
-       private $stub;
-
-       /**
-        * @var array
-        */
-       private $meta;
-
-       /**
-        * @var bool
-        */
-       private $readonly;
-
-       /**
-        * @param SourceDir $source extension source directory
-        * @param string $stub path to phar stub
-        * @param array $meta phar meta data
-        * @param bool $readonly whether the stub has -dphar.readonly=1 set
-        */
-       public function __construct(SourceDir $source = null, $stub, array $meta = null, $readonly = true) {
-               $this->source = $source;
-               $this->stub = $stub;
-               $this->meta = $meta;
-               $this->readonly = $readonly;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return \pharext\Tempname
-        * @throws \pharext\Exception
-        */
-       public function run($verbose = false) {
-               /* Phar::compress() and ::convert*() use strtok("."), ugh!
-                * so, be sure to not use any other dots in the filename
-                * except for .phar
-                */
-               $temp = new Tempname("", "-pharext.phar");
-
-               $phar = new Phar($temp);
-               $phar->startBuffering();
-
-               if ($this->meta) {
-                       $phar->setMetadata($this->meta);
-               }
-               if ($this->stub) {
-                       (new PharStub($phar, $this->stub))->run($verbose);
-               }
-
-               $phar->buildFromIterator((new Task\BundleGenerator)->run());
-
-               if ($this->source) {
-                       if ($verbose) {
-                               $bdir = $this->source->getBaseDir();
-                               $blen = strlen($bdir);
-                               foreach ($this->source as $index => $file) {
-                                       if (is_resource($file)) {
-                                               printf("Packaging %s ...\n", $index);
-                                               $phar[$index] = $file;
-                                       } else {
-                                               printf("Packaging %s ...\n", $index = trim(substr($file, $blen), "/"));
-                                               $phar->addFile($file, $index);
-                                       }
-                               }
-                       } else {
-                               $phar->buildFromIterator($this->source, $this->source->getBaseDir());
-                       }
-               }
-
-               $phar->stopBuffering();
-               
-               if (!chmod($temp, fileperms($temp) | 0111)) {
-                       throw new Exception;
-               }
-               
-               return $temp;
-       }
-}<?php
-
-namespace pharext\Task;
-
-use pharext\Task;
-
-use Phar;
-
-/**
- * Clone a compressed copy of a phar
- */
-class PharCompress implements Task
-{
-       /**
-        * @var string
-        */
-       private $file;
-
-       /**
-        * @var Phar
-        */
-       private $package;
-
-       /**
-        * @var int
-        */
-       private $encoding;
-
-       /**
-        * @var string
-        */
-       private $extension;
-
-       /**
-        * @param string $file path to the original phar
-        * @param int $encoding Phar::GZ or Phar::BZ2
-        */
-       public function __construct($file, $encoding) {
-               $this->file = $file;
-               $this->package = new Phar($file);
-               $this->encoding = $encoding;
-
-               switch ($encoding) {
-                       case Phar::GZ:
-                               $this->extension = ".gz";
-                               break;
-                       case Phar::BZ2:
-                               $this->extension = ".bz2";
-                               break;
-               }
-       }
-
-       /**
-        * @param bool $verbose
-        * @return string
-        */
-       public function run($verbose = false) {
-               if ($verbose) {
-                       printf("Compressing %s ...\n", basename($this->package->getPath()));
-               }
-               /* stop shebang */
-               $stub = $this->package->getStub();
-               $phar = $this->package->compress($this->encoding);
-               $phar->setStub(substr($stub, strpos($stub, "\n")+1));
-               return $this->file . $this->extension;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\Task;
-
-/**
- * Rename the phar archive
- */
-class PharRename implements Task
-{
-       /**
-        * @var string
-        */
-       private $phar;
-
-       /**
-        * @var string
-        */
-       private $dest;
-
-       /**
-        * @var string
-        */
-       private $name;
-
-       /**
-        * @param string $phar path to phar
-        * @param string $dest destination dir
-        * @param string $name package name
-        */
-       public function __construct($phar, $dest, $name) {
-               $this->phar = $phar;
-               $this->dest = $dest;
-               $this->name = $name;
-       }
-
-       /**
-        * @param bool $verbose
-        * @return string path to renamed phar
-        * @throws \pharext\Exception
-        */
-       public function run($verbose = false) {
-               $extension = substr(strstr($this->phar, "-pharext.phar"), 8);
-               $name = sprintf("%s/%s.ext%s", $this->dest, $this->name, $extension);
-               
-               if ($verbose) {
-                       printf("Renaming %s to %s ...\n", basename($this->phar), basename($name));
-               }
-
-               if (!rename($this->phar, $name)) {
-                       throw new Exception;
-               }
-
-               return $name;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Openssl;
-use pharext\Task;
-
-use Phar;
-
-/**
- * Sign the phar with a private key
- */
-class PharSign implements Task
-{
-       /**
-        * @var Phar
-        */
-       private $phar;
-
-       /**
-        * @var \pharext\Openssl\PrivateKey
-        */
-       private $pkey;
-
-       /**
-        *
-        * @param mixed $phar phar instance or path to phar
-        * @param string $pkey path to private key
-        * @param string $pass password for the private key
-        */
-       public function __construct($phar, $pkey, $pass) {
-               if ($phar instanceof Phar || $phar instanceof PharData) {
-                       $this->phar = $phar;
-               } else {
-                       $this->phar = new Phar($phar);
-               }
-               $this->pkey = new Openssl\PrivateKey($pkey, $pass);
-       }
-
-       /**
-        * @param bool $verbose
-        * @return \pharext\Openssl\PrivateKey
-        */
-       public function run($verbose = false) {
-               if ($verbose) {
-                       printf("Signing %s ...\n", basename($this->phar->getPath()));
-               }
-               $this->pkey->sign($this->phar);
-               return $this->pkey;
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use Phar;
-use pharext\Exception;
-use pharext\Task;
-
-/**
- * Set the phar's stub
- */
-class PharStub implements Task
-{
-       /**
-        * @var \Phar
-        */
-       private $phar;
-
-       /**
-        * @var string
-        */
-       private $stub;
-
-       /**
-        * @param \Phar $phar
-        * @param string $stub file path to the stub
-        * @throws \pharext\Exception
-        */
-       function __construct(Phar $phar, $stub) {
-               $this->phar = $phar;
-               if (!file_exists($this->stub = $stub)) {
-                       throw new Exception("File '$stub' does not exist");
-               }
-       }
-
-       /**
-        * @param bool $verbose
-        */
-       function run($verbose = false) {
-               if ($verbose) {
-                       printf("Using stub '%s'...\n", basename($this->stub));
-               }
-               $stub = preg_replace_callback('/^#include <([^>]+)>/m', function($includes) {
-                       return file_get_contents($includes[1], true, null, 5);
-               }, file_get_contents($this->stub));
-               if ($this->phar->isCompressed() && substr($stub, 0, 2) === "#!") {
-                       $stub = substr($stub, strpos($stub, "\n")+1);
-               }
-               $this->phar->setStub($stub);
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\ExecCmd;
-use pharext\Task;
-
-/**
- * Run phpize in the extension source directory
- */
-class Phpize implements Task
-{
-       /**
-        * @var string
-        */
-       private $phpize;
-
-       /**
-        *
-        * @var string
-        */
-       private $cwd;
-
-       /**
-        * @param string $cwd working directory
-        * @param string $prefix install prefix, e.g. /usr/local
-        * @param string $common_name PHP program common name, e.g. php5
-        */
-       public function __construct($cwd, $prefix = null,  $common_name = "php") {
-               $this->cwd = $cwd;
-               $cmd = $common_name . "ize";
-               if (isset($prefix)) {
-                       $cmd = $prefix . "/bin/" . $cmd;
-               }
-               $this->phpize = $cmd;
-       }
-
-       /**
-        * @param bool $verbose
-        * @throws \pharext\Exception
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Running %s ...\n", $this->phpize);
-               }
-               $pwd = getcwd();
-               if (!chdir($this->cwd)) {
-                       throw new Exception;
-               }
-               try {
-                       $cmd = new ExecCmd($this->phpize, $verbose);
-                       $cmd->run();
-               } finally {
-                       chdir($pwd);
-               }
-       }
-}
-<?php
-
-namespace pharext\Task;
-
-use pharext\Exception;
-use pharext\Task;
-use pharext\Tempfile;
-
-/**
- * Fetch a remote archive
- */
-class StreamFetch implements Task
-{
-       /**
-        * @var string
-        */
-       private $source;
-
-       /**
-        * @var callable
-        */
-       private $progress;
-
-       /**
-        * @param string $source remote file location
-        * @param callable $progress progress callback
-        */
-       public function __construct($source, callable $progress) {
-               $this->source = $source;
-               $this->progress = $progress;
-       }
-
-       private function createStreamContext() {
-               $progress = $this->progress;
-
-               /* avoid bytes_max bug of older PHP versions */
-               $maxbytes = 0;
-               return stream_context_create([],["notification" => function($notification, $severity, $message, $code, $bytes_cur, $bytes_max) use($progress, &$maxbytes) {
-                       if ($bytes_max > $maxbytes) {
-                               $maxbytes = $bytes_max;
-                       }
-                       switch ($notification) {
-                               case STREAM_NOTIFY_CONNECT:
-                                       $progress(0);
-                                       break;
-                               case STREAM_NOTIFY_PROGRESS:
-                                       $progress($maxbytes > 0 ? $bytes_cur/$maxbytes : .5);
-                                       break;
-                               case STREAM_NOTIFY_COMPLETED:
-                                       /* this is sometimes not generated, why? */
-                                       $progress(1);
-                                       break;
-                       }
-               }]);
-       }
-
-       /**
-        * @param bool $verbose
-        * @return \pharext\Task\Tempfile
-        * @throws \pharext\Exception
-        */
-       public function run($verbose = false) {
-               if ($verbose !== false) {
-                       printf("Fetching %s ...\n", $this->source);
-               }
-               $context = $this->createStreamContext();
-
-               if (!$remote = fopen($this->source, "r", false, $context)) {
-                       throw new Exception;
-               }
-               
-               $local = new Tempfile("remote");
-               if (!stream_copy_to_stream($remote, $local->getStream())) {
-                       throw new Exception;
-               }
-               $local->closeStream();
-
-               /* STREAM_NOTIFY_COMPLETED is not generated, see above */
-               call_user_func($this->progress, 1);
-
-               return $local;
-       }
-}
-<?php
-
-namespace pharext;
-
-/**
- * Simple task interface
- */
-interface Task
-{
-       public function run($verbose = false);
-}
-<?php
-
-namespace pharext;
-
-/**
- * Create a temporary directory
- */
-class Tempdir extends \SplFileInfo
-{
-       /**
-        * @param string $prefix prefix to uniqid()
-        * @throws \pharext\Exception
-        */
-       public function __construct($prefix) {
-               $temp = new Tempname($prefix);
-               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
-                       throw new Exception("Could not create tempdir: ".error_get_last()["message"]);
-               }
-               parent::__construct($temp);
-       }
-}
-<?php 
-
-namespace pharext;
-
-/**
- * Create a new temporary file
- */
-class Tempfile extends \SplFileInfo
-{
-       /**
-        * @var resource
-        */
-       private $handle;
-
-       /**
-        * @param string $prefix uniqid() prefix
-        * @param string $suffix e.g. file extension
-        * @throws \pharext\Exception
-        */
-       public function __construct($prefix, $suffix = ".tmp") {
-               $tries = 0;
-               $omask = umask(077);
-               do {
-                       $path = new Tempname($prefix, $suffix);
-                       $this->handle = fopen($path, "x");
-               } while (!is_resource($this->handle) && $tries++ < 10);
-               umask($omask);
-               
-               if (!is_resource($this->handle)) {
-                       throw new Exception("Could not create temporary file");
-               }
-               
-               parent::__construct($path);
-       }
-
-       /**
-        * Unlink the file
-        */
-       public function __destruct() {
-               if (is_file($this->getPathname())) {
-                       @unlink($this->getPathname());
-               }
-       }
-
-       /**
-        * Close the stream
-        */
-       public function closeStream() {
-               fclose($this->handle);
-       }
-
-       /**
-        * Retrieve the stream resource
-        * @return resource
-        */
-       public function getStream() {
-               return $this->handle;
-       }
-}
-<?php
-
-namespace pharext;
-
-use pharext\Exception;
-
-/**
- * A temporary file/directory name
- */
-class Tempname
-{
-       /**
-        * @var string
-        */
-       private $name;
-
-       /**
-        * @param string $prefix uniqid() prefix
-        * @param string $suffix e.g. file extension
-        */
-       public function __construct($prefix, $suffix = null) {
-               $temp = sys_get_temp_dir() . "/pharext-" . $this->getUser();
-               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
-                       throw new Exception;
-               }
-               $this->name = $temp ."/". uniqid($prefix) . $suffix;
-       }
-
-       private function getUser() {
-               if (extension_loaded("posix") && function_exists("posix_getpwuid")) {
-                       return posix_getpwuid(posix_getuid())["name"];
-               }
-               return trim(`whoami 2>/dev/null`)
-                       ?: trim(`id -nu 2>/dev/null`)
-                       ?: getenv("USER")
-                       ?: get_current_user();
-       }
-
-       /**
-        * @return string
-        */
-       public function __toString() {
-               return (string) $this->name;
-       }
-}
-<?php
-
-namespace pharext;
-
-use Phar;
-use PharFileInfo;
-use SplFileInfo;
-use pharext\Exception;
-
-class Updater implements Command
-{
-       use Cli\Command;
-
-       /**
-        * Create the command
-        */
-       public function __construct() {
-               $this->args = new Cli\Args([
-                       ["h", "help", "Display this help",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       ["v", "verbose", "More output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       ["q", "quiet", "Less output",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
-                       [null, "signature", "Show pharext signature",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "license", "Show pharext license",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [null, "version", "Show pharext version",
-                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
-                       [0, "path", "Path to .ext.phar to update",
-                               Cli\Args::REQUIRED|Cli\Args::MULTI],
-               ]);
-       }
-
-       /**
-        * @inheritdoc
-        * @see \pharext\Command::run()
-        */
-       public function run($argc, array $argv) {
-               $errs = [];
-               $prog = array_shift($argv);
-               foreach ($this->args->parse(--$argc, $argv) as $error) {
-                       $errs[] = $error;
-               }
-
-               if ($this->args["help"]) {
-                       $this->header();
-                       $this->help($prog);
-                       exit;
-               }
-
-               try {
-                       foreach (["signature", "license", "version"] as $opt) {
-                               if ($this->args[$opt]) {
-                                       printf("%s\n", $this->metadata($opt));
-                                       exit;
-                               }
-                       }
-               } catch (\Exception $e) {
-                       $this->error("%s\n", $e->getMessage());
-                       exit(self::EARGS);
-               }
-
-
-               foreach ($this->args->validate() as $error) {
-                       $errs[] = $error;
-               }
-
-               if ($errs) {
-                       if (!$this->args["quiet"]) {
-                               $this->header();
-                       }
-                       foreach ($errs as $err) {
-                               $this->error("%s\n", $err);
-                       }
-                       printf("\n");
-                       if (!$this->args["quiet"]) {
-                               $this->help($prog);
-                       }
-                       exit(self::EARGS);
-               }
-
-               foreach ($this->args[0] as $file) {
-                       $info = new SplFileInfo($file);
-
-                       while ($info->isLink()) {
-                               $info = new SplFileInfo($info->getLinkTarget());
-                       }
-                       
-                       if ($info->isFile()) {
-                               if (!$this->updatePackage($info)) {
-                                       $this->warn("Cannot upgrade pre-v3 packages\n");
-                               }
-                       } else {
-                               $this->error("File '%s' does not exist\n", $file);
-                               exit(self::EARGS);
-                       }
-               }
-       }
-
-       /**
-        * Replace the pharext core in an .ext.phar package
-        * @param string $temp path to temp phar
-        * @return boolean FALSE if the package is too old (pre-v3) to upgrade
-        */
-       private function replacePharext($temp) {
-               $phar = new Phar($temp, Phar::CURRENT_AS_SELF);
-               $phar->startBuffering();
-
-               if (!$meta = $phar->getMetadata()) {
-                       // don't upgrade pre-v3 packages
-                       return false;
-               }
-
-               // replace current pharext files
-               $core = (new Task\BundleGenerator)->run($this->verbosity());
-               $phar->buildFromIterator($core);
-               $stub = __DIR__."/../pharext_installer.php";
-               (new Task\PharStub($phar, $stub))->run($this->verbosity());
-
-               // check dependencies
-               foreach ($phar as $info) {
-                       if (fnmatch("*.ext.phar*", $info->getBasename())) {
-                               $this->updatePackage($info, $phar);
-                       }
-               }
-               
-               $phar->stopBuffering();
-
-               $phar->setMetadata([
-                       "version" => Metadata::version(),
-                       "header" => Metadata::header(),
-               ] + $meta);
-
-               $this->info("Updated pharext version from '%s' to '%s'\n",
-                       isset($meta["version"]) ? $meta["version"] : "(unknown)",
-                       $phar->getMetadata()["version"]);
-
-               return true;
-       }
-
-       /**
-        * Update an .ext.phar package to the current pharext version
-        * @param SplFileInfo $file
-        * @param Phar $phar the parent phar containing $file as dependency
-        * @return boolean FALSE if the package is too old (pre-v3) to upgrade
-        * @throws Exception
-        */
-       private function updatePackage(SplFileInfo $file, Phar $phar = null) {
-               $this->info("Updating pharext core in '%s'...\n", basename($file));
-
-               $temp = new Tempname("update", substr(strstr($file, ".ext.phar"), 4));
-
-               if (!copy($file->getPathname(), $temp)) {
-                       throw new Exception;
-               }
-               if (!chmod($temp, $file->getPerms())) {
-                       throw new Exception;
-               }
-               
-               if (!$this->replacePharext($temp)) {
-                       return false;
-               }
-
-               if ($phar) {
-                       $phar->addFile($temp, $file);
-               } elseif (!rename($temp, $file->getPathname())) {
-                       throw new Exception;
-               }
-
-               return true;
-       }
-}
-#!/usr/bin/env php
-<?php
-
-/**
- * The installer sub-stub for extension phars
- */
-
-namespace pharext;
-
-define("PHAREXT_PHAR", __FILE__);
-
-spl_autoload_register(function($c) {
-       return include strtr($c, "\\_", "//") . ".php";
-});
-
-#include <pharext/Exception.php>
-#include <pharext/Tempname.php>
-#include <pharext/Tempfile.php>
-#include <pharext/Tempdir.php>
-#include <pharext/Archive.php>
-
-namespace pharext;
-
-if (extension_loaded("Phar")) {
-       \Phar::interceptFileFuncs();
-       \Phar::mapPhar();
-       $phardir = "phar://".__FILE__;
-} else {
-       $archive = new Archive(__FILE__);
-       $phardir = $archive->extract();
-}
-
-set_include_path("$phardir:". get_include_path());
-
-$installer = new Installer();
-$installer->run($argc, $argv);
-
-__HALT_COMPILER();
-#!/usr/bin/php -dphar.readonly=0
-<?php
-
-/**
- * The packager sub-stub for bin/pharext
- */
-
-namespace pharext;
-
-spl_autoload_register(function($c) {
-       return include strtr($c, "\\_", "//") . ".php";
-});
-
-set_include_path('phar://' . __FILE__ .":". get_include_path());
-
-if (!extension_loaded("Phar")) {
-       fprintf(STDERR, "ERROR: Phar extension not loaded\n\n");
-       fprintf(STDERR, "\tPlease load the phar extension in your php.ini\n".
-                                       "\tor rebuild PHP with the --enable-phar flag.\n\n");
-       exit(1);
-}
-
-if (ini_get("phar.readonly")) {
-       fprintf(STDERR, "ERROR: Phar is configured read-only\n\n");
-       fprintf(STDERR, "\tPlease specify phar.readonly=0 in your php.ini\n".
-                                       "\tor run this command with php -dphar.readonly=0\n\n");
-       exit(1);
-}
-
-\Phar::interceptFileFuncs();
-\Phar::mapPhar();
-
-$packager = new Packager();
-$packager->run($argc, $argv);
-
-__HALT_COMPILER();
-#!/usr/bin/php -dphar.readonly=0
-<?php
-
-/**
- * The installer updater stub for extension phars
- */
-
-namespace pharext;
-
-spl_autoload_register(function($c) {
-       return include strtr($c, "\\_", "//") . ".php";
-});
-
-set_include_path('phar://' . __FILE__ .":". get_include_path());
-
-if (!extension_loaded("Phar")) {
-       fprintf(STDERR, "ERROR: Phar extension not loaded\n\n");
-       fprintf(STDERR, "\tPlease load the phar extension in your php.ini\n".
-                                       "\tor rebuild PHP with the --enable-phar flag.\n\n");
-       exit(1);
-}
-
-if (ini_get("phar.readonly")) {
-       fprintf(STDERR, "ERROR: Phar is configured read-only\n\n");
-       fprintf(STDERR, "\tPlease specify phar.readonly=0 in your php.ini\n".
-                                       "\tor run this command with php -dphar.readonly=0\n\n");
-       exit(1);
-}
-
-\Phar::interceptFileFuncs();
-\Phar::mapPhar();
-
-$updater = new Updater();
-$updater->run($argc, $argv);
-
-__HALT_COMPILER();
-<?php
-return new pharext\SourceDir\Pecl(__DIR__);
-<?xml version="1.0" encoding="UTF-8"?>
-<package 
- packagerversion="1.4.11" 
- version="2.0" 
- xmlns="http://pear.php.net/dtd/package-2.0" 
- xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" 
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
- xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
-http://pear.php.net/dtd/tasks-1.0.xsd
-http://pear.php.net/dtd/package-2.0
-http://pear.php.net/dtd/package-2.0.xsd">
- <name>raphf</name>
- <channel>pecl.php.net</channel>
- <summary>Resource and persistent handles factory</summary>
- <description>A reusable split-off of pecl_http's persistent handle and resource factory API.</description>
- <lead>
-  <name>Michael Wallner</name>
-  <user>mike</user>
-  <email>mike@php.net</email>
-  <active>yes</active>
- </lead>
- <date>2015-07-28</date>
- <version>
-  <release>2.0.0-dev</release>
-  <api>2.0.0</api>
- </version>
- <stability>
-  <release>stable</release>
-  <api>stable</api>
- </stability>
- <license>BSD, revised</license>
- <notes><![CDATA[
-]]></notes>
- <contents>
-  <dir name="/">
-   <file role="doc" name="CREDITS" />
-   <file role="doc" name="LICENSE" />
-   <file role="doc" name="Doxyfile" />
-   <file role="src" name="config.m4" />
-   <file role="src" name="config.w32" />
-   <file role="src" name="php_raphf.h" />
-   <file role="src" name="php_raphf_api.h" />
-   <file role="src" name="php_raphf.c" />
-   <dir name="tests">
-    <file role="test" name="http001.phpt" />
-    <file role="test" name="http002.phpt" />
-    <file role="test" name="http003.phpt" />
-    <file role="test" name="http004.phpt" />
-   </dir>
-  </dir>
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>7.0.0</min>
-   </php>
-   <pearinstaller>
-    <min>1.4.0</min>
-   </pearinstaller>
-  </required>
- </dependencies>
- <providesextension>raphf</providesextension>
- <extsrcrelease/>
-</package>
-
-raphf
-Michael Wallner
-Copyright (c) 2013, Michael Wallner <mike@php.net>.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without 
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice, 
-      this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright 
-      notice, this list of conditions and the following disclaimer in the 
-      documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-# Doxyfile 1.8.9.1
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-DOXYFILE_ENCODING      = UTF-8
-PROJECT_NAME           = "Resource and persistent handle factory API"
-PROJECT_NUMBER         =
-PROJECT_BRIEF          = "A facility to manage possibly persistent resources with a comprehensible API.  Provides simliar functionality like the zend_list API, but with more flexiblity and freedom."
-PROJECT_LOGO           = raphf.png
-OUTPUT_DIRECTORY       =
-CREATE_SUBDIRS         = NO
-ALLOW_UNICODE_NAMES    = NO
-OUTPUT_LANGUAGE        = English
-BRIEF_MEMBER_DESC      = YES
-REPEAT_BRIEF           = YES
-ABBREVIATE_BRIEF       =
-ALWAYS_DETAILED_SEC    = NO
-INLINE_INHERITED_MEMB  = NO
-FULL_PATH_NAMES        = YES
-STRIP_FROM_PATH        =
-STRIP_FROM_INC_PATH    =
-SHORT_NAMES            = NO
-JAVADOC_AUTOBRIEF      = YES
-QT_AUTOBRIEF           = NO
-MULTILINE_CPP_IS_BRIEF = NO
-INHERIT_DOCS           = YES
-SEPARATE_MEMBER_PAGES  = NO
-TAB_SIZE               = 4
-ALIASES                =
-TCL_SUBST              =
-OPTIMIZE_OUTPUT_FOR_C  = YES
-OPTIMIZE_OUTPUT_JAVA   = NO
-OPTIMIZE_FOR_FORTRAN   = NO
-OPTIMIZE_OUTPUT_VHDL   = NO
-EXTENSION_MAPPING      =
-MARKDOWN_SUPPORT       = YES
-AUTOLINK_SUPPORT       = YES
-BUILTIN_STL_SUPPORT    = NO
-CPP_CLI_SUPPORT        = NO
-SIP_SUPPORT            = NO
-IDL_PROPERTY_SUPPORT   = YES
-DISTRIBUTE_GROUP_DOC   = NO
-SUBGROUPING            = YES
-INLINE_GROUPED_CLASSES = NO
-INLINE_SIMPLE_STRUCTS  = YES
-TYPEDEF_HIDES_STRUCT   = NO
-LOOKUP_CACHE_SIZE      = 0
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-EXTRACT_ALL            = YES
-EXTRACT_PRIVATE        = NO
-EXTRACT_PACKAGE        = NO
-EXTRACT_STATIC         = NO
-EXTRACT_LOCAL_CLASSES  = NO
-EXTRACT_LOCAL_METHODS  = NO
-EXTRACT_ANON_NSPACES   = NO
-HIDE_UNDOC_MEMBERS     = NO
-HIDE_UNDOC_CLASSES     = NO
-HIDE_FRIEND_COMPOUNDS  = NO
-HIDE_IN_BODY_DOCS      = NO
-INTERNAL_DOCS          = NO
-CASE_SENSE_NAMES       = YES
-HIDE_SCOPE_NAMES       = NO
-HIDE_COMPOUND_REFERENCE= NO
-SHOW_INCLUDE_FILES     = YES
-SHOW_GROUPED_MEMB_INC  = NO
-FORCE_LOCAL_INCLUDES   = NO
-INLINE_INFO            = YES
-SORT_MEMBER_DOCS       = YES
-SORT_BRIEF_DOCS        = NO
-SORT_MEMBERS_CTORS_1ST = NO
-SORT_GROUP_NAMES       = NO
-SORT_BY_SCOPE_NAME     = NO
-STRICT_PROTO_MATCHING  = NO
-GENERATE_TODOLIST      = YES
-GENERATE_TESTLIST      = YES
-GENERATE_BUGLIST       = YES
-GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS       =
-MAX_INITIALIZER_LINES  = 30
-SHOW_USED_FILES        = YES
-SHOW_FILES             = YES
-SHOW_NAMESPACES        = YES
-FILE_VERSION_FILTER    =
-LAYOUT_FILE            =
-CITE_BIB_FILES         =
-#---------------------------------------------------------------------------
-# Configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-QUIET                  = NO
-WARNINGS               = YES
-WARN_IF_UNDOCUMENTED   = YES
-WARN_IF_DOC_ERROR      = YES
-WARN_NO_PARAMDOC       = NO
-WARN_FORMAT            = "$file:$line: $text"
-WARN_LOGFILE           =
-#---------------------------------------------------------------------------
-# Configuration options related to the input files
-#---------------------------------------------------------------------------
-INPUT                  = php_raphf.h
-INPUT_ENCODING         = UTF-8
-FILE_PATTERNS          =
-RECURSIVE              = NO
-EXCLUDE                =
-EXCLUDE_SYMLINKS       = NO
-EXCLUDE_PATTERNS       =
-EXCLUDE_SYMBOLS        =
-EXAMPLE_PATH           =
-EXAMPLE_PATTERNS       =
-EXAMPLE_RECURSIVE      = NO
-IMAGE_PATH             =
-INPUT_FILTER           =
-FILTER_PATTERNS        =
-FILTER_SOURCE_FILES    = NO
-FILTER_SOURCE_PATTERNS =
-USE_MDFILE_AS_MAINPAGE =
-#---------------------------------------------------------------------------
-# Configuration options related to source browsing
-#---------------------------------------------------------------------------
-SOURCE_BROWSER         = NO
-INLINE_SOURCES         = NO
-STRIP_CODE_COMMENTS    = YES
-REFERENCED_BY_RELATION = YES
-REFERENCES_RELATION    = NO
-REFERENCES_LINK_SOURCE = YES
-SOURCE_TOOLTIPS        = YES
-USE_HTAGS              = NO
-VERBATIM_HEADERS       = YES
-#---------------------------------------------------------------------------
-# Configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-ALPHABETICAL_INDEX     = YES
-COLS_IN_ALPHA_INDEX    = 5
-IGNORE_PREFIX          =
-#---------------------------------------------------------------------------
-# Configuration options related to the HTML output
-#---------------------------------------------------------------------------
-GENERATE_HTML          = YES
-HTML_OUTPUT            = .
-HTML_FILE_EXTENSION    = .html
-HTML_HEADER            =
-HTML_FOOTER            =
-HTML_STYLESHEET        =
-HTML_EXTRA_STYLESHEET  =
-HTML_EXTRA_FILES       =
-HTML_COLORSTYLE_HUE    = 220
-HTML_COLORSTYLE_SAT    = 100
-HTML_COLORSTYLE_GAMMA  = 80
-HTML_TIMESTAMP         = NO
-HTML_DYNAMIC_SECTIONS  = NO
-HTML_INDEX_NUM_ENTRIES = 100
-GENERATE_DOCSET        = NO
-DOCSET_FEEDNAME        = "Doxygen generated docs"
-DOCSET_BUNDLE_ID       = org.doxygen.Project
-DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
-DOCSET_PUBLISHER_NAME  = Publisher
-GENERATE_HTMLHELP      = NO
-CHM_FILE               =
-HHC_LOCATION           =
-GENERATE_CHI           = NO
-CHM_INDEX_ENCODING     =
-BINARY_TOC             = NO
-TOC_EXPAND             = NO
-GENERATE_QHP           = NO
-QCH_FILE               =
-QHP_NAMESPACE          = org.doxygen.Project
-QHP_VIRTUAL_FOLDER     = doc
-QHP_CUST_FILTER_NAME   =
-QHP_CUST_FILTER_ATTRS  =
-QHP_SECT_FILTER_ATTRS  =
-QHG_LOCATION           =
-GENERATE_ECLIPSEHELP   = NO
-ECLIPSE_DOC_ID         = org.doxygen.Project
-DISABLE_INDEX          = NO
-GENERATE_TREEVIEW      = YES
-ENUM_VALUES_PER_LINE   = 4
-TREEVIEW_WIDTH         = 250
-EXT_LINKS_IN_WINDOW    = NO
-FORMULA_FONTSIZE       = 10
-FORMULA_TRANSPARENT    = YES
-USE_MATHJAX            = NO
-MATHJAX_FORMAT         = HTML-CSS
-MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
-MATHJAX_EXTENSIONS     =
-MATHJAX_CODEFILE       =
-SEARCHENGINE           = YES
-SERVER_BASED_SEARCH    = NO
-EXTERNAL_SEARCH        = NO
-SEARCHENGINE_URL       =
-SEARCHDATA_FILE        = searchdata.xml
-EXTERNAL_SEARCH_ID     =
-EXTRA_SEARCH_MAPPINGS  =
-#---------------------------------------------------------------------------
-# Configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-GENERATE_LATEX         = NO
-LATEX_OUTPUT           = latex
-LATEX_CMD_NAME         = latex
-MAKEINDEX_CMD_NAME     = makeindex
-COMPACT_LATEX          = NO
-PAPER_TYPE             = a4
-EXTRA_PACKAGES         =
-LATEX_HEADER           =
-LATEX_FOOTER           =
-LATEX_EXTRA_STYLESHEET =
-LATEX_EXTRA_FILES      =
-PDF_HYPERLINKS         = YES
-USE_PDFLATEX           = YES
-LATEX_BATCHMODE        = NO
-LATEX_HIDE_INDICES     = NO
-LATEX_SOURCE_CODE      = NO
-LATEX_BIB_STYLE        = plain
-#---------------------------------------------------------------------------
-# Configuration options related to the RTF output
-#---------------------------------------------------------------------------
-GENERATE_RTF           = NO
-RTF_OUTPUT             = rtf
-COMPACT_RTF            = NO
-RTF_HYPERLINKS         = NO
-RTF_STYLESHEET_FILE    =
-RTF_EXTENSIONS_FILE    =
-RTF_SOURCE_CODE        = NO
-#---------------------------------------------------------------------------
-# Configuration options related to the man page output
-#---------------------------------------------------------------------------
-GENERATE_MAN           = NO
-MAN_OUTPUT             = man
-MAN_EXTENSION          = .3
-MAN_SUBDIR             =
-MAN_LINKS              = NO
-#---------------------------------------------------------------------------
-# Configuration options related to the XML output
-#---------------------------------------------------------------------------
-GENERATE_XML           = NO
-XML_OUTPUT             = xml
-XML_PROGRAMLISTING     = YES
-#---------------------------------------------------------------------------
-# Configuration options related to the DOCBOOK output
-#---------------------------------------------------------------------------
-GENERATE_DOCBOOK       = NO
-DOCBOOK_OUTPUT         = docbook
-DOCBOOK_PROGRAMLISTING = NO
-#---------------------------------------------------------------------------
-# Configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-GENERATE_AUTOGEN_DEF   = NO
-#---------------------------------------------------------------------------
-# Configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-GENERATE_PERLMOD       = NO
-PERLMOD_LATEX          = NO
-PERLMOD_PRETTY         = YES
-PERLMOD_MAKEVAR_PREFIX =
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-ENABLE_PREPROCESSING   = YES
-MACRO_EXPANSION        = YES
-EXPAND_ONLY_PREDEF     = NO
-SEARCH_INCLUDES        = YES
-INCLUDE_PATH           =
-INCLUDE_FILE_PATTERNS  =
-PREDEFINED             = DOXYGEN \
-                         TSRMLS_C= \
-                         TSRMLS_D= \
-                         TSRMLS_CC= \
-                         TSRMLS_DC= \
-                         PHP_RAPHF_API=
-EXPAND_AS_DEFINED      =
-SKIP_FUNCTION_MACROS   = YES
-#---------------------------------------------------------------------------
-# Configuration options related to external references
-#---------------------------------------------------------------------------
-TAGFILES               =
-GENERATE_TAGFILE       =
-ALLEXTERNALS           = NO
-EXTERNAL_GROUPS        = YES
-EXTERNAL_PAGES         = YES
-PERL_PATH              = /usr/bin/perl
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-CLASS_DIAGRAMS         = YES
-MSCGEN_PATH            =
-DIA_PATH               =
-HIDE_UNDOC_RELATIONS   = YES
-HAVE_DOT               = YES
-DOT_NUM_THREADS        = 0
-DOT_FONTNAME           = Helvetica
-DOT_FONTSIZE           = 10
-DOT_FONTPATH           =
-CLASS_GRAPH            = NO
-COLLABORATION_GRAPH    = YES
-GROUP_GRAPHS           = YES
-UML_LOOK               = NO
-UML_LIMIT_NUM_FIELDS   = 10
-TEMPLATE_RELATIONS     = NO
-INCLUDE_GRAPH          = YES
-INCLUDED_BY_GRAPH      = YES
-CALL_GRAPH             = YES
-CALLER_GRAPH           = YES
-GRAPHICAL_HIERARCHY    = YES
-DIRECTORY_GRAPH        = YES
-DOT_IMAGE_FORMAT       = png
-INTERACTIVE_SVG        = NO
-DOT_PATH               =
-DOTFILE_DIRS           =
-MSCFILE_DIRS           =
-DIAFILE_DIRS           =
-PLANTUML_JAR_PATH      =
-PLANTUML_INCLUDE_PATH  =
-DOT_GRAPH_MAX_NODES    = 50
-MAX_DOT_GRAPH_DEPTH    = 0
-DOT_TRANSPARENT        = NO
-DOT_MULTI_TARGETS      = NO
-GENERATE_LEGEND        = YES
-DOT_CLEANUP            = YES
-PHP_ARG_ENABLE(raphf, whether to enable raphf support,
-[  --enable-raphf           Enable resource and persistent handles factory support])
-
-if test "$PHP_RAPHF" != "no"; then
-       PHP_INSTALL_HEADERS(ext/raphf, php_raphf.h php_raphf_api.h)
-       PHP_NEW_EXTENSION(raphf, php_raphf.c, $ext_shared)
-fi
-\r
-\r
-ARG_ENABLE("raphf", "for raphf support", "no");\r
-\r
-if (PHP_RAPHF == "yes") {\r
-               EXTENSION("raphf", "php_raphf.c");\r
-\r
-               AC_DEFINE("HAVE_RAPHF", 1);\r
-               PHP_INSTALL_HEADERS("ext/raphf", "php_raphf.h");\r
-}\r
-/*
-    +--------------------------------------------------------------------+
-    | PECL :: raphf                                                      |
-    +--------------------------------------------------------------------+
-    | Redistribution and use in source and binary forms, with or without |
-    | modification, are permitted provided that the conditions mentioned |
-    | in the accompanying LICENSE file are met.                          |
-    +--------------------------------------------------------------------+
-    | Copyright (c) 2013, Michael Wallner <mike@php.net>                 |
-    +--------------------------------------------------------------------+
-*/
-
-#ifndef PHP_RAPHF_H
-#define PHP_RAPHF_H
-
-extern zend_module_entry raphf_module_entry;
-#define phpext_raphf_ptr &raphf_module_entry
-
-#define PHP_RAPHF_VERSION "2.0.0dev"
-
-#ifdef PHP_WIN32
-#      define PHP_RAPHF_API __declspec(dllexport)
-#elif defined(__GNUC__) && __GNUC__ >= 4
-#      define PHP_RAPHF_API extern __attribute__ ((visibility("default")))
-#else
-#      define PHP_RAPHF_API extern
-#endif
-
-#ifdef ZTS
-#      include "TSRM.h"
-#endif
-
-#include "php_raphf_api.h"
-
-#endif /* PHP_RAPHF_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-/*
-    +--------------------------------------------------------------------+
-    | PECL :: raphf                                                      |
-    +--------------------------------------------------------------------+
-    | Redistribution and use in source and binary forms, with or without |
-    | modification, are permitted provided that the conditions mentioned |
-    | in the accompanying LICENSE file are met.                          |
-    +--------------------------------------------------------------------+
-    | Copyright (c) 2013, Michael Wallner <mike@php.net>                 |
-    +--------------------------------------------------------------------+
-*/
-
-#ifndef PHP_RAPHF_API_H
-#define PHP_RAPHF_API_H
-
-#include "php_raphf.h"
-
-/**
- * A resource constructor.
- *
- * @param opaque is the \a data from php_persistent_handle_provide()
- * @param init_arg is the \a init_arg from php_resource_factory_init()
- * @return the created (persistent) handle
- */
-typedef void *(*php_resource_factory_handle_ctor_t)(void *opaque, void *init_arg);
-
-/**
- * The copy constructor of a resource.
- *
- * @param opaque the factory's data
- * @param handle the (persistent) handle to copy
- */
-typedef void *(*php_resource_factory_handle_copy_t)(void *opaque, void *handle);
-
-/**
- * The destructor of a resource.
- *
- * @param opaque the factory's data
- * @param handle the handle to destroy
- */
-typedef void (*php_resource_factory_handle_dtor_t)(void *opaque, void *handle);
-
-/**
- * The resource ops consisting of a ctor, a copy ctor and a dtor.
- *
- * Define this ops and register them with php_persistent_handle_provide()
- * in MINIT.
- */
-typedef struct php_resource_factory_ops {
-       /** The resource constructor */
-       php_resource_factory_handle_ctor_t ctor;
-       /** The resource's copy constructor */
-       php_resource_factory_handle_copy_t copy;
-       /** The resource's destructor */
-       php_resource_factory_handle_dtor_t dtor;
-} php_resource_factory_ops_t;
-
-/**
- * The resource factory.
- */
-typedef struct php_resource_factory {
-       /** The resource ops */
-       php_resource_factory_ops_t fops;
-       /** Opaque user data */
-       void *data;
-       /** User data destructor */
-       void (*dtor)(void *data);
-       /** How often this factory is referenced */
-       unsigned refcount;
-} php_resource_factory_t;
-
-/**
- * Initialize a resource factory.
- *
- * If you register a \a dtor for a resource factory used with a persistent
- * handle provider, be sure to call php_persistent_handle_cleanup() for your
- * registered provider in MSHUTDOWN, else the dtor will point to no longer
- * available memory if the extension has already been unloaded.
- *
- * @param f the factory to initialize; if NULL allocated on the heap
- * @param fops the resource ops to assign to the factory
- * @param data opaque user data; may be NULL
- * @param dtor a destructor for the data; may be NULL
- * @return \a f or an allocated resource factory
- */
-PHP_RAPHF_API php_resource_factory_t *php_resource_factory_init(
-               php_resource_factory_t *f, php_resource_factory_ops_t *fops, void *data,
-               void (*dtor)(void *data));
-
-/**
- * Increase the refcount of the resource factory.
- *
- * @param rf the resource factory
- * @return the new refcount
- */
-PHP_RAPHF_API unsigned php_resource_factory_addref(php_resource_factory_t *rf);
-
-/**
- * Destroy the resource factory.
- *
- * If the factory's refcount reaches 0, the \a dtor for \a data is called.
- *
- * @param f the resource factory
- */
-PHP_RAPHF_API void php_resource_factory_dtor(php_resource_factory_t *f);
-
-/**
- * Destroy and free the resource factory.
- *
- * Calls php_resource_factory_dtor() and frees \a f if the factory's refcount
- * reached 0.
- *
- * @param f the resource factory
- */
-PHP_RAPHF_API void php_resource_factory_free(php_resource_factory_t **f);
-
-/**
- * Construct a resource by the resource factory \a f
- *
- * @param f the resource factory
- * @param init_arg for the resource constructor
- * @return the new resource
- */
-PHP_RAPHF_API void *php_resource_factory_handle_ctor(php_resource_factory_t *f,
-               void *init_arg);
-
-/**
- * Create a copy of the resource \a handle
- *
- * @param f the resource factory
- * @param handle the resource to copy
- * @return the copy
- */
-PHP_RAPHF_API void *php_resource_factory_handle_copy(php_resource_factory_t *f,
-               void *handle);
-
-/**
- * Destroy (and free) the resource
- *
- * @param f the resource factory
- * @param handle the resource to destroy
- */
-PHP_RAPHF_API void php_resource_factory_handle_dtor(php_resource_factory_t *f,
-               void *handle);
-
-/**
- * Persistent handles storage
- */
-typedef struct php_persistent_handle_list {
-       /** Storage of free resources */
-       HashTable free;
-       /** Count of acquired resources */
-       ulong used;
-} php_persistent_handle_list_t;
-
-/**
- * Definition of a persistent handle provider.
- * Holds a resource factory an a persistent handle list.
- */
-typedef struct php_persistent_handle_provider {
-        /**
-         * The list of free handles.
-         * Hash of "ident" => array(handles) entries. Persistent handles are
-         * acquired out of this list.
-         */
-       php_persistent_handle_list_t list;
-
-       /**
-        * The resource factory.
-        * New handles are created by this factory.
-        */
-       php_resource_factory_t rf;
-} php_persistent_handle_provider_t;
-
-typedef struct php_persistent_handle_factory php_persistent_handle_factory_t;
-
-/**
- * Wakeup the persistent handle on re-acquisition.
- */
-typedef void (*php_persistent_handle_wakeup_t)(
-               php_persistent_handle_factory_t *f, void **handle);
-/**
- * Retire the persistent handle on release.
- */
-typedef void (*php_persistent_handle_retire_t)(
-               php_persistent_handle_factory_t *f, void **handle);
-
-/**
- * Definition of a persistent handle factory.
- *
- * php_persistent_handle_concede() will return a pointer to a
- * php_persistent_handle_factory if a provider for the \a name has
- * been registered with php_persistent_handle_provide().
- */
-struct php_persistent_handle_factory {
-       /** The persistent handle provider */
-       php_persistent_handle_provider_t *provider;
-       /** The persistent handle wakeup routine; may be NULL */
-       php_persistent_handle_wakeup_t wakeup;
-       /** The persistent handle retire routine; may be NULL */
-       php_persistent_handle_retire_t retire;
-
-       /** The ident for which this factory manages resources */
-       zend_string *ident;
-
-       /** Whether it has to be free'd on php_persistent_handle_abandon() */
-       unsigned free_on_abandon:1;
-};
-
-/**
- * Register a persistent handle provider in MINIT.
- *
- * Registers a factory provider for \a name_str with \a fops resource factory
- * ops. Call this in your MINIT.
- *
- * A php_resource_factory will be created with \a fops, \a data and \a dtor
- * and will be stored together with a php_persistent_handle_list in the global
- * raphf hash.
- *
- * A php_persistent_handle_factory can then be retrieved by
- * php_persistent_handle_concede() at runtime.
- *
- * @param name the provider name, e.g. "http\Client\Curl"
- * @param fops the resource factory ops
- * @param data opaque user data
- * @param dtor \a data destructor
- * @return SUCCESS/FAILURE
- */
-PHP_RAPHF_API ZEND_RESULT_CODE php_persistent_handle_provide(
-               zend_string *name, php_resource_factory_ops_t *fops,
-               void *data, void (*dtor)(void *));
-
-/**
- * Retrieve a persistent handle factory at runtime.
- *
- * If a persistent handle provider has been registered for \a name, a new
- * php_persistent_handle_factory creating resources in the \a ident
- * namespace will be constructed.
- *
- * The wakeup routine \a wakeup and the retire routine \a retire will be
- * assigned to the new php_persistent_handle_factory.
- *
- * @param a pointer to a factory; allocated on the heap if NULL
- * @param name the provider name, e.g. "http\Client\Curl"
- * @param ident the subsidiary namespace, e.g. "php.net:80"
- * @param wakeup any persistent handle wakeup routine
- * @param retire any persistent handle retire routine
- * @return \a a or an allocated persistent handle factory
- */
-PHP_RAPHF_API php_persistent_handle_factory_t *php_persistent_handle_concede(
-               php_persistent_handle_factory_t *a,
-               zend_string *name, zend_string *ident,
-               php_persistent_handle_wakeup_t wakeup,
-               php_persistent_handle_retire_t retire);
-
-/**
- * Abandon the persistent handle factory.
- *
- * Destroy a php_persistent_handle_factory created by
- * php_persistent_handle_concede(). If the memory for the factory was allocated,
- * it will automatically be free'd.
- *
- * @param a the persistent handle factory to destroy
- */
-PHP_RAPHF_API void php_persistent_handle_abandon(
-               php_persistent_handle_factory_t *a);
-
-/**
- * Acquire a persistent handle.
- *
- * That is, either re-use a resource from the free list or create a new handle.
- *
- * If a handle is acquired from the free list, the
- * php_persistent_handle_factory::wakeup callback will be executed for that
- * handle.
- *
- * @param a the persistent handle factory
- * @param init_arg the \a init_arg for php_resource_factory_handle_ctor()
- * @return the acquired resource
- */
-PHP_RAPHF_API void *php_persistent_handle_acquire(
-               php_persistent_handle_factory_t *a, void *init_arg);
-
-/**
- * Release a persistent handle.
- *
- * That is, either put it back into the free list for later re-use or clean it
- * up with php_resource_factory_handle_dtor().
- *
- * If a handle is put back into the free list, the
- * php_persistent_handle_factory::retire callback will be executed for that
- * handle.
- *
- * @param a the persistent handle factory
- * @param handle the handle to release
- */
-PHP_RAPHF_API void php_persistent_handle_release(
-               php_persistent_handle_factory_t *a, void *handle);
-
-/**
- * Copy a persistent handle.
- *
- * Let the underlying resource factory copy the \a handle.
- *
- * @param a the persistent handle factory
- * @param handle the resource to accrete
- */
-PHP_RAPHF_API void *php_persistent_handle_accrete(
-               php_persistent_handle_factory_t *a, void *handle);
-
-/**
- * Retrieve persistent handle resource factory ops.
- *
- * These ops can be used to mask a persistent handle factory as
- * resource factory itself, so you can transparently use the
- * resource factory API, both for persistent and non-persistent
- * ressources.
- *
- * Example:
- * ~~~~~~~~~~~~~~~{.c}
- * php_resource_factory_t *create_my_rf(zend_string *persistent_id)
- * {
- *     php_resource_factory_t *rf;
- *
- *     if (persistent_id) {
- *         php_persistent_handle_factory_t *pf;
- *         php_resource_factory_ops_t *ops;
- *         zend_string *ns = zend_string_init("my", 2, 1);
- *
- *         ops = php_persistent_handle_get_resource_factory_ops();
- *         pf = php_persistent_handle_concede(NULL, ns, persistent_id, NULL, NULL);
- *         rf = php_persistent_handle_resource_factory_init(NULL, pf);
- *         zend_string_release(ns);
- *     } else {
- *         rf = php_resource_factory_init(NULL, &myops, NULL, NULL);
- *     }
- *     return rf;
- * }
- * ~~~~~~~~~~~~~~~
- */
-PHP_RAPHF_API php_resource_factory_ops_t *
-php_persistent_handle_get_resource_factory_ops(void);
-
-/**
- * Create a resource factory for persistent handles.
- *
- * This will create a resource factory with persistent handle ops, which wraps
- * the provided reource factory \a pf.
- *
- * @param a the persistent handle resource factory to initialize
- * @param pf the resource factory to wrap
- */
-PHP_RAPHF_API php_resource_factory_t *
-php_persistent_handle_resource_factory_init(php_resource_factory_t *a,
-               php_persistent_handle_factory_t *pf);
-
-/**
- * Check whether a resource factory is a persistent handle resource factory.
- *
- * @param a the resource factory to check
- */
-PHP_RAPHF_API zend_bool php_resource_factory_is_persistent(
-               php_resource_factory_t *a);
-
-/**
- * Clean persistent handles up.
- *
- * Destroy persistent handles of provider \a name and in subsidiary
- * namespace \a ident.
- *
- * If \a name is NULL, all persistent handles of all providers with a
- * matching \a ident will be cleaned up.
- *
- * If \a identr is NULL all persistent handles of the provider will be
- * cleaned up.
- *
- * Ergo, if both, \a name and \a ident are NULL, then all
- * persistent handles will be cleaned up.
- *
- * You must call this in MSHUTDOWN, if your resource factory ops hold a
- * registered php_resource_factory::dtor, else the dtor will point to
- * memory not any more available if the extension has already been unloaded.
- *
- * @param name the provider name; may be NULL
- * @param ident the subsidiary namespace name; may be NULL
- */
-PHP_RAPHF_API void php_persistent_handle_cleanup(zend_string *name,
-               zend_string *ident);
-
-/**
- * Retrieve statistics about the current process/thread's persistent handles.
- *
- * @return a HashTable like:
- * ~~~~~~~~~~~~~~~
- *     [
- *         "name" => [
- *             "ident" => [
- *                 "used" => 1,
- *                 "free" => 0,
- *             ]
- *         ]
- *     ]
- * ~~~~~~~~~~~~~~~
- */
-PHP_RAPHF_API HashTable *php_persistent_handle_statall(HashTable *ht);
-
-#endif /* PHP_RAPHF_API_H */
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
-/*
-    +--------------------------------------------------------------------+
-    | PECL :: raphf                                                      |
-    +--------------------------------------------------------------------+
-    | Redistribution and use in source and binary forms, with or without |
-    | modification, are permitted provided that the conditions mentioned |
-    | in the accompanying LICENSE file are met.                          |
-    +--------------------------------------------------------------------+
-    | Copyright (c) 2013, Michael Wallner <mike@php.net>                 |
-    +--------------------------------------------------------------------+
-*/
-
-#ifdef HAVE_CONFIG_H
-#      include "config.h"
-#endif
-
-#include "php.h"
-#include "php_ini.h"
-#include "ext/standard/info.h"
-#include "php_raphf.h"
-
-#ifndef PHP_RAPHF_TEST
-#      define PHP_RAPHF_TEST 0
-#endif
-
-struct php_persistent_handle_globals {
-       ulong limit;
-       HashTable hash;
-};
-
-ZEND_BEGIN_MODULE_GLOBALS(raphf)
-       struct php_persistent_handle_globals persistent_handle;
-ZEND_END_MODULE_GLOBALS(raphf)
-
-#ifdef ZTS
-#      define PHP_RAPHF_G ((zend_raphf_globals *) \
-               (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(raphf_globals_id)])
-#else
-#      define PHP_RAPHF_G (&raphf_globals)
-#endif
-
-ZEND_DECLARE_MODULE_GLOBALS(raphf)
-
-#ifndef PHP_RAPHF_DEBUG_PHANDLES
-#      define PHP_RAPHF_DEBUG_PHANDLES 0
-#endif
-#if PHP_RAPHF_DEBUG_PHANDLES
-#      undef inline
-#      define inline
-#endif
-
-php_resource_factory_t *php_resource_factory_init(php_resource_factory_t *f,
-               php_resource_factory_ops_t *fops, void *data, void (*dtor)(void *data))
-{
-       if (!f) {
-               f = emalloc(sizeof(*f));
-       }
-       memset(f, 0, sizeof(*f));
-
-       memcpy(&f->fops, fops, sizeof(*fops));
-
-       f->data = data;
-       f->dtor = dtor;
-
-       f->refcount = 1;
-
-       return f;
-}
-
-unsigned php_resource_factory_addref(php_resource_factory_t *rf)
-{
-       return ++rf->refcount;
-}
-
-void php_resource_factory_dtor(php_resource_factory_t *f)
-{
-       if (!--f->refcount) {
-               if (f->dtor) {
-                       f->dtor(f->data);
-               }
-       }
-}
-
-void php_resource_factory_free(php_resource_factory_t **f)
-{
-       if (*f) {
-               php_resource_factory_dtor(*f);
-               if (!(*f)->refcount) {
-                       efree(*f);
-                       *f = NULL;
-               }
-       }
-}
-
-void *php_resource_factory_handle_ctor(php_resource_factory_t *f, void *init_arg)
-{
-       if (f->fops.ctor) {
-               return f->fops.ctor(f->data, init_arg);
-       }
-       return NULL;
-}
-
-void *php_resource_factory_handle_copy(php_resource_factory_t *f, void *handle)
-{
-       if (f->fops.copy) {
-               return f->fops.copy(f->data, handle);
-       }
-       return NULL;
-}
-
-void php_resource_factory_handle_dtor(php_resource_factory_t *f, void *handle)
-{
-       if (f->fops.dtor) {
-               f->fops.dtor(f->data, handle);
-       }
-}
-
-php_resource_factory_t *php_persistent_handle_resource_factory_init(
-               php_resource_factory_t *a, php_persistent_handle_factory_t *pf)
-{
-       return php_resource_factory_init(a,
-                       php_persistent_handle_get_resource_factory_ops(), pf,
-                       (void(*)(void*)) php_persistent_handle_abandon);
-}
-
-zend_bool php_resource_factory_is_persistent(php_resource_factory_t *a)
-{
-       return a->dtor == (void(*)(void *)) php_persistent_handle_abandon;
-}
-
-static inline php_persistent_handle_list_t *php_persistent_handle_list_init(
-               php_persistent_handle_list_t *list)
-{
-       if (!list) {
-               list = pemalloc(sizeof(*list), 1);
-       }
-       list->used = 0;
-       zend_hash_init(&list->free, 0, NULL, NULL, 1);
-
-       return list;
-}
-
-static int php_persistent_handle_apply_stat(zval *p, int argc, va_list argv,
-               zend_hash_key *key)
-{
-       php_persistent_handle_list_t *list = Z_PTR_P(p);
-       zval zsubentry, *zentry = va_arg(argv, zval *);
-
-       array_init(&zsubentry);
-       add_assoc_long_ex(&zsubentry, ZEND_STRL("used"), list->used);
-       add_assoc_long_ex(&zsubentry, ZEND_STRL("free"),
-                       zend_hash_num_elements(&list->free));
-       if (key->key) {
-               add_assoc_zval_ex(zentry, key->key->val, key->key->len, &zsubentry);
-       } else {
-               add_index_zval(zentry, key->h, &zsubentry);
-       }
-       return ZEND_HASH_APPLY_KEEP;
-}
-
-static int php_persistent_handle_apply_statall(zval *p, int argc, va_list argv,
-               zend_hash_key *key)
-{
-       php_persistent_handle_provider_t *provider = Z_PTR_P(p);
-       HashTable *ht = va_arg(argv, HashTable *);
-       zval zentry;
-
-       array_init(&zentry);
-
-       zend_hash_apply_with_arguments(&provider->list.free,
-                       php_persistent_handle_apply_stat, 1, &zentry);
-
-       if (key->key) {
-               zend_hash_update(ht, key->key, &zentry);
-       } else {
-               zend_hash_index_update(ht, key->h, &zentry);
-       }
-
-       return ZEND_HASH_APPLY_KEEP;
-}
-
-static int php_persistent_handle_apply_cleanup_ex(zval *p, void *arg)
-{
-       php_resource_factory_t *rf = arg;
-       void *handle = Z_PTR_P(p);
-
-#if PHP_RAPHF_DEBUG_PHANDLES
-       fprintf(stderr, "DESTROY: %p\n", handle);
-#endif
-       php_resource_factory_handle_dtor(rf, handle);
-       return ZEND_HASH_APPLY_REMOVE;
-}
-
-static int php_persistent_handle_apply_cleanup(zval *p, void *arg)
-{
-       php_resource_factory_t *rf = arg;
-       php_persistent_handle_list_t *list = Z_PTR_P(p);
-
-       zend_hash_apply_with_argument(&list->free,
-                       php_persistent_handle_apply_cleanup_ex, rf);
-       if (list->used) {
-               return ZEND_HASH_APPLY_KEEP;
-       }
-       zend_hash_destroy(&list->free);
-#if PHP_RAPHF_DEBUG_PHANDLES
-       fprintf(stderr, "LSTFREE: %p\n", list);
-#endif
-       pefree(list, 1);
-       return ZEND_HASH_APPLY_REMOVE;
-}
-
-static inline void php_persistent_handle_list_dtor(
-               php_persistent_handle_list_t *list,
-               php_persistent_handle_provider_t *provider)
-{
-#if PHP_RAPHF_DEBUG_PHANDLES
-       fprintf(stderr, "LSTDTOR: %p\n", list);
-#endif
-       zend_hash_apply_with_argument(&list->free,
-                       php_persistent_handle_apply_cleanup_ex, &provider->rf);
-       zend_hash_destroy(&list->free);
-}
-
-static inline void php_persistent_handle_list_free(
-               php_persistent_handle_list_t **list,
-               php_persistent_handle_provider_t *provider)
-{
-       php_persistent_handle_list_dtor(*list, provider);
-#if PHP_RAPHF_DEBUG_PHANDLES
-       fprintf(stderr, "LSTFREE: %p\n", *list);
-#endif
-       pefree(*list, 1);
-       *list = NULL;
-}
-
-static int php_persistent_handle_list_apply_dtor(zval *p, void *provider)
-{
-       php_persistent_handle_list_t *list = Z_PTR_P(p);
-
-       php_persistent_handle_list_free(&list, provider );
-       ZVAL_PTR(p, NULL);
-       return ZEND_HASH_APPLY_REMOVE;
-}
-
-static inline php_persistent_handle_list_t *php_persistent_handle_list_find(
-               php_persistent_handle_provider_t *provider, zend_string *ident)
-{
-       php_persistent_handle_list_t *list;
-       zval *zlist = zend_symtable_find(&provider->list.free, ident);
-
-       if (zlist && (list = Z_PTR_P(zlist))) {
-#if PHP_RAPHF_DEBUG_PHANDLES
-               fprintf(stderr, "LSTFIND: %p\n", list);
-#endif
-               return list;
-       }
-
-       if ((list = php_persistent_handle_list_init(NULL))) {
-               zval p, *rv;
-               zend_string *id;
-
-               ZVAL_PTR(&p, list);
-               id = zend_string_init(ident->val, ident->len, 1);
-               rv = zend_symtable_update(&provider->list.free, id, &p);
-               zend_string_release(id);
-
-               if (rv) {
-#if PHP_RAPHF_DEBUG_PHANDLES
-                       fprintf(stderr, "LSTFIND: %p (new)\n", list);
-#endif
-                       return list;
-               }
-               php_persistent_handle_list_free(&list, provider);
-       }
-
-       return NULL;
-}
-
-static int php_persistent_handle_apply_cleanup_all(zval *p, int argc,
-               va_list argv, zend_hash_key *key)
-{
-       php_persistent_handle_provider_t *provider = Z_PTR_P(p);
-       zend_string *ident = va_arg(argv, zend_string *);
-       php_persistent_handle_list_t *list;
-
-       if (ident && ident->len) {
-               if ((list = php_persistent_handle_list_find(provider, ident))) {
-                       zend_hash_apply_with_argument(&list->free,
-                                       php_persistent_handle_apply_cleanup_ex,
-                                       &provider->rf);
-               }
-       } else {
-               zend_hash_apply_with_argument(&provider->list.free,
-                               php_persistent_handle_apply_cleanup, &provider->rf);
-       }
-
-       return ZEND_HASH_APPLY_KEEP;
-}
-
-static void php_persistent_handle_hash_dtor(zval *p)
-{
-       php_persistent_handle_provider_t *provider = Z_PTR_P(p);
-
-       zend_hash_apply_with_argument(&provider->list.free,
-                       php_persistent_handle_list_apply_dtor, provider);
-       zend_hash_destroy(&provider->list.free);
-       php_resource_factory_dtor(&provider->rf);
-       pefree(provider, 1);
-}
-
-ZEND_RESULT_CODE php_persistent_handle_provide(zend_string *name,
-               php_resource_factory_ops_t *fops, void *data, void (*dtor)(void *))
-{
-       php_persistent_handle_provider_t *provider = pemalloc(sizeof(*provider), 1);
-
-       if (php_persistent_handle_list_init(&provider->list)) {
-               if (php_resource_factory_init(&provider->rf, fops, data, dtor)) {
-                       zval p, *rv;
-                       zend_string *ns;
-
-#if PHP_RAPHF_DEBUG_PHANDLES
-                       fprintf(stderr, "PROVIDE: %p %s\n", PHP_RAPHF_G, name_str);
-#endif
-
-                       ZVAL_PTR(&p, provider);
-                       ns = zend_string_init(name->val, name->len, 1);
-                       rv = zend_symtable_update(&PHP_RAPHF_G->persistent_handle.hash, ns, &p);
-                       zend_string_release(ns);
-
-                       if (rv) {
-                               return SUCCESS;
-                       }
-                       php_resource_factory_dtor(&provider->rf);
-               }
-       }
-
-       return FAILURE;
-}
-
-
-php_persistent_handle_factory_t *php_persistent_handle_concede(
-               php_persistent_handle_factory_t *a,
-               zend_string *name, zend_string *ident,
-               php_persistent_handle_wakeup_t wakeup,
-               php_persistent_handle_retire_t retire)
-{
-       zval *zprovider = zend_symtable_find(&PHP_RAPHF_G->persistent_handle.hash, name);
-
-       if (zprovider) {
-               zend_bool free_a = 0;
-
-               if ((free_a = !a)) {
-                       a = emalloc(sizeof(*a));
-               }
-               memset(a, 0, sizeof(*a));
-
-               a->provider = Z_PTR_P(zprovider);
-               a->ident = zend_string_copy(ident);
-               a->wakeup = wakeup;
-               a->retire = retire;
-               a->free_on_abandon = free_a;
-       } else {
-               a = NULL;
-       }
-
-#if PHP_RAPHF_DEBUG_PHANDLES
-       fprintf(stderr, "CONCEDE: %p %p (%s) (%s)\n", PHP_RAPHF_G,
-                       a ? a->provider : NULL, name->val, ident->val);
-#endif
-
-       return a;
-}
-
-void php_persistent_handle_abandon(php_persistent_handle_factory_t *a)
-{
-       zend_bool f = a->free_on_abandon;
-
-#if PHP_RAPHF_DEBUG_PHANDLES
-       fprintf(stderr, "ABANDON: %p\n", a->provider);
-#endif
-
-       zend_string_release(a->ident);
-       memset(a, 0, sizeof(*a));
-       if (f) {
-               efree(a);
-       }
-}
-
-void *php_persistent_handle_acquire(php_persistent_handle_factory_t *a, void *init_arg)
-{
-       int key;
-       zval *p;
-       zend_ulong index;
-       void *handle = NULL;
-       php_persistent_handle_list_t *list;
-
-       list = php_persistent_handle_list_find(a->provider, a->ident);
-       if (list) {
-               zend_hash_internal_pointer_end(&list->free);
-               key = zend_hash_get_current_key(&list->free, NULL, &index);
-               p = zend_hash_get_current_data(&list->free);
-               if (p && HASH_KEY_NON_EXISTENT != key) {
-                       handle = Z_PTR_P(p);
-                       if (a->wakeup) {
-                               a->wakeup(a, &handle);
-                       }
-                       zend_hash_index_del(&list->free, index);
-               } else {
-                       handle = php_resource_factory_handle_ctor(&a->provider->rf, init_arg);
-               }
-#if PHP_RAPHF_DEBUG_PHANDLES
-               fprintf(stderr, "CREATED: %p\n", handle);
-#endif
-               if (handle) {
-                       ++a->provider->list.used;
-                       ++list->used;
-               }
-       }
-
-       return handle;
-}
-
-void *php_persistent_handle_accrete(php_persistent_handle_factory_t *a, void *handle)
-{
-       void *new_handle = NULL;
-       php_persistent_handle_list_t *list;
-
-       new_handle = php_resource_factory_handle_copy(&a->provider->rf, handle);
-       if (handle) {
-               list = php_persistent_handle_list_find(a->provider, a->ident);
-               if (list) {
-                       ++list->used;
-               }
-               ++a->provider->list.used;
-       }
-
-       return new_handle;
-}
-
-void php_persistent_handle_release(php_persistent_handle_factory_t *a, void *handle)
-{
-       php_persistent_handle_list_t *list;
-
-       list = php_persistent_handle_list_find(a->provider, a->ident);
-       if (list) {
-               if (a->provider->list.used >= PHP_RAPHF_G->persistent_handle.limit) {
-#if PHP_RAPHF_DEBUG_PHANDLES
-                       fprintf(stderr, "DESTROY: %p\n", handle);
-#endif
-                       php_resource_factory_handle_dtor(&a->provider->rf, handle);
-               } else {
-                       if (a->retire) {
-                               a->retire(a, &handle);
-                       }
-                       zend_hash_next_index_insert_ptr(&list->free, handle);
-               }
-
-               --a->provider->list.used;
-               --list->used;
-       }
-}
-
-void php_persistent_handle_cleanup(zend_string *name, zend_string *ident)
-{
-       php_persistent_handle_provider_t *provider;
-       php_persistent_handle_list_t *list;
-
-       if (name) {
-               zval *zprovider = zend_symtable_find(&PHP_RAPHF_G->persistent_handle.hash,
-                               name);
-
-               if (zprovider && (provider = Z_PTR_P(zprovider))) {
-                       if (ident) {
-                               list = php_persistent_handle_list_find(provider, ident);
-                               if (list) {
-                                       zend_hash_apply_with_argument(&list->free,
-                                                       php_persistent_handle_apply_cleanup_ex,
-                                                       &provider->rf);
-                               }
-                       } else {
-                               zend_hash_apply_with_argument(&provider->list.free,
-                                               php_persistent_handle_apply_cleanup,
-                                               &provider->rf);
-                       }
-               }
-       } else {
-               zend_hash_apply_with_arguments(
-                               &PHP_RAPHF_G->persistent_handle.hash,
-                               php_persistent_handle_apply_cleanup_all, 1, ident);
-       }
-}
-
-HashTable *php_persistent_handle_statall(HashTable *ht)
-{
-       if (zend_hash_num_elements(&PHP_RAPHF_G->persistent_handle.hash)) {
-               if (!ht) {
-                       ALLOC_HASHTABLE(ht);
-                       zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
-               }
-               zend_hash_apply_with_arguments(
-                               &PHP_RAPHF_G->persistent_handle.hash,
-                               php_persistent_handle_apply_statall, 1, ht);
-       } else if (ht) {
-               ht = NULL;
-       }
-
-       return ht;
-}
-
-static php_resource_factory_ops_t php_persistent_handle_resource_factory_ops = {
-       (php_resource_factory_handle_ctor_t) php_persistent_handle_acquire,
-       (php_resource_factory_handle_copy_t) php_persistent_handle_accrete,
-       (php_resource_factory_handle_dtor_t) php_persistent_handle_release
-};
-
-php_resource_factory_ops_t *php_persistent_handle_get_resource_factory_ops(void)
-{
-       return &php_persistent_handle_resource_factory_ops;
-}
-
-ZEND_BEGIN_ARG_INFO_EX(ai_raphf_stat_persistent_handles, 0, 0, 0)
-ZEND_END_ARG_INFO();
-static PHP_FUNCTION(raphf_stat_persistent_handles)
-{
-       if (SUCCESS == zend_parse_parameters_none()) {
-               object_init(return_value);
-               if (php_persistent_handle_statall(HASH_OF(return_value))) {
-                       return;
-               }
-               zval_dtor(return_value);
-       }
-       RETURN_FALSE;
-}
-
-ZEND_BEGIN_ARG_INFO_EX(ai_raphf_clean_persistent_handles, 0, 0, 0)
-       ZEND_ARG_INFO(0, name)
-       ZEND_ARG_INFO(0, ident)
-ZEND_END_ARG_INFO();
-static PHP_FUNCTION(raphf_clean_persistent_handles)
-{
-       zend_string *name = NULL, *ident = NULL;
-
-       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|S!S!", &name, &ident)) {
-               php_persistent_handle_cleanup(name, ident);
-       }
-}
-
-#if PHP_RAPHF_TEST
-#      include "php_raphf_test.c"
-#endif
-
-static const zend_function_entry raphf_functions[] = {
-       ZEND_NS_FENTRY("raphf", stat_persistent_handles,
-                       ZEND_FN(raphf_stat_persistent_handles),
-                       ai_raphf_stat_persistent_handles, 0)
-       ZEND_NS_FENTRY("raphf", clean_persistent_handles,
-                       ZEND_FN(raphf_clean_persistent_handles),
-                       ai_raphf_clean_persistent_handles, 0)
-#if PHP_RAPHF_TEST
-       ZEND_NS_FENTRY("raphf", provide, ZEND_FN(raphf_provide), NULL, 0)
-       ZEND_NS_FENTRY("raphf", conceal, ZEND_FN(raphf_conceal), NULL, 0)
-       ZEND_NS_FENTRY("raphf", concede, ZEND_FN(raphf_concede), NULL, 0)
-       ZEND_NS_FENTRY("raphf", dispute, ZEND_FN(raphf_dispute), NULL, 0)
-       ZEND_NS_FENTRY("raphf", handle_ctor, ZEND_FN(raphf_handle_ctor), NULL, 0)
-       ZEND_NS_FENTRY("raphf", handle_copy, ZEND_FN(raphf_handle_copy), NULL, 0)
-       ZEND_NS_FENTRY("raphf", handle_dtor, ZEND_FN(raphf_handle_dtor), NULL, 0)
-#endif
-       {0}
-};
-
-PHP_INI_BEGIN()
-       STD_PHP_INI_ENTRY("raphf.persistent_handle.limit", "-1", PHP_INI_SYSTEM,
-                       OnUpdateLong, persistent_handle.limit, zend_raphf_globals,
-                       raphf_globals)
-PHP_INI_END()
-
-static HashTable *php_persistent_handles_global_hash;
-
-static PHP_GINIT_FUNCTION(raphf)
-{
-       raphf_globals->persistent_handle.limit = -1;
-
-       zend_hash_init(&raphf_globals->persistent_handle.hash, 0, NULL,
-                       php_persistent_handle_hash_dtor, 1);
-       if (php_persistent_handles_global_hash) {
-               zend_hash_copy(&raphf_globals->persistent_handle.hash,
-                               php_persistent_handles_global_hash, NULL);
-       }
-}
-
-static PHP_GSHUTDOWN_FUNCTION(raphf)
-{
-       zend_hash_destroy(&raphf_globals->persistent_handle.hash);
-}
-
-PHP_MINIT_FUNCTION(raphf)
-{
-       php_persistent_handles_global_hash = &PHP_RAPHF_G->persistent_handle.hash;
-
-#if PHP_RAPHF_TEST
-       PHP_MINIT(raphf_test)(INIT_FUNC_ARGS_PASSTHRU);
-#endif
-
-       REGISTER_INI_ENTRIES();
-       return SUCCESS;
-}
-
-PHP_MSHUTDOWN_FUNCTION(raphf)
-{
-#if PHP_RAPHF_TEST
-       PHP_MSHUTDOWN(raphf_test)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
-#endif
-
-       UNREGISTER_INI_ENTRIES();
-       php_persistent_handles_global_hash = NULL;
-       return SUCCESS;
-}
-
-static int php_persistent_handle_apply_info_ex(zval *p, int argc,
-               va_list argv, zend_hash_key *key)
-{
-       php_persistent_handle_list_t *list = Z_PTR_P(p);
-       zend_hash_key *super_key = va_arg(argv, zend_hash_key *);
-       char used[21], free[21];
-
-       slprintf(used, sizeof(used), "%u", list->used);
-       slprintf(free, sizeof(free), "%d", zend_hash_num_elements(&list->free));
-
-       php_info_print_table_row(4, super_key->key->val, key->key->val, used, free);
-
-       return ZEND_HASH_APPLY_KEEP;
-}
-
-static int php_persistent_handle_apply_info(zval *p, int argc,
-               va_list argv, zend_hash_key *key)
-{
-       php_persistent_handle_provider_t *provider = Z_PTR_P(p);
-
-       zend_hash_apply_with_arguments(&provider->list.free,
-                       php_persistent_handle_apply_info_ex, 1, key);
-
-       return ZEND_HASH_APPLY_KEEP;
-}
-
-PHP_MINFO_FUNCTION(raphf)
-{
-       php_info_print_table_start();
-       php_info_print_table_header(2,
-                       "Resource and persistent handle factory support", "enabled");
-       php_info_print_table_row(2, "Extension version", PHP_RAPHF_VERSION);
-       php_info_print_table_end();
-
-       php_info_print_table_start();
-       php_info_print_table_colspan_header(4, "Persistent handles in this "
-#ifdef ZTS
-                       "thread"
-#else
-                       "process"
-#endif
-       );
-       php_info_print_table_header(4, "Provider", "Ident", "Used", "Free");
-       zend_hash_apply_with_arguments(
-                       &PHP_RAPHF_G->persistent_handle.hash,
-                       php_persistent_handle_apply_info, 0);
-       php_info_print_table_end();
-
-       DISPLAY_INI_ENTRIES();
-}
-
-zend_module_entry raphf_module_entry = {
-       STANDARD_MODULE_HEADER,
-       "raphf",
-       raphf_functions,
-       PHP_MINIT(raphf),
-       PHP_MSHUTDOWN(raphf),
-       NULL,
-       NULL,
-       PHP_MINFO(raphf),
-       PHP_RAPHF_VERSION,
-       ZEND_MODULE_GLOBALS(raphf),
-       PHP_GINIT(raphf),
-       PHP_GSHUTDOWN(raphf),
-       NULL,
-       STANDARD_MODULE_PROPERTIES_EX
-};
-/* }}} */
-
-#ifdef COMPILE_DL_RAPHF
-ZEND_GET_MODULE(raphf)
-#endif
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * End:
- * vim600: noet sw=4 ts=4 fdm=marker
- * vim<600: noet sw=4 ts=4
- */
---TEST--
-pecl/http-v2 - general and stat
---SKIPIF--
-<?php
-if (!extension_loaded("http")) {
-       die("skip pecl/http needed");
-}
-if (!class_exists("http\\Client", false)) {
-       die("skip pecl/http-v2 with curl support needed");
-}
-?>
---FILE--
-<?php
-echo "Test\n";
-
-$h = (array) raphf\stat_persistent_handles();
-var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-
-$c = new http\Client("curl", "php.net:80");
-do {
-       $c->enqueue(new http\Client\Request("GET", "http://php.net"));
-} while (count($c) < 3);
-
-$h = (array) raphf\stat_persistent_handles();
-var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-
-unset($c);
-
-$h = (array) raphf\stat_persistent_handles();
-var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-
-?>
-Done
---EXPECTF--
-Test
-array(2) {
-  ["http\Client\Curl"]=>
-  array(0) {
-  }
-  ["http\Client\Curl\Request"]=>
-  array(0) {
-  }
-}
-array(2) {
-  ["http\Client\Curl"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(1)
-      ["free"]=>
-      int(0)
-    }
-  }
-  ["http\Client\Curl\Request"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(3)
-      ["free"]=>
-      int(0)
-    }
-  }
-}
-array(2) {
-  ["http\Client\Curl"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(0)
-      ["free"]=>
-      int(1)
-    }
-  }
-  ["http\Client\Curl\Request"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(0)
-      ["free"]=>
-      int(3)
-    }
-  }
-}
-Done
---TEST--
-pecl/http-v2 - clean with name and id
---SKIPIF--
-<?php
-if (!extension_loaded("http")) {
-       die("skip pecl/http needed");
-}
-if (!class_exists("http\\Client", false)) {
-       die("skip pecl/http-v2 with curl support needed");
-}
-?>
---FILE--
-<?php
-echo "Test\n";
-
-$c = new http\Client("curl", "php.net:80");
-do {
-       $c->enqueue(new http\Client\Request("GET", "http://php.net"));
-} while (count($c) < 3);
-
-unset($c);
-
-$h = (array) raphf\stat_persistent_handles();
-var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-
-
-raphf\clean_persistent_handles("http\\Client\\Curl");
-raphf\clean_persistent_handles("http\\Client\\Curl\\Request", "php.net:80");
-
-$h = (array) raphf\stat_persistent_handles();
-var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-
-?>
-Done
---EXPECTF--
-Test
-array(2) {
-  ["http\Client\Curl"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(0)
-      ["free"]=>
-      int(1)
-    }
-  }
-  ["http\Client\Curl\Request"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(0)
-      ["free"]=>
-      int(3)
-    }
-  }
-}
-array(2) {
-  ["http\Client\Curl"]=>
-  array(0) {
-  }
-  ["http\Client\Curl\Request"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(0)
-      ["free"]=>
-      int(0)
-    }
-  }
-}
-Done
---TEST--
-pecl/http-v2 - clean with id only
---SKIPIF--
-<?php
-if (!extension_loaded("http")) {
-       die("skip pecl/http needed");
-}
-if (!class_exists("http\\Client", false)) {
-       die("skip pecl/http-v2 with curl support needed");
-}
-?>
---FILE--
-<?php
-echo "Test\n";
-
-$c = new http\Client("curl", "php.net:80");
-do {
-       $c->enqueue(new http\Client\Request("GET", "http://php.net"));
-} while (count($c) < 3);
-
-unset($c);
-
-$h = (array) raphf\stat_persistent_handles();
-var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-
-raphf\clean_persistent_handles(null, "php.net:80");
-
-$h = (array) raphf\stat_persistent_handles();
-var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-
-?>
-Done
---EXPECTF--
-Test
-array(2) {
-  ["http\Client\Curl"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(0)
-      ["free"]=>
-      int(1)
-    }
-  }
-  ["http\Client\Curl\Request"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(0)
-      ["free"]=>
-      int(3)
-    }
-  }
-}
-array(2) {
-  ["http\Client\Curl"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(0)
-      ["free"]=>
-      int(0)
-    }
-  }
-  ["http\Client\Curl\Request"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(0)
-      ["free"]=>
-      int(0)
-    }
-  }
-}
-Done
---TEST--
-pecl/http-v2 - partial clean
---SKIPIF--
-<?php
-if (!extension_loaded("http")) {
-       die("skip pecl/http needed");
-}
-if (!class_exists("http\\Client", false)) {
-       die("skip pecl/http-v2 with curl support needed");
-}
-?>
---FILE--
-<?php
-echo "Test\n";
-
-$h = (array) raphf\stat_persistent_handles();
-var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-
-$c = new http\Client("curl", "php.net:80");
-$c2 = new http\Client("curl", "php.net:80");
-do {
-       $c->enqueue(new http\Client\Request("GET", "http://php.net"));
-       $c2->enqueue(new http\Client\Request("GET", "http://php.net"));
-} while (count($c) < 3);
-
-$h = (array) raphf\stat_persistent_handles();
-var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-
-unset($c);
-
-$h = (array) raphf\stat_persistent_handles();
-var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-
-raphf\clean_persistent_handles();
-
-$h = (array) raphf\stat_persistent_handles();
-var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
-
-?>
-Done
---EXPECTF--
-Test
-array(2) {
-  ["http\Client\Curl"]=>
-  array(0) {
-  }
-  ["http\Client\Curl\Request"]=>
-  array(0) {
-  }
-}
-array(2) {
-  ["http\Client\Curl"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(2)
-      ["free"]=>
-      int(0)
-    }
-  }
-  ["http\Client\Curl\Request"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(6)
-      ["free"]=>
-      int(0)
-    }
-  }
-}
-array(2) {
-  ["http\Client\Curl"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(1)
-      ["free"]=>
-      int(1)
-    }
-  }
-  ["http\Client\Curl\Request"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(3)
-      ["free"]=>
-      int(3)
-    }
-  }
-}
-array(2) {
-  ["http\Client\Curl"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(1)
-      ["free"]=>
-      int(0)
-    }
-  }
-  ["http\Client\Curl\Request"]=>
-  array(1) {
-    ["php.net:80"]=>
-    array(2) {
-      ["used"]=>
-      int(3)
-      ["free"]=>
-      int(0)
-    }
-  }
-}
-Done
-lm´Ý|\95\1d¹
-Èp\9e7îYn\1a8ü8\ 2\0\0\0GBMB
\ No newline at end of file
diff --git a/travis/raphf-master.ext.phar b/travis/raphf-master.ext.phar
new file mode 100755 (executable)
index 0000000..e2433d4
--- /dev/null
@@ -0,0 +1,6841 @@
+#!/usr/bin/env php
+<?php
+
+/**
+ * The installer sub-stub for extension phars
+ */
+
+namespace pharext;
+
+define("PHAREXT_PHAR", __FILE__);
+
+spl_autoload_register(function($c) {
+       return include strtr($c, "\\_", "//") . ".php";
+});
+
+
+
+namespace pharext;
+
+class Exception extends \Exception
+{
+       public function __construct($message = null, $code = 0, $previous = null) {
+               if (!isset($message)) {
+                       $last_error = error_get_last();
+                       $message = $last_error["message"];
+                       if (!$code) {
+                               $code = $last_error["type"];
+                       }
+               }
+               parent::__construct($message, $code, $previous);
+       }
+}
+
+
+
+namespace pharext;
+
+use pharext\Exception;
+
+/**
+ * A temporary file/directory name
+ */
+class Tempname
+{
+       /**
+        * @var string
+        */
+       private $name;
+
+       /**
+        * @param string $prefix uniqid() prefix
+        * @param string $suffix e.g. file extension
+        */
+       public function __construct($prefix, $suffix = null) {
+               $temp = sys_get_temp_dir() . "/pharext-" . $this->getUser();
+               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
+                       throw new Exception;
+               }
+               $this->name = $temp ."/". uniqid($prefix) . $suffix;
+       }
+
+       private function getUser() {
+               if (extension_loaded("posix") && function_exists("posix_getpwuid")) {
+                       return posix_getpwuid(posix_getuid())["name"];
+               }
+               return trim(`whoami 2>/dev/null`)
+                       ?: trim(`id -nu 2>/dev/null`)
+                       ?: getenv("USER")
+                       ?: get_current_user();
+       }
+
+       /**
+        * @return string
+        */
+       public function __toString() {
+               return (string) $this->name;
+       }
+}
+
+
+namespace pharext;
+
+/**
+ * Create a new temporary file
+ */
+class Tempfile extends \SplFileInfo
+{
+       /**
+        * @var resource
+        */
+       private $handle;
+
+       /**
+        * @param string $prefix uniqid() prefix
+        * @param string $suffix e.g. file extension
+        * @throws \pharext\Exception
+        */
+       public function __construct($prefix, $suffix = ".tmp") {
+               $tries = 0;
+               $omask = umask(077);
+               do {
+                       $path = new Tempname($prefix, $suffix);
+                       $this->handle = fopen($path, "x");
+               } while (!is_resource($this->handle) && $tries++ < 10);
+               umask($omask);
+               
+               if (!is_resource($this->handle)) {
+                       throw new Exception("Could not create temporary file");
+               }
+               
+               parent::__construct($path);
+       }
+
+       /**
+        * Unlink the file
+        */
+       public function __destruct() {
+               if (is_file($this->getPathname())) {
+                       @unlink($this->getPathname());
+               }
+       }
+
+       /**
+        * Close the stream
+        */
+       public function closeStream() {
+               fclose($this->handle);
+       }
+
+       /**
+        * Retrieve the stream resource
+        * @return resource
+        */
+       public function getStream() {
+               return $this->handle;
+       }
+}
+
+
+
+namespace pharext;
+
+/**
+ * Create a temporary directory
+ */
+class Tempdir extends \SplFileInfo
+{
+       /**
+        * @param string $prefix prefix to uniqid()
+        * @throws \pharext\Exception
+        */
+       public function __construct($prefix) {
+               $temp = new Tempname($prefix);
+               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
+                       throw new Exception("Could not create tempdir: ".error_get_last()["message"]);
+               }
+               parent::__construct($temp);
+       }
+}
+
+
+
+namespace pharext;
+
+use ArrayAccess;
+use IteratorAggregate;
+use RecursiveDirectoryIterator;
+use SplFileInfo;
+
+use pharext\Exception;
+
+class Archive implements ArrayAccess, IteratorAggregate
+{
+       const HALT_COMPILER = "\137\137\150\141\154\164\137\143\157\155\160\151\154\145\162\50\51\73";
+       const SIGNED = 0x10000;
+       const SIG_MD5    = 0x0001;
+       const SIG_SHA1   = 0x0002;
+       const SIG_SHA256 = 0x0003;
+       const SIG_SHA512 = 0x0004;
+       const SIG_OPENSSL= 0x0010;
+
+       private static $siglen = [
+               self::SIG_MD5    => 16,
+               self::SIG_SHA1   => 20,
+               self::SIG_SHA256 => 32,
+               self::SIG_SHA512 => 64,
+               self::SIG_OPENSSL=> 0
+       ];
+
+       private static $sigalg = [
+               self::SIG_MD5    => "md5",
+               self::SIG_SHA1   => "sha1",
+               self::SIG_SHA256 => "sha256",
+               self::SIG_SHA512 => "sha512",
+               self::SIG_OPENSSL=> "openssl"
+       ];
+
+       private static $sigtyp = [
+               self::SIG_MD5    => "MD5",
+               self::SIG_SHA1   => "SHA-1",
+               self::SIG_SHA256 => "SHA-256",
+               self::SIG_SHA512 => "SHA-512",
+               self::SIG_OPENSSL=> "OpenSSL",
+       ];
+
+       const PERM_FILE_MASK = 0x01ff;
+       const COMP_FILE_MASK = 0xf000;
+       const COMP_GZ_FILE   = 0x1000;
+       const COMP_BZ2_FILE  = 0x2000;
+
+       const COMP_PHAR_MASK= 0xf000;
+       const COMP_PHAR_GZ  = 0x1000;
+       const COMP_PHAR_BZ2 = 0x2000;
+
+       private $file;
+       private $fd;
+       private $stub;
+       private $manifest;
+       private $signature;
+       private $extracted;
+
+       function __construct($file = null) {
+               if (strlen($file)) {
+                       $this->open($file);
+               }
+       }
+
+       function open($file) {
+               if (!$this->fd = @fopen($file, "r")) {
+                       throw new Exception;
+               }
+               $this->file = $file;
+               $this->stub = $this->readStub();
+               $this->manifest = $this->readManifest();
+               $this->signature = $this->readSignature();
+       }
+
+       function getIterator() {
+               return new RecursiveDirectoryIterator($this->extract());
+       }
+
+       function extract() {
+               return $this->extracted ?: $this->extractTo(new Tempdir("archive"));
+       }
+
+       function extractTo($dir) {
+               if ((string) $this->extracted == (string) $dir) {
+                       return $this->extracted;
+               }
+               foreach ($this->manifest["entries"] as $file => $entry) {
+                       fseek($this->fd, $this->manifest["offset"]+$entry["offset"]);
+                       $path = "$dir/$file";
+                       $copy = stream_copy_to_stream($this->fd, $this->outFd($path, $entry["flags"]), $entry["csize"]);
+                       if ($entry["osize"] != $copy) {
+                               throw new Exception("Copied '$copy' of '$file', expected '{$entry["osize"]}' from '{$entry["csize"]}");
+                       }
+
+                       $crc = hexdec(hash_file("crc32b", $path));
+                       if ($crc !== $entry["crc32"]) {
+                               throw new Exception("CRC mismatch of '$file': '$crc' != '{$entry["crc32"]}");
+                       }
+
+                       chmod($path, $entry["flags"] & self::PERM_FILE_MASK);
+                       touch($path, $entry["stamp"]);
+               }
+               return $this->extracted = $dir;
+       }
+
+       function offsetExists($o) {
+               return isset($this->entries[$o]);
+       }
+
+       function offsetGet($o) {
+               $this->extract();
+               return new SplFileInfo($this->extracted."/$o");
+       }
+
+       function offsetSet($o, $v) {
+               throw new Exception("Archive is read-only");
+       }
+
+       function offsetUnset($o) {
+               throw new Exception("Archive is read-only");
+       }
+
+       function getSignature() {
+               /* compatible with Phar::getSignature() */
+               return [
+                       "hash_type" => self::$sigtyp[$this->signature["flags"]],
+                       "hash" => strtoupper(bin2hex($this->signature["hash"])),
+               ];
+       }
+
+       function getPath() {
+               /* compatible with Phar::getPath() */
+               return new SplFileInfo($this->file);
+       }
+
+       function getMetadata($key = null) {
+               if (isset($key)) {
+                       return $this->manifest["meta"][$key];
+               }
+               return $this->manifest["meta"];
+       }
+
+       private function outFd($path, $flags) {
+                       $dirn = dirname($path);
+                       if (!is_dir($dirn) && !@mkdir($dirn, 0777, true)) {
+                               throw new Exception;
+                       }
+                       if (!$fd = @fopen($path, "w")) {
+                               throw new Exception;
+                       }
+                       switch ($flags & self::COMP_FILE_MASK) {
+                       case self::COMP_GZ_FILE:
+                               if (!@stream_filter_append($fd, "zlib.inflate")) {
+                                       throw new Exception;
+                               }
+                               break;
+                       case self::COMP_BZ2_FILE:
+                               if (!@stream_filter_append($fd, "bz2.decompress")) {
+                                       throw new Exception;
+                               }
+                               break;
+                       }
+
+       }
+       private function readVerified($fd, $len) {
+               if ($len != strlen($data = fread($fd, $len))) {
+                       throw new Exception("Unexpected EOF");
+               }
+               return $data;
+       }
+
+       private function readFormat($format, $fd, $len) {
+               if (false === ($data = @unpack($format, $this->readVerified($fd, $len)))) {
+                       throw new Exception;
+               }
+               return $data;
+       }
+
+       private function readSingleFormat($format, $fd, $len) {
+               return current($this->readFormat($format, $fd, $len));
+       }
+
+       private function readStringBinary($fd) {
+               if (($length = $this->readSingleFormat("V", $fd, 4))) {
+                       return $this->readVerified($this->fd, $length);
+               }
+               return null;
+       }
+
+       private function readSerializedBinary($fd) {
+               if (($length = $this->readSingleFormat("V", $fd, 4))) {
+                       if (false === ($data = unserialize($this->readVerified($fd, $length)))) {
+                               throw new Exception;
+                       }
+                       return $data;
+               }
+               return null;
+       }
+
+       private function readStub() {
+               $stub = "";
+               while (!feof($this->fd)) {
+                       $line = fgets($this->fd);
+                       $stub .= $line;
+                       if (false !== stripos($line, self::HALT_COMPILER)) {
+                               /* check for '?>' on a separate line */
+                               if ('?>' === $this->readVerified($this->fd, 2)) {
+                                       $stub .= '?>' . fgets($this->fd);
+                               } else {
+                                       fseek($this->fd, -2, SEEK_CUR);
+                               }
+                               break;
+                       }
+               }
+               return $stub;
+       }
+
+       private function readManifest() {
+               $current = ftell($this->fd);
+               $header = $this->readFormat("Vlen/Vnum/napi/Vflags", $this->fd, 14);
+               $alias = $this->readStringBinary($this->fd);
+               $meta = $this->readSerializedBinary($this->fd);
+               $entries = [];
+               for ($i = 0; $i < $header["num"]; ++$i) {
+                       $this->readEntry($entries);
+               }
+               $offset = ftell($this->fd);
+               if (($length = $offset - $current - 4) != $header["len"]) {
+                       throw new Exception("Manifest length read was '$length', expected '{$header["len"]}'");
+               }
+               return $header + compact("alias", "meta", "entries", "offset");
+       }
+
+       private function readEntry(array &$entries) {
+               if (!count($entries)) {
+                       $offset = 0;
+               } else {
+                       $last = end($entries);
+                       $offset = $last["offset"] + $last["csize"];
+               }
+               $file = $this->readStringBinary($this->fd);
+               if (!strlen($file)) {
+                       throw new Exception("Empty file name encountered at offset '$offset'");
+               }
+               $header = $this->readFormat("Vosize/Vstamp/Vcsize/Vcrc32/Vflags", $this->fd, 20);
+               $meta = $this->readSerializedBinary($this->fd);
+               $entries[$file] =  $header + compact("meta", "offset");
+       }
+
+       private function readSignature() {
+               fseek($this->fd, -8, SEEK_END);
+               $sig = $this->readFormat("Vflags/Z4magic", $this->fd, 8);
+               $end = ftell($this->fd);
+
+               if ($sig["magic"] !== "GBMB") {
+                       throw new Exception("Invalid signature magic value '{$sig["magic"]}");
+               }
+
+               switch ($sig["flags"]) {
+               case self::SIG_OPENSSL:
+                       fseek($this->fd, -12, SEEK_END);
+                       if (($hash = $this->readSingleFormat("V", $this->fd, 4))) {
+                               $offset = 4 + $hash;
+                               fseek($this->fd, -$offset, SEEK_CUR);
+                               $hash = $this->readVerified($this->fd, $hash);
+                               fseek($this->fd, 0, SEEK_SET);
+                               $valid = openssl_verify($this->readVerified($this->fd, $end - $offset - 8),
+                                       $hash, @file_get_contents($this->file.".pubkey")) === 1;
+                       }
+                       break;
+
+               case self::SIG_MD5:
+               case self::SIG_SHA1:
+               case self::SIG_SHA256:
+               case self::SIG_SHA512:
+                       $offset = 8 + self::$siglen[$sig["flags"]];
+                       fseek($this->fd, -$offset, SEEK_END);
+                       $hash = $this->readVerified($this->fd, self::$siglen[$sig["flags"]]);
+                       $algo = hash_init(self::$sigalg[$sig["flags"]]);
+                       fseek($this->fd, 0, SEEK_SET);
+                       hash_update_stream($algo, $this->fd, $end - $offset);
+                       $valid = hash_final($algo, true) === $hash;
+                       break;
+
+               default:
+                       throw new Exception("Invalid signature type '{$sig["flags"]}");
+               }
+
+               return $sig + compact("hash", "valid");
+       }
+}
+
+
+namespace pharext;
+
+if (extension_loaded("Phar")) {
+       \Phar::interceptFileFuncs();
+       \Phar::mapPhar();
+       $phardir = "phar://".__FILE__;
+} else {
+       $archive = new Archive(__FILE__);
+       $phardir = $archive->extract();
+}
+
+set_include_path("$phardir:". get_include_path());
+
+$installer = new Installer();
+$installer->run($argc, $argv);
+
+__HALT_COMPILER(); ?>\r
+\85\11\0\0=\0\0\0\11\0\0\0\ 1\0\0\0\0\0)\ 6\0\0a:7:{s:7:"version";s:5:"4.1.1";s:6:"header";s:49:"pharext v4.1.1 (c) Michael Wallner <mike@php.net>";s:4:"date";s:10:"2015-09-28";s:4:"name";s:5:"raphf";s:7:"release";s:6:"master";s:7:"license";s:1345:"Copyright (c) 2013, Michael Wallner <mike@php.net>.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, 
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright 
+      notice, this list of conditions and the following disclaimer in the 
+      documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+";s:4:"type";s:9:"extension";}\13\0\0\0pharext/Archive.php\18\1e\0\0ók    V\18\1e\0\04-ÔI¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Cli/Args/Help.phpÉ\f\0\0ók    VÉ\f\0\0gX'\1f\ 1\0\0\0\0\0\0\14\0\0\0pharext/Cli/Args.php\ f\1d\0\0ók V\ f\1d\0\0?n\9dö¶\ 1\0\0\0\0\0\0\17\0\0\0pharext/Cli/Command.phpk   \0\0ók    Vk      \0\0d\84aê¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/Command.php\12\ 4\0\0ók     V\12\ 4\0\0Ôm`Ͷ\ 1\0\0\0\0\0\0\15\0\0\0pharext/Exception.phpc\ 1\0\0ók        Vc\ 1\0\0U\86Ï{¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/ExecCmd.php\1c\ e\0\0ók  V\1c\ e\0\0¹l\94ʶ\ 1\0\0\0\0\0\0\15\0\0\0pharext/Installer.php&\18\0\0ók        V&\18\0\0ød&À¶\ 1\0\0\0\0\0\0\13\0\0\0pharext/License.php\93\ 4\0\0ók  V\93\ 4\0\0î\ 4òE¶\ 1\0\0\0\0\0\0\14\0\0\0pharext/Metadata.php\95\ 1\0\0ók V\95\ 1\0\0¿Ú\90\9e\ 1\0\0\0\0\0\0\1e\0\0\0pharext/Openssl/PrivateKey.phpÁ\ 4\0\0ók       VÁ\ 4\0\0&æP\1a\ 1\0\0\0\0\0\0\14\0\0\0pharext/Packager.phpÌ!\0\0ók VÌ!\0\00\ 2\ 3\ 1\0\0\0\0\0\0\e\0\0\0pharext/SourceDir/Basic.phpz\ 5\0\0ók  Vz\ 5\0\0÷+Ôâ¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/SourceDir/Git.phpZ\ 6\0\0ók    VZ\ 6\0\0É\bÎ\¶\ 1\0\0\0\0\0\0\1a\0\0\0pharext/SourceDir/Pecl.phpø\11\0\0ók   Vø\11\0\0ã\bùж\ 1\0\0\0\0\0\0\15\0\0\0pharext/SourceDir.php½\ 2\0\0ók        V½\ 2\0\03·#\ f\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/Activate.phpÜ\v\0\0ók    VÜ\v\0\0I\93\1c\18\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Askpass.phpU\ 2\0\0ók     VU\ 2\0\0\87*\1e\90\ 1\0\0\0\0\0\0 \0\0\0pharext/Task/BundleGenerator.php}\ 2\0\0ók     V}\ 2\0\0 ï`Y¶\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Cleanup.php\1e\ 4\0\0ók     V\1e\ 4\0\0ÉI\80\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/Configure.phpT\ 4\0\0ók   VT\ 4\0\0}\17Ëì¶\ 1\0\0\0\0\0\0\18\0\0\0pharext/Task/Extract.phpp\ 3\0\0ók     Vp\ 3\0\0[¨Û̶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/GitClone.phpm\ 3\0\0ók    Vm\ 3\0\0óyµ@¶\ 1\0\0\0\0\0\0\15\0\0\0pharext/Task/Make.phpª\ 4\0\0ók        Vª\ 4\0\0\9cç6\r\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PaxFixup.php¬\ 3\0\0ók    V¬\ 3\0\0yâ¯\e\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/PeclFixup.php\9c\ 4\0\0ók   V\9c\ 4\0\0eùt\9a\ 1\0\0\0\0\0\0\1a\0\0\0pharext/Task/PharBuild.phpâ\a\0\0ók   Vâ\a\0\0ζ0ɶ\ 1\0\0\0\0\0\0\1d\0\0\0pharext/Task/PharCompress.phpc\ 4\0\0ók        Vc\ 4\0\0½\10³Ï¶\ 1\0\0\0\0\0\0\e\0\0\0pharext/Task/PharRename.phpä\ 3\0\0ók  Vä\ 3\0\0\8a[Þ˶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PharSign.php¨\ 3\0\0ók    V¨\ 3\0\0Ûº¦i¶\ 1\0\0\0\0\0\0\19\0\0\0pharext/Task/PharStub.phpæ\ 3\0\0ók    Væ\ 3\0\0Y|­\9b\ 1\0\0\0\0\0\0\17\0\0\0pharext/Task/Phpize.php\ f\ 4\0\0ók      V\ f\ 4\0\0ù\f2Ѷ\ 1\0\0\0\0\0\0\1c\0\0\0pharext/Task/StreamFetch.php\10\a\0\0ók V\10\a\0\0\88îs\¶\ 1\0\0\0\0\0\0\10\0\0\0pharext/Task.phpw\0\0\0ók     Vw\0\0\0 ÄIǶ\ 1\0\0\0\0\0\0\13\0\0\0pharext/Tempdir.phpµ\ 1\0\0ók  Vµ\ 1\0\0ë\7f\96\ 1\0\0\0\0\0\0\14\0\0\0pharext/Tempfile.php\ f\ 4\0\0ók V\ f\ 4\0\0\0®ô\1e\ 1\0\0\0\0\0\0\14\0\0\0pharext/Tempname.phpt\ 3\0\0ók Vt\ 3\0\0\9en<\8d\ 1\0\0\0\0\0\0\13\0\0\0pharext/Updater.php\8d\10\0\0ók  V\8d\10\0\0\9eÏv\16\ 1\0\0\0\0\0\0\15\0\0\0pharext_installer.phpÝ\ 2\0\0ók        VÝ\ 2\0\0\19\8cÞq¶\ 1\0\0\0\0\0\0\14\0\0\0pharext_packager.phpb\ 3\0\0ók Vb\ 3\0\0îVÓ϶\ 1\0\0\0\0\0\0\13\0\0\0pharext_updater.phph\ 3\0\0ók  Vh\ 3\0\0 Êúj¶\ 1\0\0\0\0\0\0\ e\0\0\0.gitattributes2\0\0\0ók       V2\0\0\0êXV«¶\ 1\0\0\0\0\0\0
+\0\0\0.gitignoreº\0\0\0ók    Vº\0\0\0zNè%¶\ 1\0\0\0\0\0\0\a\0\0\0CREDITS\16\0\0\0ók      V\16\0\0\0Cµ]²¶\ 1\0\0\0\0\0\0\b\0\0\0DoxyfileW,\0\0ók     VW,\0\0\ 6°¶\ 1\0\0\0\0\0\0\a\0\0\0LICENSEA\ 5\0\0ók      VA\ 5\0\0¾¬Jþ¶\ 1\0\0\0\0\0\0       \0\0\0README.mdD\ 3\0\0ók      VD\ 3\0\0\93\94\9b\ 4\ 1\0\0\0\0\0\0\ 4\0\0\0TODO\ 6\0\0\0ók V\ 6\0\0\0y_÷E¶\ 1\0\0\0\0\0\0       \0\0\0config.m4$\ 1\0\0ók      V$\ 1\0\0Åê@\9b\ 1\0\0\0\0\0\0
+\0\0\0config.w32Ð\0\0\0ók    VÐ\0\0\0ýÍ\b\8e\ 1\0\0\0\0\0\0\v\0\0\0package.xml\1a\a\0\0ók  V\1a\a\0\0L(\97\ 1\0\0\0\0\0\0\v\0\0\0php_raphf.c\81E\0\0ók  V\81E\0\0\99P\18\1d\ 1\0\0\0\0\0\0\v\0\0\0php_raphf.h\12\ 5\0\0ók  V\12\ 5\0\0\bÒ¶\ 1\0\0\0\0\0\0\ f\0\0\0php_raphf_api.h\882\0\0ók      V\882\0\0J\1a^V¶\ 1\0\0\0\0\0\0\10\0\0\0php_raphf_test.cÍ\19\0\0ók     VÍ\19\0\0·f>x¶\ 1\0\0\0\0\0\0       \0\0\0raphf.png|p\0\0ók      V|p\0\0\99³¶\ 1\0\0\0\0\0\0\12\0\0\0tests/http001.phpt\14\ 6\0\0ók   V\14\ 6\0\0\f\e\ 1\0\0\0\0\0\0\12\0\0\0tests/http002.phptL\ 5\0\0ók   VL\ 5\0\0\80ÔïS¶\ 1\0\0\0\0\0\0\12\0\0\0tests/http003.phpt^\ 5\0\0ók   V^\ 5\0\0\14\88\19\ 1\0\0\0\0\0\0\12\0\0\0tests/http004.phpt[\b\0\0ók   V[\b\0\0\1c«¶\ 1\0\0\0\0\0\0\ f\0\0\0tests/test.phpt¾
+\0\0ók   V¾
+\0\0$àíY¶\ 1\0\0\0\0\0\0<?php
+
+namespace pharext;
+
+use ArrayAccess;
+use IteratorAggregate;
+use RecursiveDirectoryIterator;
+use SplFileInfo;
+
+use pharext\Exception;
+
+class Archive implements ArrayAccess, IteratorAggregate
+{
+       const HALT_COMPILER = "\137\137\150\141\154\164\137\143\157\155\160\151\154\145\162\50\51\73";
+       const SIGNED = 0x10000;
+       const SIG_MD5    = 0x0001;
+       const SIG_SHA1   = 0x0002;
+       const SIG_SHA256 = 0x0003;
+       const SIG_SHA512 = 0x0004;
+       const SIG_OPENSSL= 0x0010;
+
+       private static $siglen = [
+               self::SIG_MD5    => 16,
+               self::SIG_SHA1   => 20,
+               self::SIG_SHA256 => 32,
+               self::SIG_SHA512 => 64,
+               self::SIG_OPENSSL=> 0
+       ];
+
+       private static $sigalg = [
+               self::SIG_MD5    => "md5",
+               self::SIG_SHA1   => "sha1",
+               self::SIG_SHA256 => "sha256",
+               self::SIG_SHA512 => "sha512",
+               self::SIG_OPENSSL=> "openssl"
+       ];
+
+       private static $sigtyp = [
+               self::SIG_MD5    => "MD5",
+               self::SIG_SHA1   => "SHA-1",
+               self::SIG_SHA256 => "SHA-256",
+               self::SIG_SHA512 => "SHA-512",
+               self::SIG_OPENSSL=> "OpenSSL",
+       ];
+
+       const PERM_FILE_MASK = 0x01ff;
+       const COMP_FILE_MASK = 0xf000;
+       const COMP_GZ_FILE   = 0x1000;
+       const COMP_BZ2_FILE  = 0x2000;
+
+       const COMP_PHAR_MASK= 0xf000;
+       const COMP_PHAR_GZ  = 0x1000;
+       const COMP_PHAR_BZ2 = 0x2000;
+
+       private $file;
+       private $fd;
+       private $stub;
+       private $manifest;
+       private $signature;
+       private $extracted;
+
+       function __construct($file = null) {
+               if (strlen($file)) {
+                       $this->open($file);
+               }
+       }
+
+       function open($file) {
+               if (!$this->fd = @fopen($file, "r")) {
+                       throw new Exception;
+               }
+               $this->file = $file;
+               $this->stub = $this->readStub();
+               $this->manifest = $this->readManifest();
+               $this->signature = $this->readSignature();
+       }
+
+       function getIterator() {
+               return new RecursiveDirectoryIterator($this->extract());
+       }
+
+       function extract() {
+               return $this->extracted ?: $this->extractTo(new Tempdir("archive"));
+       }
+
+       function extractTo($dir) {
+               if ((string) $this->extracted == (string) $dir) {
+                       return $this->extracted;
+               }
+               foreach ($this->manifest["entries"] as $file => $entry) {
+                       fseek($this->fd, $this->manifest["offset"]+$entry["offset"]);
+                       $path = "$dir/$file";
+                       $copy = stream_copy_to_stream($this->fd, $this->outFd($path, $entry["flags"]), $entry["csize"]);
+                       if ($entry["osize"] != $copy) {
+                               throw new Exception("Copied '$copy' of '$file', expected '{$entry["osize"]}' from '{$entry["csize"]}");
+                       }
+
+                       $crc = hexdec(hash_file("crc32b", $path));
+                       if ($crc !== $entry["crc32"]) {
+                               throw new Exception("CRC mismatch of '$file': '$crc' != '{$entry["crc32"]}");
+                       }
+
+                       chmod($path, $entry["flags"] & self::PERM_FILE_MASK);
+                       touch($path, $entry["stamp"]);
+               }
+               return $this->extracted = $dir;
+       }
+
+       function offsetExists($o) {
+               return isset($this->entries[$o]);
+       }
+
+       function offsetGet($o) {
+               $this->extract();
+               return new SplFileInfo($this->extracted."/$o");
+       }
+
+       function offsetSet($o, $v) {
+               throw new Exception("Archive is read-only");
+       }
+
+       function offsetUnset($o) {
+               throw new Exception("Archive is read-only");
+       }
+
+       function getSignature() {
+               /* compatible with Phar::getSignature() */
+               return [
+                       "hash_type" => self::$sigtyp[$this->signature["flags"]],
+                       "hash" => strtoupper(bin2hex($this->signature["hash"])),
+               ];
+       }
+
+       function getPath() {
+               /* compatible with Phar::getPath() */
+               return new SplFileInfo($this->file);
+       }
+
+       function getMetadata($key = null) {
+               if (isset($key)) {
+                       return $this->manifest["meta"][$key];
+               }
+               return $this->manifest["meta"];
+       }
+
+       private function outFd($path, $flags) {
+                       $dirn = dirname($path);
+                       if (!is_dir($dirn) && !@mkdir($dirn, 0777, true)) {
+                               throw new Exception;
+                       }
+                       if (!$fd = @fopen($path, "w")) {
+                               throw new Exception;
+                       }
+                       switch ($flags & self::COMP_FILE_MASK) {
+                       case self::COMP_GZ_FILE:
+                               if (!@stream_filter_append($fd, "zlib.inflate")) {
+                                       throw new Exception;
+                               }
+                               break;
+                       case self::COMP_BZ2_FILE:
+                               if (!@stream_filter_append($fd, "bz2.decompress")) {
+                                       throw new Exception;
+                               }
+                               break;
+                       }
+
+       }
+       private function readVerified($fd, $len) {
+               if ($len != strlen($data = fread($fd, $len))) {
+                       throw new Exception("Unexpected EOF");
+               }
+               return $data;
+       }
+
+       private function readFormat($format, $fd, $len) {
+               if (false === ($data = @unpack($format, $this->readVerified($fd, $len)))) {
+                       throw new Exception;
+               }
+               return $data;
+       }
+
+       private function readSingleFormat($format, $fd, $len) {
+               return current($this->readFormat($format, $fd, $len));
+       }
+
+       private function readStringBinary($fd) {
+               if (($length = $this->readSingleFormat("V", $fd, 4))) {
+                       return $this->readVerified($this->fd, $length);
+               }
+               return null;
+       }
+
+       private function readSerializedBinary($fd) {
+               if (($length = $this->readSingleFormat("V", $fd, 4))) {
+                       if (false === ($data = unserialize($this->readVerified($fd, $length)))) {
+                               throw new Exception;
+                       }
+                       return $data;
+               }
+               return null;
+       }
+
+       private function readStub() {
+               $stub = "";
+               while (!feof($this->fd)) {
+                       $line = fgets($this->fd);
+                       $stub .= $line;
+                       if (false !== stripos($line, self::HALT_COMPILER)) {
+                               /* check for '?>' on a separate line */
+                               if ('?>' === $this->readVerified($this->fd, 2)) {
+                                       $stub .= '?>' . fgets($this->fd);
+                               } else {
+                                       fseek($this->fd, -2, SEEK_CUR);
+                               }
+                               break;
+                       }
+               }
+               return $stub;
+       }
+
+       private function readManifest() {
+               $current = ftell($this->fd);
+               $header = $this->readFormat("Vlen/Vnum/napi/Vflags", $this->fd, 14);
+               $alias = $this->readStringBinary($this->fd);
+               $meta = $this->readSerializedBinary($this->fd);
+               $entries = [];
+               for ($i = 0; $i < $header["num"]; ++$i) {
+                       $this->readEntry($entries);
+               }
+               $offset = ftell($this->fd);
+               if (($length = $offset - $current - 4) != $header["len"]) {
+                       throw new Exception("Manifest length read was '$length', expected '{$header["len"]}'");
+               }
+               return $header + compact("alias", "meta", "entries", "offset");
+       }
+
+       private function readEntry(array &$entries) {
+               if (!count($entries)) {
+                       $offset = 0;
+               } else {
+                       $last = end($entries);
+                       $offset = $last["offset"] + $last["csize"];
+               }
+               $file = $this->readStringBinary($this->fd);
+               if (!strlen($file)) {
+                       throw new Exception("Empty file name encountered at offset '$offset'");
+               }
+               $header = $this->readFormat("Vosize/Vstamp/Vcsize/Vcrc32/Vflags", $this->fd, 20);
+               $meta = $this->readSerializedBinary($this->fd);
+               $entries[$file] =  $header + compact("meta", "offset");
+       }
+
+       private function readSignature() {
+               fseek($this->fd, -8, SEEK_END);
+               $sig = $this->readFormat("Vflags/Z4magic", $this->fd, 8);
+               $end = ftell($this->fd);
+
+               if ($sig["magic"] !== "GBMB") {
+                       throw new Exception("Invalid signature magic value '{$sig["magic"]}");
+               }
+
+               switch ($sig["flags"]) {
+               case self::SIG_OPENSSL:
+                       fseek($this->fd, -12, SEEK_END);
+                       if (($hash = $this->readSingleFormat("V", $this->fd, 4))) {
+                               $offset = 4 + $hash;
+                               fseek($this->fd, -$offset, SEEK_CUR);
+                               $hash = $this->readVerified($this->fd, $hash);
+                               fseek($this->fd, 0, SEEK_SET);
+                               $valid = openssl_verify($this->readVerified($this->fd, $end - $offset - 8),
+                                       $hash, @file_get_contents($this->file.".pubkey")) === 1;
+                       }
+                       break;
+
+               case self::SIG_MD5:
+               case self::SIG_SHA1:
+               case self::SIG_SHA256:
+               case self::SIG_SHA512:
+                       $offset = 8 + self::$siglen[$sig["flags"]];
+                       fseek($this->fd, -$offset, SEEK_END);
+                       $hash = $this->readVerified($this->fd, self::$siglen[$sig["flags"]]);
+                       $algo = hash_init(self::$sigalg[$sig["flags"]]);
+                       fseek($this->fd, 0, SEEK_SET);
+                       hash_update_stream($algo, $this->fd, $end - $offset);
+                       $valid = hash_final($algo, true) === $hash;
+                       break;
+
+               default:
+                       throw new Exception("Invalid signature type '{$sig["flags"]}");
+               }
+
+               return $sig + compact("hash", "valid");
+       }
+}
+<?php
+
+namespace pharext\Cli\Args;
+
+use pharext\Cli\Args;
+
+class Help
+{
+       private $args;
+
+       function __construct($prog, Args $args) {
+               $this->prog = $prog;
+               $this->args = $args;
+       }
+
+       function __toString() {
+               $usage = "Usage:\n\n  \$ ";
+               $usage .= $this->prog;
+
+               list($flags, $required, $optional, $positional) = $this->listSpec();
+               if ($flags) {
+                       $usage .= $this->dumpFlags($flags);
+               }
+               if ($required) {
+                       $usage .= $this->dumpRequired($required);
+               }
+               if ($optional) {
+                       $usage .= $this->dumpOptional($optional);
+               }
+               if ($positional) {
+                       $usage .= $this->dumpPositional($positional);
+               }
+
+               $help = $this->dumpHelp($positional);
+
+               return $usage . "\n\n" . $help . "\n";
+       }
+
+       function listSpec() {
+               $flags = [];
+               $required = [];
+               $optional = [];
+               $positional = [];
+               foreach ($this->args->getSpec() as $spec) {
+                       if (is_numeric($spec[0])) {
+                               $positional[] = $spec;
+                       } elseif ($spec[3] & Args::REQUIRED) {
+                               $required[] = $spec;
+                       } elseif ($spec[3] & (Args::OPTARG|Args::REQARG)) {
+                               $optional[] = $spec;
+                       } else {
+                               $flags[] = $spec;
+                       }
+               }
+
+               return [$flags, $required, $optional, $positional]
+                       + compact("flags", "required", "optional", "positional");
+       }
+
+       function dumpFlags(array $flags) {
+               return sprintf(" [-%s]", implode("", array_column($flags, 0)));
+       }
+
+       function dumpRequired(array $required) {
+               $dump = "";
+               foreach ($required as $req) {
+                       $dump .= sprintf(" -%s <%s>", $req[0], $req[1]);
+               }
+               return $dump;
+       }
+
+       function dumpOptional(array $optional) {
+               $req = array_filter($optional, function($a) {
+                       return $a[3] & Args::REQARG;
+               });
+               $opt = array_filter($optional, function($a) {
+                       return $a[3] & Args::OPTARG;
+               });
+
+               $dump = "";
+               if ($req) {
+                       $dump .= sprintf(" [-%s <arg>]", implode("|-", array_column($req, 0)));
+               }
+               if ($opt) {
+                       $dump .= sprintf(" [-%s [<arg>]]", implode("|-", array_column($opt, 0)));
+               }
+               return $dump;
+       }
+
+       function dumpPositional(array $positional) {
+               $dump = " [--]";
+               foreach ($positional as $pos) {
+                       if ($pos[3] & Args::REQUIRED) {
+                               $dump .= sprintf(" <%s>", $pos[1]);
+                       } else {
+                               $dump .= sprintf(" [<%s>]", $pos[1]);
+                       }
+                       if ($pos[3] & Args::MULTI) {
+                               $dump .= sprintf(" [<%s>]...", $pos[1]);
+                       }
+               }
+               return $dump;
+       }
+
+       function calcMaxLen() {
+               $spc = $this->args->getSpec();
+               $max = max(array_map("strlen", array_column($spc, 1)));
+               $max += $max % 8 + 2;
+               return $max;
+       }
+
+       function dumpHelp() {
+               $max = $this->calcMaxLen();
+               $dump = "";
+               foreach ($this->args->getSpec() as $spec) {
+                       $dump .= "    ";
+                       if (is_numeric($spec[0])) {
+                               $dump .= sprintf("--   %s ", $spec[1]);
+                       } elseif (isset($spec[0])) {
+                               $dump .= sprintf("-%s|", $spec[0]);
+                       }
+                       if (!is_numeric($spec[0])) {
+                               $dump .= sprintf("--%s ", $spec[1]);
+                       }
+                       if ($spec[3] & Args::REQARG) {
+                               $dump .= "<arg>  ";
+                       } elseif ($spec[3] & Args::OPTARG) {
+                               $dump .= "[<arg>]";
+                       } else {
+                               $dump .= "       ";
+                       }
+
+                       $dump .= str_repeat(" ", $max-strlen($spec[1])+3*!isset($spec[0]));
+                       $dump .= $spec[2];
+
+                       if ($spec[3] & Args::REQUIRED) {
+                               $dump .= " (REQUIRED)";
+                       }
+                       if ($spec[3] & Args::MULTI) {
+                               $dump .= " (MULTIPLE)";
+                       }
+                       if (isset($spec[4])) {
+                               $dump .= sprintf(" [%s]", $spec[4]);
+                       }
+                       $dump .= "\n";
+               }
+               return $dump;
+       }
+}
+<?php
+
+namespace pharext\Cli;
+
+/**
+ * Command line arguments
+ */
+class Args implements \ArrayAccess
+{
+       /**
+        * Optional option
+        */
+       const OPTIONAL = 0x000;
+
+       /**
+        * Required Option
+        */
+       const REQUIRED = 0x001;
+
+       /**
+        * Only one value, even when used multiple times
+        */
+       const SINGLE = 0x000;
+
+       /**
+        * Aggregate an array, when used multiple times
+        */
+       const MULTI = 0x010;
+
+       /**
+        * Option takes no argument
+        */
+       const NOARG = 0x000;
+
+       /**
+        * Option requires an argument
+        */
+       const REQARG = 0x100;
+
+       /**
+        * Option takes an optional argument
+        */
+       const OPTARG = 0x200;
+
+       /**
+        * Option halts processing
+        */
+       const HALT = 0x10000000;
+
+       /**
+        * Original option spec
+        * @var array
+        */
+       private $orig = [];
+
+       /**
+        * Compiled spec
+        * @var array
+        */
+       private $spec = [];
+
+       /**
+        * Parsed args
+        * @var array
+        */
+       private $args = [];
+
+       /**
+        * Compile the original spec
+        * @param array|Traversable $spec
+        */
+       public function __construct($spec = null) {
+               if (is_array($spec) || $spec instanceof Traversable) {
+                       $this->compile($spec);
+               }
+
+       }
+
+       /**
+        * Compile the original spec
+        * @param array|Traversable $spec
+        * @return pharext\Cli\Args self
+        */
+       public function compile($spec) {
+               foreach ($spec as $arg) {
+                       if (isset($arg[0]) && is_numeric($arg[0])) {
+                               $arg[3] &= ~0xf00;
+                               $this->spec["--".$arg[0]] = $arg;
+                       } elseif (isset($arg[0])) {
+                               $this->spec["-".$arg[0]] = $arg;
+                               $this->spec["--".$arg[1]] = $arg;
+                       } else {
+                               $this->spec["--".$arg[1]] = $arg;
+                       }
+                       $this->orig[] = $arg;
+               }
+               return $this;
+       }
+
+       /**
+        * Get original spec
+        * @return array
+        */
+       public function getSpec() {
+               return $this->orig;
+       }
+
+       /**
+        * Get compiled spec
+        * @return array
+        */
+       public function getCompiledSpec() {
+               return $this->spec;
+       }
+
+       /**
+        * Parse command line arguments according to the compiled spec.
+        *
+        * The Generator yields any parsing errors.
+        * Parsing will stop when all arguments are processed or the first option
+        * flagged Cli\Args::HALT was encountered.
+        *
+        * @param int $argc
+        * @param array $argv
+        * @return Generator
+        */
+       public function parse($argc, array $argv) {
+               for ($f = false, $p = 0, $i = 0; $i < $argc; ++$i) {
+                       $o = $argv[$i];
+
+                       if ($o{0} === "-" && strlen($o) > 2 && $o{1} !== "-") {
+                               // multiple short opts, e.g. -vps
+                               $argc += strlen($o) - 2;
+                               array_splice($argv, $i, 1, array_map(function($s) {
+                                       return "-$s";
+                               }, str_split(substr($o, 1))));
+                               $o = $argv[$i];
+                       } elseif ($o{0} === "-" && strlen($o) > 2 && $o{1} === "-" && 0 < ($eq = strpos($o, "="))) {
+                               // long opt with argument, e.g. --foo=bar
+                               $argc++;
+                               array_splice($argv, $i, 1, [
+                                       substr($o, 0, $eq++),
+                                       substr($o, $eq)
+                               ]);
+                               $o = $argv[$i];
+                       } elseif ($o === "--") {
+                               // only positional args following
+                               $f = true;
+                               continue;
+                       }
+
+                       if ($f || !isset($this->spec[$o])) {
+                               if ($o{0} !== "-" && isset($this->spec["--$p"])) {
+                                       $this[$p] = $o;
+                                       if (!$this->optIsMulti($p)) {
+                                               ++$p;
+                                       }
+                               } else {
+                                       yield sprintf("Unknown option %s", $o);
+                               }
+                       } elseif (!$this->optAcceptsArg($o)) {
+                               $this[$o] = true;
+                       } elseif ($i+1 < $argc && !isset($this->spec[$argv[$i+1]])) {
+                               $this[$o] = $argv[++$i];
+                       } elseif ($this->optRequiresArg($o)) {
+                               yield sprintf("Option --%s requires an argument", $this->optLongName($o));
+                       } else {
+                               // OPTARG
+                               $this[$o] = $this->optDefaultArg($o);
+                       }
+
+                       if ($this->optHalts($o)) {
+                               return;
+                       }
+               }
+       }
+
+       /**
+        * Validate that all required options were given.
+        *
+        * The Generator yields any validation errors.
+        *
+        * @return Generator
+        */
+       public function validate() {
+               $required = array_filter($this->orig, function($spec) {
+                       return $spec[3] & self::REQUIRED;
+               });
+               foreach ($required as $req) {
+                       if ($req[3] & self::MULTI) {
+                               if (is_array($this[$req[0]])) {
+                                       continue;
+                               }
+                       } elseif (strlen($this[$req[0]])) {
+                               continue;
+                       }
+                       if (is_numeric($req[0])) {
+                               yield sprintf("Argument <%s> is required", $req[1]);
+                       } else {
+                               yield sprintf("Option --%s is required", $req[1]);
+                       }
+               }
+       }
+
+
+       public function toArray() {
+               $args = [];
+               foreach ($this->spec as $spec) {
+                       $opt = $this->opt($spec[1]);
+                       $args[$opt] = $this[$opt];
+               }
+               return $args;
+       }
+
+       /**
+        * Retreive the default argument of an option
+        * @param string $o
+        * @return mixed
+        */
+       private function optDefaultArg($o) {
+               $o = $this->opt($o);
+               if (isset($this->spec[$o][4])) {
+                       return $this->spec[$o][4];
+               }
+               return null;
+       }
+
+       /**
+        * Retrieve the help message of an option
+        * @param string $o
+        * @return string
+        */
+       private function optHelp($o) {
+               $o = $this->opt($o);
+               if (isset($this->spec[$o][2])) {
+                       return $this->spec[$o][2];
+               }
+               return "";
+       }
+
+       /**
+        * Retrieve option's flags
+        * @param string $o
+        * @return int
+        */
+       private function optFlags($o) {
+               $o = $this->opt($o);
+               if (isset($this->spec[$o])) {
+                       return $this->spec[$o][3];
+               }
+               return null;
+       }
+
+       /**
+        * Check whether an option is flagged for halting argument processing
+        * @param string $o
+        * @return boolean
+        */
+       private function optHalts($o) {
+               return $this->optFlags($o) & self::HALT;
+       }
+
+       /**
+        * Check whether an option needs an argument
+        * @param string $o
+        * @return boolean
+        */
+       private function optRequiresArg($o) {
+               return $this->optFlags($o) & self::REQARG;
+       }
+
+       /**
+        * Check wether an option accepts any argument
+        * @param string $o
+        * @return boolean
+        */
+       private function optAcceptsArg($o) {
+               return $this->optFlags($o) & 0xf00;
+       }
+
+       /**
+        * Check whether an option can be used more than once
+        * @param string $o
+        * @return boolean
+        */
+       private function optIsMulti($o) {
+               return $this->optFlags($o) & self::MULTI;
+       }
+
+       /**
+        * Retreive the long name of an option
+        * @param string $o
+        * @return string
+        */
+       private function optLongName($o) {
+               $o = $this->opt($o);
+               return is_numeric($this->spec[$o][0]) ? $this->spec[$o][0] : $this->spec[$o][1];
+       }
+
+       /**
+        * Retreive the short name of an option
+        * @param string $o
+        * @return string
+        */
+       private function optShortName($o) {
+               $o = $this->opt($o);
+               return is_numeric($this->spec[$o][0]) ? null : $this->spec[$o][0];
+       }
+
+       /**
+        * Retreive the canonical name (--long-name) of an option
+        * @param string $o
+        * @return string
+        */
+       private function opt($o) {
+               if (is_numeric($o)) {
+                       return "--$o";
+               }
+               if ($o{0} !== '-') {
+                       if (strlen($o) > 1) {
+                               $o = "-$o";
+                       }
+                       $o = "-$o";
+               }
+               return $o;
+       }
+
+       /**@+
+        * Implements ArrayAccess and virtual properties
+        */
+       function offsetExists($o) {
+               $o = $this->opt($o);
+               return isset($this->args[$o]);
+       }
+       function __isset($o) {
+               return $this->offsetExists($o);
+       }
+       function offsetGet($o) {
+               $o = $this->opt($o);
+               if (isset($this->args[$o])) {
+                       return $this->args[$o];
+               }
+               return $this->optDefaultArg($o);
+       }
+       function __get($o) {
+               return $this->offsetGet($o);
+       }
+       function offsetSet($o, $v) {
+               $osn = $this->optShortName($o);
+               $oln = $this->optLongName($o);
+               if ($this->optIsMulti($o)) {
+                       if (isset($osn)) {
+                               $this->args["-$osn"][] = $v;
+                       }
+                       $this->args["--$oln"][] = $v;
+               } else {
+                       if (isset($osn)) {
+                               $this->args["-$osn"] = $v;
+                       }
+                       $this->args["--$oln"] = $v;
+               }
+       }
+       function __set($o, $v) {
+               $this->offsetSet($o, $v);
+       }
+       function offsetUnset($o) {
+               unset($this->args["-".$this->optShortName($o)]);
+               unset($this->args["--".$this->optLongName($o)]);
+       }
+       function __unset($o) {
+               $this->offsetUnset($o);
+       }
+       /**@-*/
+}
+<?php
+
+namespace pharext\Cli;
+
+use pharext\Archive;
+
+use Phar;
+
+trait Command
+{
+       /**
+        * Command line arguments
+        * @var pharext\Cli\Args
+        */
+       private $args;
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::getArgs()
+        */
+       public function getArgs() {
+               return $this->args;
+       }
+
+       /**
+        * Retrieve metadata of the currently running phar
+        * @param string $key
+        * @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;
+       }
+
+       /**
+        * Output pharext vX.Y.Z header
+        */
+       public function header() {
+               if (!headers_sent()) {
+                       /* only display header, if we didn't generate any output yet */
+                       printf("%s\n\n", $this->metadata("header"));
+               }
+       }
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::debug()
+        */
+       public function debug($fmt) {
+               if ($this->args->verbose) {
+                       vprintf($fmt, array_slice(func_get_args(), 1));
+               }
+       }
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::info()
+        */
+       public function info($fmt) {
+               if (!$this->args->quiet) {
+                       vprintf($fmt, array_slice(func_get_args(), 1));
+               }
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::warn()
+        */
+       public function warn($fmt) {
+               if (!$this->args->quiet) {
+                       if (!isset($fmt)) {
+                               $fmt = "%s\n";
+                               $arg = error_get_last()["message"];
+                       } else {
+                               $arg = array_slice(func_get_args(), 1);
+                       }
+                       vfprintf(STDERR, "Warning: $fmt", $arg);
+               }
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::error()
+        */
+       public function error($fmt) {
+               if (!isset($fmt)) {
+                       $fmt = "%s\n";
+                       $arg = error_get_last()["message"];
+               } else {
+                       $arg = array_slice(func_get_args(), 1);
+               }
+               vfprintf(STDERR, "ERROR: $fmt", $arg);
+       }
+
+       /**
+        * Output command line help message
+        * @param string $prog
+        */
+       public function help($prog) {
+               print new Args\Help($prog, $this->args);
+       }
+       
+       /**
+        * Verbosity
+        * @return boolean
+        */
+       public function verbosity() {
+               if ($this->args->verbose) {
+                       return true;
+               } elseif ($this->args->quiet) {
+                       return false;
+               } else {
+                       return null;
+               }
+       }
+}
+<?php
+
+namespace pharext;
+
+/**
+ * Command interface
+ */
+interface Command
+{
+       /**
+        * Argument error
+        */
+       const EARGS = 1;
+       /**
+        * Build error
+        */
+       const EBUILD = 2;
+       /**
+        * Signature error
+        */
+       const ESIGN = 3;
+       /**
+        * Extract/unpack error
+        */
+       const EEXTRACT = 4;
+       /**
+        * Install error
+        */
+       const EINSTALL = 5;
+       
+       /**
+        * Retrieve command line arguments
+        * @return pharext\Cli\Args
+        */
+       public function getArgs();
+       
+       /**
+        * Print debug message
+        * @param string $fmt
+        * @param string ...$args
+        */
+       public function debug($fmt);
+       
+       /**
+        * Print info
+        * @param string $fmt
+        * @param string ...$args
+        */
+       public function info($fmt);
+       
+       /**
+        * Print warning
+        * @param string $fmt
+        * @param string ...$args
+        */
+       public function warn($fmt);
+
+       /**
+        * Print error
+        * @param string $fmt
+        * @param string ...$args
+        */
+       public function error($fmt);
+
+       /**
+        * Execute the command
+        * @param int $argc command line argument count
+        * @param array $argv command line argument list
+        */
+       public function run($argc, array $argv);
+}
+<?php
+
+namespace pharext;
+
+class Exception extends \Exception
+{
+       public function __construct($message = null, $code = 0, $previous = null) {
+               if (!isset($message)) {
+                       $last_error = error_get_last();
+                       $message = $last_error["message"];
+                       if (!$code) {
+                               $code = $last_error["type"];
+                       }
+               }
+               parent::__construct($message, $code, $previous);
+       }
+}
+<?php
+
+namespace pharext;
+
+/**
+ * Execute system command
+ */
+class ExecCmd
+{
+       /**
+        * Sudo command, if the cmd needs escalated privileges
+        * @var string
+        */
+       private $sudo;
+       
+       /**
+        * Executable of the cmd
+        * @var string
+        */
+       private $command;
+       
+       /**
+        * Passthrough cmd output
+        * @var bool
+        */
+       private $verbose;
+       
+       /**
+        * Output of cmd run
+        * @var string
+        */
+       private $output;
+       
+       /**
+        * Return code of cmd run
+        * @var int
+        */
+       private $status;
+
+       /**
+        * @param string $command
+        * @param bool verbose
+        */
+       public function __construct($command, $verbose = false) {
+               $this->command = $command;
+               $this->verbose = $verbose;
+       }
+       
+       /**
+        * (Re-)set sudo command
+        * @param string $sudo
+        */
+       public function setSu($sudo = false) {
+               $this->sudo = $sudo;
+       }
+       
+       /**
+        * Execute a program with escalated privileges handling interactive password prompt
+        * @param string $command
+        * @param bool $verbose
+        * @return int exit status
+        */
+       private function suExec($command, $verbose = null) {
+               if (!($proc = proc_open($command, [STDIN,["pipe","w"],["pipe","w"]], $pipes))) {
+                       $this->status = -1;
+                       throw new Exception("Failed to run {$command}");
+               }
+               
+               $stdout = $pipes[1];
+               $passwd = 0;
+               $checks = 10;
+
+               while (!feof($stdout)) {
+                       $R = [$stdout]; $W = []; $E = [];
+                       if (!stream_select($R, $W, $E, null)) {
+                               continue;
+                       }
+                       $data = fread($stdout, 0x1000);
+                       /* only check a few times */
+                       if ($passwd < $checks) {
+                               $passwd++;
+                               if (stristr($data, "password")) {
+                                       $passwd = $checks + 1;
+                                       printf("\n%s", $data);
+                                       continue;
+                               }
+                       } elseif ($passwd > $checks) {
+                               /* new line after pw entry */
+                               printf("\n");
+                               $passwd = $checks;
+                       }
+                       
+                       if ($verbose === null) {
+                               print $this->progress($data, 0);
+                       } else {
+                               if ($verbose) {
+                                       printf("%s", $data);
+                               }
+                               $this->output .= $data;
+                       }
+               }
+               if ($verbose === null) {
+                       $this->progress("", PHP_OUTPUT_HANDLER_FINAL);
+               }
+               return $this->status = proc_close($proc);
+       }
+
+       /**
+        * Output handler that displays some progress while soaking output
+        * @param string $string
+        * @param int $flags
+        * @return string
+        */
+       private function progress($string, $flags) {
+               static $counter = 0;
+               static $symbols = ["\\","|","/","-"];
+
+               $this->output .= $string;
+               
+               if (false !== strpos($string, "\n")) {
+                       ++$counter;
+               }
+
+               return $flags & PHP_OUTPUT_HANDLER_FINAL
+                       ? "   \r"
+                       : sprintf("  %s\r", $symbols[$counter % 4]);
+       }
+
+       /**
+        * Run the command
+        * @param array $args
+        * @return \pharext\ExecCmd self
+        * @throws \pharext\Exception
+        */
+       public function run(array $args = null) {
+               $exec = escapeshellcmd($this->command);
+               if ($args) {
+                       $exec .= " ". implode(" ", array_map("escapeshellarg", (array) $args));
+               }
+               
+               if ($this->sudo) {
+                       $this->suExec(sprintf($this->sudo." 2>&1", $exec), $this->verbose);
+               } elseif ($this->verbose) {
+                       ob_start(function($s) {
+                               $this->output .= $s;
+                               return $s;
+                       }, 1);
+                       passthru($exec, $this->status);
+                       ob_end_flush();
+               } elseif ($this->verbose !== false /* !quiet */) {
+                       ob_start([$this, "progress"], 1);
+                       passthru($exec . " 2>&1", $this->status);
+                       ob_end_flush();
+               } else {
+                       exec($exec ." 2>&1", $output, $this->status);
+                       $this->output = implode("\n", $output);
+               }
+               
+               if ($this->status) {
+                       throw new Exception("Command {$exec} failed ({$this->status})");
+               }
+
+               return $this;
+       }
+       
+       /**
+        * Retrieve exit code of cmd run
+        * @return int
+        */
+       public function getStatus() {
+               return $this->status;
+       }
+       
+       /**
+        * Retrieve output of cmd run
+        * @return string
+        */
+       public function getOutput() {
+               return $this->output;
+       }
+}
+<?php
+
+namespace pharext;
+
+use Phar;
+use SplObjectStorage;
+
+/**
+ * The extension install command executed by the extension phar
+ */
+class Installer implements Command
+{
+       use Cli\Command;
+
+       /**
+        * Cleanups
+        * @var array
+        */
+       private $cleanup = [];
+
+       /**
+        * Create the command
+        */
+       public function __construct() {
+               $this->args = new Cli\Args([
+                       ["h", "help", "Display help",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       ["v", "verbose", "More output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["q", "quiet", "Less output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["p", "prefix", "PHP installation prefix if phpize is not in \$PATH, e.g. /opt/php7",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["n", "common-name", "PHP common program name, e.g. php5 or zts-php",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG,
+                               "php"],
+                       ["c", "configure", "Additional extension configure flags, e.g. -c --with-flag",
+                               Cli\Args::OPTIONAL|Cli\Args::MULTI|Cli\Args::REQARG],
+                       ["s", "sudo", "Installation might need increased privileges",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::OPTARG,
+                               "sudo -S %s"],
+                       ["i", "ini", "Activate in this php.ini instead of loaded default php.ini",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       [null, "signature", "Show package signature",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "license", "Show package license",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "name", "Show package name",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "date", "Show package release date",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "release", "Show package release version",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "version", "Show pharext version",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+               ]);
+       }
+
+       /**
+        * Perform cleaniup
+        */
+       function __destruct() {
+               foreach ($this->cleanup as $cleanup) {
+                       $cleanup->run();
+               }
+       }
+
+       private function extract($phar) {
+               $temp = (new Task\Extract($phar))->run($this->verbosity());
+               $this->cleanup[] = new Task\Cleanup($temp);
+               return $temp;
+       }
+
+       private function hooks(SplObjectStorage $phars) {
+               $hook = [];
+               foreach ($phars as $phar) {
+                       if (isset($phar["pharext_package.php"])) {
+                               $sdir = include $phar["pharext_package.php"];
+                               if ($sdir instanceof SourceDir) {
+                                       $this->args->compile($sdir->getArgs());
+                                       $hook[] = $sdir;
+                               }
+                       }
+               }
+               return $hook;
+       }
+
+       private function load() {
+               $list = new SplObjectStorage();
+               $phar = extension_loaded("Phar")
+                       ? new Phar(Phar::running(false))
+                       : new Archive(PHAREXT_PHAR);
+               $temp = $this->extract($phar);
+
+               foreach ($phar as $entry) {
+                       $dep_file = $entry->getBaseName();
+                       if (fnmatch("*.ext.phar*", $dep_file)) {
+                               $dep_phar = extension_loaded("Phar")
+                                       ? new Phar("$temp/$dep_file")
+                                       : new Archive("$temp/$dep_file");
+                               $list[$dep_phar] = $this->extract($dep_phar);
+                       }
+               }
+
+               /* the actual ext.phar at last */
+               $list[$phar] = $temp;
+               return $list;
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::run()
+        */
+       public function run($argc, array $argv) {
+               try {
+                       /* load the phar(s) */
+                       $list = $this->load();
+                       /* installer hooks */
+                       $hook = $this->hooks($list);
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EEXTRACT);
+               }
+
+               /* standard arg stuff */
+               $errs = [];
+               $prog = array_shift($argv);
+               foreach ($this->args->parse(--$argc, $argv) as $error) {
+                       $errs[] = $error;
+               }
+
+               if ($this->args["help"]) {
+                       $this->header();
+                       $this->help($prog);
+                       exit;
+               }
+               try {
+                       foreach (["signature", "name", "date", "license", "release", "version"] as $opt) {
+                               if ($this->args[$opt]) {
+                                       printf("%s\n", $this->metadata($opt));
+                                       exit;
+                               }
+                       }
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EARGS);
+               }
+
+               foreach ($this->args->validate() as $error) {
+                       $errs[] = $error;
+               }
+
+               if ($errs) {
+                       if (!$this->args["quiet"]) {
+                               $this->header();
+                       }
+                       foreach ($errs as $err) {
+                               $this->error("%s\n", $err);
+                       }
+                       if (!$this->args["quiet"]) {
+                               $this->help($prog);
+                       }
+                       exit(self::EARGS);
+               }
+
+               try {
+                       /* post process hooks */
+                       foreach ($hook as $sdir) {
+                               $sdir->setArgs($this->args);
+                       }
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EARGS);
+               }
+
+               /* install packages */
+               try {
+                       foreach ($list as $phar) {
+                               $this->info("Installing %s ...\n", basename($phar->getPath()));
+                               $this->install($list[$phar]);
+                               $this->activate($list[$phar]);
+                               $this->info("Successfully installed %s!\n", basename($phar->getPath()));
+                       }
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EINSTALL);
+               }
+       }
+
+       /**
+        * Phpize + trinity
+        */
+       private function install($temp) {
+               // phpize
+               $phpize = new Task\Phpize($temp, $this->args->prefix, $this->args->{"common-name"});
+               $phpize->run($this->verbosity());
+
+               // configure
+               $configure = new Task\Configure($temp, $this->args->configure, $this->args->prefix, $this->args->{"common-name"});
+               $configure->run($this->verbosity());
+
+               // make
+               $make = new Task\Make($temp);
+               $make->run($this->verbosity());
+
+               // install
+               $sudo = isset($this->args->sudo) ? $this->args->sudo : null;
+               $install = new Task\Make($temp, ["install"], $sudo);
+               $install->run($this->verbosity());
+       }
+
+       private function activate($temp) {
+               if ($this->args->ini) {
+                       $files = [$this->args->ini];
+               } else {
+                       $files = array_filter(array_map("trim", explode(",", php_ini_scanned_files())));
+                       $files[] = php_ini_loaded_file();
+               }
+
+               $sudo = isset($this->args->sudo) ? $this->args->sudo : null;
+               $type = $this->metadata("type") ?: "extension";
+
+               $activate = new Task\Activate($temp, $files, $type, $this->args->prefix, $this->args{"common-name"}, $sudo);
+               if (!$activate->run($this->verbosity())) {
+                       $this->info("Extension already activated ...\n");
+               }
+       }
+}
+<?php
+
+namespace pharext;
+
+trait License
+{
+       function findLicense($dir, $file = null) {
+               if (isset($file)) {
+                       return realpath("$dir/$file");
+               }
+
+               $names = [];
+               foreach (["{,UN}LICEN{S,C}{E,ING}", "COPY{,ING,RIGHT}"] as $name) {
+                       $names[] = $this->mergeLicensePattern($name, strtolower($name));
+               }
+               $exts = [];
+               foreach (["t{,e}xt", "rst", "asc{,i,ii}", "m{,ark}d{,own}", "htm{,l}"] as $ext) {
+                       $exts[] = $this->mergeLicensePattern(strtoupper($ext), $ext);
+               }
+               
+               $pattern = "{". implode(",", $names) ."}{,.{". implode(",", $exts) ."}}";
+
+               if (($glob = glob("$dir/$pattern", GLOB_BRACE))) {
+                       return current($glob);
+               }
+       }
+
+       private function mergeLicensePattern($upper, $lower) {
+               $pattern = "";
+               $length = strlen($upper);
+               for ($i = 0; $i < $length; ++$i) {
+                       if ($lower{$i} === $upper{$i}) {
+                               $pattern .= $upper{$i};
+                       } else {
+                               $pattern .= "[" . $upper{$i} . $lower{$i} . "]";
+                       }
+               }
+               return $pattern;
+       }
+
+       public function readLicense($file) {
+               $text = file_get_contents($file);
+               switch (strtolower(pathinfo($file, PATHINFO_EXTENSION))) {
+                       case "htm":
+                       case "html":
+                               $text = strip_tags($text);
+                               break;
+               }
+               return $text;
+       }
+}
+<?php
+
+namespace pharext;
+
+class Metadata
+{
+       static function version() {
+               return "4.1.1";
+       }
+
+       static function header() {
+               return sprintf("pharext v%s (c) Michael Wallner <mike@php.net>", self::version());
+       }
+
+       static function date() {
+               return gmdate("Y-m-d");
+       }
+
+       static function all() {
+               return [
+                       "version" => self::version(),
+                       "header" => self::header(),
+                       "date" => self::date(),
+               ];
+       }
+}
+<?php
+
+namespace pharext\Openssl;
+
+use pharext\Exception;
+
+class PrivateKey
+{
+       /**
+        * Private key
+        * @var string
+        */
+       private $key;
+       
+       /**
+        * Public key
+        * @var string
+        */
+       private $pub;
+
+       /**
+        * Read a private key
+        * @param string $file
+        * @param string $password
+        * @throws \pharext\Exception
+        */
+       function __construct($file, $password) {
+               /* there appears to be a bug with refcount handling of this
+                * resource; when the resource is stored as property, it cannot be
+                * "coerced to a private key" on openssl_sign() later in another method
+                */
+               $key = openssl_pkey_get_private("file://$file", $password);
+               if (!is_resource($key)) {
+                       throw new Exception("Could not load private key");
+               }
+               openssl_pkey_export($key, $this->key);
+               $this->pub = openssl_pkey_get_details($key)["key"];
+       }
+
+       /**
+        * Sign the PHAR
+        * @param \Phar $package
+        */
+       function sign(\Phar $package) {
+               $package->setSignatureAlgorithm(\Phar::OPENSSL, $this->key);
+       }
+
+       /**
+        * Export the public key to a file
+        * @param string $file
+        * @throws \pharext\Exception
+        */
+       function exportPublicKey($file) {
+               if (!file_put_contents("$file.tmp", $this->pub) || !rename("$file.tmp", $file)) {
+                       throw new Exception;
+               }
+       }
+}
+<?php
+
+namespace pharext;
+
+use Phar;
+use pharext\Exception;
+
+/**
+ * The extension packaging command executed by bin/pharext
+ */
+class Packager implements Command
+{
+       use Cli\Command;
+       
+       /**
+        * Extension source directory
+        * @var pharext\SourceDir
+        */
+       private $source;
+       
+       /**
+        * Cleanups
+        * @var array
+        */
+       private $cleanup = [];
+       
+       /**
+        * Create the command
+        */
+       public function __construct() {
+               $this->args = new Cli\Args([
+                       ["h", "help", "Display this help",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       ["v", "verbose", "More output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["q", "quiet", "Less output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["n", "name", "Extension name",
+                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["r", "release", "Extension release version",
+                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["s", "source", "Extension source directory",
+                               Cli\Args::REQUIRED|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["g", "git", "Use `git ls-tree` to determine file list",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["b", "branch", "Checkout this tag/branch",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["p", "pecl", "Use PECL package.xml to determine file list, name and release",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["d", "dest", "Destination directory",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG,
+                               "."],
+                       ["z", "gzip", "Create additional PHAR compressed with gzip",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["Z", "bzip", "Create additional PHAR compressed with bzip",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["S", "sign", "Sign the PHAR with a private key",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::REQARG],
+                       ["E", "zend", "Mark as Zend Extension",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       [null, "signature", "Show pharext signature",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "license", "Show pharext license",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "version", "Show pharext version",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+               ]);
+       }
+       
+       /**
+        * Perform cleaniup
+        */
+       function __destruct() {
+               foreach ($this->cleanup as $cleanup) {
+                       $cleanup->run();
+               }
+       }
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::run()
+        */
+       public function run($argc, array $argv) {
+               $errs = [];
+               $prog = array_shift($argv);
+               foreach ($this->args->parse(--$argc, $argv) as $error) {
+                       $errs[] = $error;
+               }
+               
+               if ($this->args["help"]) {
+                       $this->header();
+                       $this->help($prog);
+                       exit;
+               }
+               try {
+                       foreach (["signature", "license", "version"] as $opt) {
+                               if ($this->args[$opt]) {
+                                       printf("%s\n", $this->metadata($opt));
+                                       exit;
+                               }
+                       }
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EARGS);
+               }
+
+               try {
+                       /* source needs to be evaluated before Cli\Args validation, 
+                        * so e.g. name and version can be overriden and Cli\Args 
+                        * does not complain about missing arguments
+                        */
+                       $this->loadSource();
+               } catch (\Exception $e) {
+                       $errs[] = $e->getMessage();
+               }
+               
+               foreach ($this->args->validate() as $error) {
+                       $errs[] = $error;
+               }
+               
+               if ($errs) {
+                       if (!$this->args["quiet"]) {
+                               $this->header();
+                       }
+                       foreach ($errs as $err) {
+                               $this->error("%s\n", $err);
+                       }
+                       printf("\n");
+                       if (!$this->args["quiet"]) {
+                               $this->help($prog);
+                       }
+                       exit(self::EARGS);
+               }
+               
+               $this->createPackage();
+       }
+       
+       /**
+        * Download remote source
+        * @param string $source
+        * @return string local source
+        */
+       private function download($source) {
+               if ($this->args->git) {
+                       $task = new Task\GitClone($source, $this->args->branch);
+               } else {
+                       /* print newline only once */
+                       $done = false;
+                       $task = new Task\StreamFetch($source, function($bytes_pct) use(&$done) {
+                               if (!$done) {
+                                       $this->info(" %3d%% [%s>%s] \r",
+                                               floor($bytes_pct*100),
+                                               str_repeat("=", round(50*$bytes_pct)),
+                                               str_repeat(" ", round(50*(1-$bytes_pct)))
+                                       );
+                                       if ($bytes_pct == 1) {
+                                               $done = true;
+                                               $this->info("\n");
+                                       }
+                               }
+                       });
+               }
+               $local = $task->run($this->verbosity());
+
+               $this->cleanup[] = new Task\Cleanup($local);
+               return $local;
+       }
+
+       /**
+        * Extract local archive
+        * @param stirng $source
+        * @return string extracted directory
+        */
+       private function extract($source) {
+               try {
+                       $task = new Task\Extract($source);
+                       $dest = $task->run($this->verbosity());
+               } catch (\Exception $e) {
+                       if (false === strpos($e->getMessage(), "checksum mismatch")) {
+                               throw $e;
+                       }
+                       $dest = (new Task\PaxFixup($source))->run($this->verbosity());
+               }
+               
+               $this->cleanup[] = new Task\Cleanup($dest);
+               return $dest;
+       }
+
+       /**
+        * Localize a possibly remote source
+        * @param string $source
+        * @return string local source directory
+        */
+       private function localize($source) {
+               if (!stream_is_local($source) || ($this->args->git && isset($this->args->branch))) {
+                       $source = $this->download($source);
+                       $this->cleanup[] = new Task\Cleanup($source);
+               }
+               $source = realpath($source);
+               if (!is_dir($source)) {
+                       $source = $this->extract($source);
+                       $this->cleanup[] = new Task\Cleanup($source);
+                       
+                       if (!$this->args->git) {
+                               $source = (new Task\PeclFixup($source))->run($this->verbosity());
+                       }
+               }
+               return $source;
+       }
+
+       /**
+        * Load the source dir
+        * @throws \pharext\Exception
+        */
+       private function loadSource(){
+               if ($this->args["source"]) {
+                       $source = $this->localize($this->args["source"]);
+
+                       if ($this->args["pecl"]) {
+                               $this->source = new SourceDir\Pecl($source);
+                       } elseif ($this->args["git"]) {
+                               $this->source = new SourceDir\Git($source);
+                       } elseif (is_file("$source/pharext_package.php")) {
+                               $this->source = include "$source/pharext_package.php";
+                       } else {
+                               $this->source = new SourceDir\Basic($source);
+                       }
+
+                       if (!$this->source instanceof SourceDir) {
+                               throw new Exception("Unknown source dir $source");
+                       }
+
+                       foreach ($this->source->getPackageInfo() as $key => $val) {
+                               $this->args->$key = $val;
+                       }
+               }
+       }
+
+       /**
+        * Creates the extension phar
+        */
+       private function createPackage() {
+               try {
+                       $meta = array_merge(Metadata::all(), [
+                               "name" => $this->args->name,
+                               "release" => $this->args->release,
+                               "license" => $this->source->getLicense(),
+                               "type" => $this->args->zend ? "zend_extension" : "extension",
+                       ]);
+                       $file = (new Task\PharBuild($this->source, __DIR__."/../pharext_installer.php", $meta))->run($this->verbosity());
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EBUILD);
+               }
+
+               try {
+                       if ($this->args->sign) {
+                               $this->info("Using private key to sign phar ...\n");
+                               $pass = (new Task\Askpass)->run($this->verbosity());
+                               $sign = new Task\PharSign($file, $this->args->sign, $pass);
+                               $pkey = $sign->run($this->verbosity());
+                       }
+
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::ESIGN);
+               }
+
+               if ($this->args->gzip) {
+                       try {
+                               $gzip = (new Task\PharCompress($file, Phar::GZ))->run();
+                               $move = new Task\PharRename($gzip, $this->args->dest, $this->args->name ."-". $this->args->release);
+                               $name = $move->run($this->verbosity());
+
+                               $this->info("Created gzipped phar %s\n", $name);
+
+                               if ($this->args->sign) {
+                                       $sign = new Task\PharSign($name, $this->args->sign, $pass);
+                                       $sign->run($this->verbosity())->exportPublicKey($name.".pubkey");
+                               }
+
+                       } catch (\Exception $e) {
+                               $this->warn("%s\n", $e->getMessage());
+                       }
+               }
+               
+               if ($this->args->bzip) {
+                       try {
+                               $bzip = (new Task\PharCompress($file, Phar::BZ2))->run();
+                               $move = new Task\PharRename($bzip, $this->args->dest, $this->args->name ."-". $this->args->release);
+                               $name = $move->run($this->verbosity());
+
+                               $this->info("Created bzipped phar %s\n", $name);
+
+                               if ($this->args->sign) {
+                                       $sign = new Task\PharSign($name, $this->args->sign, $pass);
+                                       $sign->run($this->verbosity())->exportPublicKey($name.".pubkey");
+                               }
+
+                       } catch (\Exception $e) {
+                               $this->warn("%s\n", $e->getMessage());
+                       }
+               }
+
+               try {
+                       $move = new Task\PharRename($file, $this->args->dest, $this->args->name ."-". $this->args->release);
+                       $name = $move->run($this->verbosity());
+
+                       $this->info("Created executable phar %s\n", $name);
+
+                       if (isset($pkey)) {
+                               $pkey->exportPublicKey($name.".pubkey");
+                       }
+
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EBUILD);
+               }
+       }
+}
+<?php
+
+namespace pharext\SourceDir;
+
+use pharext\Cli\Args;
+use pharext\License;
+use pharext\SourceDir;
+
+use FilesystemIterator;
+use IteratorAggregate;
+use RecursiveCallbackFilterIterator;
+use RecursiveDirectoryIterator;
+use RecursiveIteratorIterator;
+
+
+class Basic implements IteratorAggregate, SourceDir
+{
+       use License;
+       
+       private $path;
+       
+       public function __construct($path) {
+               $this->path = $path;
+       }
+       
+       public function getBaseDir() {
+               return $this->path;
+       }
+       
+       public function getPackageInfo() {
+               return [];
+       }
+       
+       public function getLicense() {
+               if (($file = $this->findLicense($this->getBaseDir()))) {
+                       return $this->readLicense($file);
+               }
+               return "UNKNOWN";
+       }
+
+       public function getArgs() {
+               return [];
+       }
+       
+       public function setArgs(Args $args) {
+       }
+
+       public function filter($current, $key, $iterator) {
+               $sub = $current->getSubPath();
+               if ($sub === ".git" || $sub === ".hg" || $sub === ".svn") {
+                       return false;
+               }
+               return true;
+       }
+       
+       public function getIterator() {
+               $rdi = new RecursiveDirectoryIterator($this->path,
+                               FilesystemIterator::CURRENT_AS_SELF | // needed for 5.5
+                               FilesystemIterator::KEY_AS_PATHNAME |
+                               FilesystemIterator::SKIP_DOTS);
+               $rci = new RecursiveCallbackFilterIterator($rdi, [$this, "filter"]);
+               $rii = new RecursiveIteratorIterator($rci);
+               foreach ($rii as $path => $child) {
+                       if (!$child->isDir()) {
+                               yield realpath($path);
+                       }
+               }
+       }
+}
+<?php
+
+namespace pharext\SourceDir;
+
+use pharext\Cli\Args;
+use pharext\License;
+use pharext\SourceDir;
+
+/**
+ * Extension source directory which is a git repo
+ */
+class Git implements \IteratorAggregate, SourceDir
+{
+       use License;
+       
+       /**
+        * Base directory
+        * @var string
+        */
+       private $path;
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::__construct()
+        */
+       public function __construct($path) {
+               $this->path = $path;
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::getBaseDir()
+        */
+       public function getBaseDir() {
+               return $this->path;
+       }
+
+       /**
+        * @inheritdoc
+        * @return array
+        */
+       public function getPackageInfo() {
+               return [];
+       }
+
+       /**
+        * @inheritdoc
+        * @return string
+        */
+       public function getLicense() {
+               if (($file = $this->findLicense($this->getBaseDir()))) {
+                       return $this->readLicense($file);
+               }
+               return "UNKNOWN";
+       }
+
+       /**
+        * @inheritdoc
+        * @return array
+        */
+       public function getArgs() {
+               return [];
+       }
+
+       /**
+        * @inheritdoc
+        */
+       public function setArgs(Args $args) {
+       }
+
+       /**
+        * Generate a list of files by `git ls-files`
+        * @return Generator
+        */
+       private function generateFiles() {
+               $pwd = getcwd();
+               chdir($this->path);
+               if (($pipe = popen("git ls-tree -r --name-only HEAD", "r"))) {
+                       $path = realpath($this->path);
+                       while (!feof($pipe)) {
+                               if (strlen($file = trim(fgets($pipe)))) {
+                                       /* there may be symlinks, so no realpath here */
+                                       yield "$path/$file";
+                               }
+                       }
+                       pclose($pipe);
+               }
+               chdir($pwd);
+       }
+
+       /**
+        * Implements IteratorAggregate
+        * @see IteratorAggregate::getIterator()
+        */
+       public function getIterator() {
+               return $this->generateFiles();
+       }
+}
+<?php
+
+namespace pharext\SourceDir;
+
+use pharext\Cli\Args;
+use pharext\Exception;
+use pharext\SourceDir;
+use pharext\License;
+
+/**
+ * A PECL extension source directory containing a v2 package.xml
+ */
+class Pecl implements \IteratorAggregate, SourceDir
+{
+       use License;
+       
+       /**
+        * The package.xml
+        * @var SimpleXmlElement
+        */
+       private $sxe;
+       
+       /**
+        * The base directory
+        * @var string
+        */
+       private $path;
+
+       /**
+        * The package.xml
+        * @var string
+        */
+       private $file;
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::__construct()
+        */
+       public function __construct($path) {
+               if (is_file("$path/package2.xml")) {
+                       $sxe = simplexml_load_file($this->file = "$path/package2.xml");
+               } elseif (is_file("$path/package.xml")) {
+                       $sxe = simplexml_load_file($this->file = "$path/package.xml");
+               } else {
+                       throw new Exception("Missing package.xml in $path");
+               }
+               
+               $sxe->registerXPathNamespace("pecl", $sxe->getDocNamespaces()[""]);
+               
+               $this->sxe = $sxe;
+               $this->path = realpath($path);
+       }
+       
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::getBaseDir()
+        */
+       public function getBaseDir() {
+               return $this->path;
+       }
+
+       /**
+        * Retrieve gathered package info
+        * @return Generator
+        */
+       public function getPackageInfo() {
+               if (($name = $this->sxe->xpath("/pecl:package/pecl:name"))) {
+                       yield "name" => (string) $name[0];
+               }
+               if (($release = $this->sxe->xpath("/pecl:package/pecl:version/pecl:release"))) {
+                       yield "release" => (string) $release[0];
+               }
+               if ($this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease")) {
+                       yield "zend" => true;
+               }
+       }
+
+       /**
+        * @inheritdoc
+        * @return string
+        */
+       public function getLicense() {
+               if (($license = $this->sxe->xpath("/pecl:package/pecl:license"))) {
+                       if (($file = $this->findLicense($this->getBaseDir(), $license[0]["filesource"]))) {
+                               return $this->readLicense($file);
+                       }
+               }
+               if (($file = $this->findLicense($this->getBaseDir()))) {
+                       return $this->readLicense($file);
+               }
+               if ($license) {
+                       return $license[0] ." ". $license[0]["uri"];
+               }
+               return "UNKNOWN";
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::getArgs()
+        */
+       public function getArgs() {
+               $configure = $this->sxe->xpath("/pecl:package/pecl:extsrcrelease/pecl:configureoption");
+               foreach ($configure as $cfg) {
+                       yield [null, $cfg["name"], ucfirst($cfg["prompt"]), Args::OPTARG,
+                               strlen($cfg["default"]) ? $cfg["default"] : null];
+               }
+               $configure = $this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease/pecl:configureoption");
+               foreach ($configure as $cfg) {
+                       yield [null, $cfg["name"], ucfirst($cfg["prompt"]), Args::OPTARG,
+                               strlen($cfg["default"]) ? $cfg["default"] : null];
+               }
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\SourceDir::setArgs()
+        */
+       public function setArgs(Args $args) {
+               $configure = $this->sxe->xpath("/pecl:package/pecl:extsrcrelease/pecl:configureoption");
+               foreach ($configure as $cfg) {
+                       if (isset($args[$cfg["name"]])) {
+                               $args->configure = "--{$cfg["name"]}={$args[$cfg["name"]]}";
+                       }
+               }
+               $configure = $this->sxe->xpath("/pecl:package/pecl:zendextsrcrelease/pecl:configureoption");
+               foreach ($configure as $cfg) {
+                       if (isset($args[$cfg["name"]])) {
+                               $args->configure = "--{$cfg["name"]}={$args[$cfg["name"]]}";
+                       }
+               }
+       }
+       
+       /**
+        * Compute the path of a file by parent dir nodes
+        * @param \SimpleXMLElement $ele
+        * @return string
+        */
+       private function dirOf($ele) {
+               $path = "";
+               while (($ele = current($ele->xpath(".."))) && $ele->getName() == "dir") {
+                       $path = trim($ele["name"], "/") ."/". $path ;
+               }
+               return trim($path, "/");
+       }
+
+       /**
+        * Generate a list of files from the package.xml
+        * @return Generator
+        */
+       private function generateFiles() {
+               /* hook  */
+               $temp = tmpfile();
+               fprintf($temp, "<?php\nreturn new %s(__DIR__);\n", get_class($this));
+               rewind($temp);
+               yield "pharext_package.php" => $temp;
+
+               /* deps */
+               $dependencies = $this->sxe->xpath("/pecl:package/pecl:dependencies/pecl:required/pecl:package");
+               foreach ($dependencies as $key => $dep) {
+                       if (($glob = glob("{$this->path}/{$dep->name}-*.ext.phar*"))) {
+                               usort($glob, function($a, $b) {
+                                       return version_compare(
+                                               substr($a, strpos(".ext.phar", $a)),
+                                               substr($b, strpos(".ext.phar", $b))
+                                       );
+                               });
+                               yield end($glob);
+                       }
+               }
+
+               /* files */
+               yield realpath($this->file);
+               foreach ($this->sxe->xpath("//pecl:file") as $file) {
+                       yield realpath($this->path ."/". $this->dirOf($file) ."/". $file["name"]);
+               }
+       }
+       
+       /**
+        * Implements IteratorAggregate
+        * @see IteratorAggregate::getIterator()
+        */
+       public function getIterator() {
+               return $this->generateFiles();
+       }
+}
+<?php
+
+namespace pharext;
+
+/**
+ * Source directory interface, which should yield file names to package on traversal
+ */
+interface SourceDir extends \Traversable
+{
+       /**
+        * Retrieve the base directory
+        * @return string
+        */
+       public function getBaseDir();
+
+       /**
+        * Retrieve gathered package info
+        * @return array|Traversable
+        */
+       public function getPackageInfo();
+
+       /**
+        * Retrieve the full text license
+        * @return string
+        */
+       public function getLicense();
+
+       /**
+        * Provide installer command line args
+        * @return array|Traversable
+        */
+       public function getArgs();
+
+       /**
+        * Process installer command line args
+        * @param \pharext\Cli\Args $args
+        */
+       public function setArgs(Cli\Args $args);
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\ExecCmd;
+use pharext\Task;
+use pharext\Tempfile;
+
+/**
+ * PHP INI activation
+ */
+class Activate implements Task
+{
+       /**
+        * @var string
+        */
+       private $cwd;
+
+       /**
+        * @var array
+        */
+       private $inis;
+
+       /**
+        * @var string
+        */
+       private $type;
+
+       /**
+        * @var string
+        */
+       private $php_config;
+       
+       /**
+        * @var string
+        */
+       private $sudo;
+
+       /**
+        * @param string $cwd working directory
+        * @param array $inis custom INI or list of loaded/scanned INI files
+        * @param string $type extension or zend_extension
+        * @param string $prefix install prefix, e.g. /usr/local
+        * @param string $common_name PHP programs common name, e.g. php5
+        * @param string $sudo sudo command
+        * @throws \pharext\Exception
+        */
+       public function __construct($cwd, array $inis, $type = "extension", $prefix = null, $common_name = "php", $sudo = null) {
+               $this->cwd = $cwd;
+               $this->type = $type;
+               $this->sudo = $sudo;
+               if (!$this->inis = $inis) {
+                       throw new Exception("No PHP INIs given");
+               }
+               $cmd = $common_name . "-config";
+               if (isset($prefix)) {
+                       $cmd = $prefix . "/bin/" . $cmd;
+               }
+               $this->php_config = $cmd;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return boolean false, if extension was already activated
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Running INI activation ...\n");
+               }
+               $extension = basename(current(glob("{$this->cwd}/modules/*.so")));
+
+               if ($this->type === "zend_extension") {
+                       $pattern = preg_quote((new ExecCmd($this->php_config))->run(["--extension-dir"])->getOutput() . "/$extension", "/");
+               } else {
+                       $pattern = preg_quote($extension, "/");
+               }
+
+               foreach ($this->inis as $file) {
+                       if ($verbose) {
+                               printf("Checking %s ...\n", $file);
+                       }
+                       if (!file_exists($file)) {
+                               throw new Exception(sprintf("INI file '%s' does not exist", $file));
+                       }
+                       $temp = new Tempfile("phpini");
+                       foreach (file($file) as $line) {
+                               if (preg_match("/^\s*{$this->type}\s*=\s*[\"']?{$pattern}[\"']?\s*(;.*)?\$/", $line)) {
+                                       return false;
+                               }
+                               fwrite($temp->getStream(), $line);
+                       }
+               }
+
+               /* not found; append to last processed file, which is the main by default */
+               if ($verbose) {
+                       printf("Activating in %s ...\n", $file);
+               }
+               fprintf($temp->getStream(), $this->type . "=%s\n", $extension);
+               $temp->closeStream();
+
+               $path = $temp->getPathname();
+               $stat = stat($file);
+
+               // owner transfer
+               $ugid = sprintf("%d:%d", $stat["uid"], $stat["gid"]);
+               $cmd = new ExecCmd("chown", $verbose);
+               if (isset($this->sudo)) {
+                       $cmd->setSu($this->sudo);
+               }
+               $cmd->run([$ugid, $path]);
+
+               // permission transfer
+               $perm = decoct($stat["mode"] & 0777);
+               $cmd = new ExecCmd("chmod", $verbose);
+               if (isset($this->sudo)) {
+                       $cmd->setSu($this->sudo);
+               }
+               $cmd->run([$perm, $path]);
+
+               // rename
+               $cmd = new ExecCmd("mv", $verbose);
+               if (isset($this->sudo)) {
+                       $cmd->setSu($this->sudo);
+               }
+               $cmd->run([$path, $file]);
+               
+               if ($verbose) {
+                       printf("Replaced %s ...\n", $file);
+               }
+
+               return true;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Task;
+
+/**
+ * Ask password on console
+ */
+class Askpass implements Task
+{
+       /**
+        * @var string
+        */
+       private $prompt;
+
+       /**
+        * @param string $prompt
+        */
+       public function __construct($prompt = "Password:") {
+               $this->prompt = $prompt;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return string
+        */
+       public function run($verbose = false) {
+               system("stty -echo");
+               printf("%s ", $this->prompt);
+               $pass = fgets(STDIN, 1024);
+               printf("\n");
+               system("stty echo");
+               if (substr($pass, -1) == "\n") {
+                       $pass = substr($pass, 0, -1);
+               }
+               return $pass;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Task;
+
+use RecursiveDirectoryIterator;
+use RecursiveIteratorIterator;
+
+/**
+ * List all library files of pharext to bundle with a phar
+ */
+class BundleGenerator implements Task
+{
+       /**
+        * @param bool $verbose
+        * @return Generator
+        */
+       public function run($verbose = false) {
+               if ($verbose) {
+                       printf("Packaging pharext ... \n");
+               }
+               $rdi = new RecursiveDirectoryIterator(dirname(dirname(__DIR__)));
+               $rii = new RecursiveIteratorIterator($rdi);
+               for ($rii->rewind(); $rii->valid(); $rii->next()) {
+                       if (!$rii->isDot()) {
+                               yield $rii->getSubPathname() => $rii->key();
+                       }
+               }
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Task;
+
+use FilesystemIterator;
+use RecursiveDirectoryIterator;
+use RecursiveIteratorIterator;
+
+/**
+ * Recursively cleanup FS entries
+ */
+class Cleanup implements Task
+{
+       /**
+        * @var string
+        */
+       private $rm;
+
+       public function __construct($rm) {
+               $this->rm = $rm;
+       }
+
+       /**
+        * @param bool $verbose
+        */
+       public function run($verbose = false) {
+               if ($verbose) {
+                       printf("Cleaning up %s ...\n", $this->rm);
+               }
+               if ($this->rm instanceof Tempfile) {
+                       unset($this->rm);
+               } elseif (is_dir($this->rm)) {
+                       $rdi = new RecursiveDirectoryIterator($this->rm,
+                               FilesystemIterator::CURRENT_AS_SELF | // needed for 5.5
+                               FilesystemIterator::KEY_AS_PATHNAME |
+                               FilesystemIterator::SKIP_DOTS);
+                       $rii = new RecursiveIteratorIterator($rdi,
+                               RecursiveIteratorIterator::CHILD_FIRST);
+                       foreach ($rii as $path => $child) {
+                               if ($child->isDir()) {
+                                       @rmdir($path);
+                               } else {
+                                       @unlink($path);
+                               }
+                       }
+                       @rmdir($this->rm);
+               } elseif (file_exists($this->rm)) {
+                       @unlink($this->rm);
+               }
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\ExecCmd;
+use pharext\Task;
+
+/**
+ * Runs extension's configure
+ */
+class Configure implements Task
+{
+       /**
+        * @var array
+        */
+       private $args;
+
+       /**
+        * @var string
+        */
+       private $cwd;
+
+       /**
+        * @param string $cwd working directory
+        * @param array $args configure args
+        * @param string $prefix install prefix, e.g. /usr/local
+        * @param string $common_name PHP programs common name, e.g. php5
+        */
+       public function __construct($cwd, array $args = null, $prefix = null, $common_name = "php") {
+               $this->cwd = $cwd;
+               $cmd = $common_name . "-config";
+               if (isset($prefix)) {
+                       $cmd = $prefix . "/bin/" . $cmd;
+               }
+               $this->args =  ["--with-php-config=$cmd"];
+               if ($args) {
+                       $this->args = array_merge($this->args, $args);
+               }
+       }
+
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Running ./configure ...\n");
+               }
+               $pwd = getcwd();
+               if (!chdir($this->cwd)) {
+                       throw new Exception;
+               }
+               try {
+                       $cmd = new ExecCmd("./configure", $verbose);
+                       $cmd->run($this->args);
+               } finally {
+                       chdir($pwd);
+               }
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Archive;
+use pharext\Task;
+use pharext\Tempdir;
+
+use Phar;
+use PharData;
+
+/**
+ * Extract a package archive
+ */
+class Extract implements Task
+{
+       /**
+        * @var Phar(Data)
+        */
+       private $source;
+
+       /**
+        * @param mixed $source archive location
+        */
+       public function __construct($source) {
+               if ($source instanceof Phar || $source instanceof PharData || $source instanceof Archive) {
+                       $this->source = $source;
+               } else {
+                       $this->source = new PharData($source);
+               }
+       }
+
+       /**
+        * @param bool $verbose
+        * @return \pharext\Tempdir
+        */
+       public function run($verbose = false) {
+               if ($verbose) {
+                       printf("Extracting %s ...\n", basename($this->source->getPath()));
+               }
+               if ($this->source instanceof Archive) {
+                       return $this->source->extract();
+               }
+               $dest = new Tempdir("extract");
+               $this->source->extractTo($dest);
+               return $dest;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\ExecCmd;
+use pharext\Task;
+use pharext\Tempdir;
+
+/**
+ * Clone a git repo
+ */
+class GitClone implements Task
+{
+       /**
+        * @var string
+        */
+       private $source;
+       
+       /**
+        * @var string
+        */
+       private $branch;
+
+       /**
+        * @param string $source git repo location
+        */
+       public function __construct($source, $branch = null) {
+               $this->source = $source;
+               $this->branch = $branch;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return \pharext\Tempdir
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Fetching %s ...\n", $this->source);
+               }
+               $local = new Tempdir("gitclone");
+               $cmd = new ExecCmd("git", $verbose);
+               if (strlen($this->branch)) {
+                       $cmd->run(["clone", "--depth", 1, "--branch", $this->branch, $this->source, $local]);
+               } else {
+                       $cmd->run(["clone", $this->source, $local]);
+               }
+               return $local;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\ExecCmd;
+use pharext\Exception;
+use pharext\Task;
+
+/**
+ * Run make in the source dir
+ */
+class Make implements Task
+{
+       /**
+        * @var string
+        */
+       private $cwd;
+
+       /**
+        * @var array
+        */
+       private $args;
+
+       /**
+        * @var string
+        */
+       private $sudo;
+
+       /**
+        *
+        * @param string $cwd working directory
+        * @param array $args make's arguments
+        * @param string $sudo sudo command
+        */
+       public function __construct($cwd, array $args = null, $sudo = null) {
+               $this->cwd = $cwd;
+               $this->sudo = $sudo;
+               $this->args = $args;
+       }
+
+       /**
+        *
+        * @param bool $verbose
+        * @throws \pharext\Exception
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Running make");
+                       if ($this->args) {
+                               foreach ($this->args as $arg) {
+                                       printf(" %s", $arg);
+                               }
+                       }
+                       printf(" ...\n");
+               }
+               $pwd = getcwd();
+               if (!chdir($this->cwd)) {
+                       throw new Exception;
+               }
+               try {
+                       $cmd = new ExecCmd("make", $verbose);
+                       if (isset($this->sudo)) {
+                               $cmd->setSu($this->sudo);
+                       }
+                       $args = $this->args;
+                       if (!$verbose) {
+                               $args = array_merge((array) $args, ["-s"]);
+                       }
+                       $cmd->run($args);
+               } finally {
+                       chdir($pwd);
+               }
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\Task;
+use pharext\Tempfile;
+
+class PaxFixup implements Task
+{
+       private $source;
+
+       public function __construct($source) {
+               $this->source = $source;
+       }
+
+       private function openArchive($source) {
+               $hdr = file_get_contents($source, false, null, 0, 3);
+               if ($hdr === "\x1f\x8b\x08") {
+                       $fd = fopen("compress.zlib://$source", "r");
+               } elseif ($hdr === "BZh") {
+                       $fd = fopen("compress.bzip2://$source", "r");
+               } else {
+                       $fd = fopen($source, "r");
+               }
+               if (!is_resource($fd)) {
+                       throw new Exception;
+               }
+               return $fd;
+       }
+
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Fixing up a tarball with global pax header ...\n");
+               }
+               $temp = new Tempfile("paxfix");
+               stream_copy_to_stream($this->openArchive($this->source),
+                       $temp->getStream(), -1, 1024);
+               $temp->closeStream();
+               return (new Extract((string) $temp))->run($verbose);
+       }
+}<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\Task;
+
+/**
+ * Fixup package.xml files in an extracted PECL dir
+ */
+class PeclFixup implements Task
+{
+       /**
+        * @var string
+        */
+       private $source;
+
+       /**
+        * @param string $source source directory
+        */
+       public function __construct($source) {
+               $this->source = $source;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return string sanitized source location
+        * @throws \pahrext\Exception
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Sanitizing PECL dir ...\n");
+               }
+               $dirs = glob("{$this->source}/*", GLOB_ONLYDIR);
+               $files = array_diff(glob("{$this->source}/*"), $dirs);
+               $check = array_reduce($files, function($r, $v) {
+                       return $v && fnmatch("package*.xml", basename($v));
+               }, true);
+
+               if (count($dirs) !== 1 || !$check) {
+                       throw new Exception("Does not look like an extracted PECL dir: {$this->source}");
+               }
+
+               $dest = current($dirs);
+
+               foreach ($files as $file) {
+                       if ($verbose) {
+                               printf("Moving %s into %s ...\n", basename($file), basename($dest));
+                       }
+                       if (!rename($file, "$dest/" . basename($file))) {
+                               throw new Exception;
+                       }
+               }
+
+               return $dest;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\SourceDir;
+use pharext\Task;
+use pharext\Tempname;
+
+use Phar;
+
+/**
+ * Build phar
+ */
+class PharBuild implements Task
+{
+       /**
+        * @var \pharext\SourceDir
+        */
+       private $source;
+
+       /**
+        * @var string
+        */
+       private $stub;
+
+       /**
+        * @var array
+        */
+       private $meta;
+
+       /**
+        * @var bool
+        */
+       private $readonly;
+
+       /**
+        * @param SourceDir $source extension source directory
+        * @param string $stub path to phar stub
+        * @param array $meta phar meta data
+        * @param bool $readonly whether the stub has -dphar.readonly=1 set
+        */
+       public function __construct(SourceDir $source = null, $stub, array $meta = null, $readonly = true) {
+               $this->source = $source;
+               $this->stub = $stub;
+               $this->meta = $meta;
+               $this->readonly = $readonly;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return \pharext\Tempname
+        * @throws \pharext\Exception
+        */
+       public function run($verbose = false) {
+               /* Phar::compress() and ::convert*() use strtok("."), ugh!
+                * so, be sure to not use any other dots in the filename
+                * except for .phar
+                */
+               $temp = new Tempname("", "-pharext.phar");
+
+               $phar = new Phar($temp);
+               $phar->startBuffering();
+
+               if ($this->meta) {
+                       $phar->setMetadata($this->meta);
+               }
+               if ($this->stub) {
+                       (new PharStub($phar, $this->stub))->run($verbose);
+               }
+
+               $phar->buildFromIterator((new Task\BundleGenerator)->run());
+
+               if ($this->source) {
+                       if ($verbose) {
+                               $bdir = $this->source->getBaseDir();
+                               $blen = strlen($bdir);
+                               foreach ($this->source as $index => $file) {
+                                       if (is_resource($file)) {
+                                               printf("Packaging %s ...\n", $index);
+                                               $phar[$index] = $file;
+                                       } else {
+                                               printf("Packaging %s ...\n", $index = trim(substr($file, $blen), "/"));
+                                               $phar->addFile($file, $index);
+                                       }
+                               }
+                       } else {
+                               $phar->buildFromIterator($this->source, $this->source->getBaseDir());
+                       }
+               }
+
+               $phar->stopBuffering();
+               
+               if (!chmod($temp, fileperms($temp) | 0111)) {
+                       throw new Exception;
+               }
+               
+               return $temp;
+       }
+}<?php
+
+namespace pharext\Task;
+
+use pharext\Task;
+
+use Phar;
+
+/**
+ * Clone a compressed copy of a phar
+ */
+class PharCompress implements Task
+{
+       /**
+        * @var string
+        */
+       private $file;
+
+       /**
+        * @var Phar
+        */
+       private $package;
+
+       /**
+        * @var int
+        */
+       private $encoding;
+
+       /**
+        * @var string
+        */
+       private $extension;
+
+       /**
+        * @param string $file path to the original phar
+        * @param int $encoding Phar::GZ or Phar::BZ2
+        */
+       public function __construct($file, $encoding) {
+               $this->file = $file;
+               $this->package = new Phar($file);
+               $this->encoding = $encoding;
+
+               switch ($encoding) {
+                       case Phar::GZ:
+                               $this->extension = ".gz";
+                               break;
+                       case Phar::BZ2:
+                               $this->extension = ".bz2";
+                               break;
+               }
+       }
+
+       /**
+        * @param bool $verbose
+        * @return string
+        */
+       public function run($verbose = false) {
+               if ($verbose) {
+                       printf("Compressing %s ...\n", basename($this->package->getPath()));
+               }
+               /* stop shebang */
+               $stub = $this->package->getStub();
+               $phar = $this->package->compress($this->encoding);
+               $phar->setStub(substr($stub, strpos($stub, "\n")+1));
+               return $this->file . $this->extension;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\Task;
+
+/**
+ * Rename the phar archive
+ */
+class PharRename implements Task
+{
+       /**
+        * @var string
+        */
+       private $phar;
+
+       /**
+        * @var string
+        */
+       private $dest;
+
+       /**
+        * @var string
+        */
+       private $name;
+
+       /**
+        * @param string $phar path to phar
+        * @param string $dest destination dir
+        * @param string $name package name
+        */
+       public function __construct($phar, $dest, $name) {
+               $this->phar = $phar;
+               $this->dest = $dest;
+               $this->name = $name;
+       }
+
+       /**
+        * @param bool $verbose
+        * @return string path to renamed phar
+        * @throws \pharext\Exception
+        */
+       public function run($verbose = false) {
+               $extension = substr(strstr($this->phar, "-pharext.phar"), 8);
+               $name = sprintf("%s/%s.ext%s", $this->dest, $this->name, $extension);
+               
+               if ($verbose) {
+                       printf("Renaming %s to %s ...\n", basename($this->phar), basename($name));
+               }
+
+               if (!rename($this->phar, $name)) {
+                       throw new Exception;
+               }
+
+               return $name;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Openssl;
+use pharext\Task;
+
+use Phar;
+
+/**
+ * Sign the phar with a private key
+ */
+class PharSign implements Task
+{
+       /**
+        * @var Phar
+        */
+       private $phar;
+
+       /**
+        * @var \pharext\Openssl\PrivateKey
+        */
+       private $pkey;
+
+       /**
+        *
+        * @param mixed $phar phar instance or path to phar
+        * @param string $pkey path to private key
+        * @param string $pass password for the private key
+        */
+       public function __construct($phar, $pkey, $pass) {
+               if ($phar instanceof Phar || $phar instanceof PharData) {
+                       $this->phar = $phar;
+               } else {
+                       $this->phar = new Phar($phar);
+               }
+               $this->pkey = new Openssl\PrivateKey($pkey, $pass);
+       }
+
+       /**
+        * @param bool $verbose
+        * @return \pharext\Openssl\PrivateKey
+        */
+       public function run($verbose = false) {
+               if ($verbose) {
+                       printf("Signing %s ...\n", basename($this->phar->getPath()));
+               }
+               $this->pkey->sign($this->phar);
+               return $this->pkey;
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use Phar;
+use pharext\Exception;
+use pharext\Task;
+
+/**
+ * Set the phar's stub
+ */
+class PharStub implements Task
+{
+       /**
+        * @var \Phar
+        */
+       private $phar;
+
+       /**
+        * @var string
+        */
+       private $stub;
+
+       /**
+        * @param \Phar $phar
+        * @param string $stub file path to the stub
+        * @throws \pharext\Exception
+        */
+       function __construct(Phar $phar, $stub) {
+               $this->phar = $phar;
+               if (!file_exists($this->stub = $stub)) {
+                       throw new Exception("File '$stub' does not exist");
+               }
+       }
+
+       /**
+        * @param bool $verbose
+        */
+       function run($verbose = false) {
+               if ($verbose) {
+                       printf("Using stub '%s'...\n", basename($this->stub));
+               }
+               $stub = preg_replace_callback('/^#include <([^>]+)>/m', function($includes) {
+                       return file_get_contents($includes[1], true, null, 5);
+               }, file_get_contents($this->stub));
+               if ($this->phar->isCompressed() && substr($stub, 0, 2) === "#!") {
+                       $stub = substr($stub, strpos($stub, "\n")+1);
+               }
+               $this->phar->setStub($stub);
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\ExecCmd;
+use pharext\Task;
+
+/**
+ * Run phpize in the extension source directory
+ */
+class Phpize implements Task
+{
+       /**
+        * @var string
+        */
+       private $phpize;
+
+       /**
+        *
+        * @var string
+        */
+       private $cwd;
+
+       /**
+        * @param string $cwd working directory
+        * @param string $prefix install prefix, e.g. /usr/local
+        * @param string $common_name PHP program common name, e.g. php5
+        */
+       public function __construct($cwd, $prefix = null,  $common_name = "php") {
+               $this->cwd = $cwd;
+               $cmd = $common_name . "ize";
+               if (isset($prefix)) {
+                       $cmd = $prefix . "/bin/" . $cmd;
+               }
+               $this->phpize = $cmd;
+       }
+
+       /**
+        * @param bool $verbose
+        * @throws \pharext\Exception
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Running %s ...\n", $this->phpize);
+               }
+               $pwd = getcwd();
+               if (!chdir($this->cwd)) {
+                       throw new Exception;
+               }
+               try {
+                       $cmd = new ExecCmd($this->phpize, $verbose);
+                       $cmd->run();
+               } finally {
+                       chdir($pwd);
+               }
+       }
+}
+<?php
+
+namespace pharext\Task;
+
+use pharext\Exception;
+use pharext\Task;
+use pharext\Tempfile;
+
+/**
+ * Fetch a remote archive
+ */
+class StreamFetch implements Task
+{
+       /**
+        * @var string
+        */
+       private $source;
+
+       /**
+        * @var callable
+        */
+       private $progress;
+
+       /**
+        * @param string $source remote file location
+        * @param callable $progress progress callback
+        */
+       public function __construct($source, callable $progress) {
+               $this->source = $source;
+               $this->progress = $progress;
+       }
+
+       private function createStreamContext() {
+               $progress = $this->progress;
+
+               /* avoid bytes_max bug of older PHP versions */
+               $maxbytes = 0;
+               return stream_context_create([],["notification" => function($notification, $severity, $message, $code, $bytes_cur, $bytes_max) use($progress, &$maxbytes) {
+                       if ($bytes_max > $maxbytes) {
+                               $maxbytes = $bytes_max;
+                       }
+                       switch ($notification) {
+                               case STREAM_NOTIFY_CONNECT:
+                                       $progress(0);
+                                       break;
+                               case STREAM_NOTIFY_PROGRESS:
+                                       $progress($maxbytes > 0 ? $bytes_cur/$maxbytes : .5);
+                                       break;
+                               case STREAM_NOTIFY_COMPLETED:
+                                       /* this is sometimes not generated, why? */
+                                       $progress(1);
+                                       break;
+                       }
+               }]);
+       }
+
+       /**
+        * @param bool $verbose
+        * @return \pharext\Task\Tempfile
+        * @throws \pharext\Exception
+        */
+       public function run($verbose = false) {
+               if ($verbose !== false) {
+                       printf("Fetching %s ...\n", $this->source);
+               }
+               $context = $this->createStreamContext();
+
+               if (!$remote = fopen($this->source, "r", false, $context)) {
+                       throw new Exception;
+               }
+               
+               $local = new Tempfile("remote");
+               if (!stream_copy_to_stream($remote, $local->getStream())) {
+                       throw new Exception;
+               }
+               $local->closeStream();
+
+               /* STREAM_NOTIFY_COMPLETED is not generated, see above */
+               call_user_func($this->progress, 1);
+
+               return $local;
+       }
+}
+<?php
+
+namespace pharext;
+
+/**
+ * Simple task interface
+ */
+interface Task
+{
+       public function run($verbose = false);
+}
+<?php
+
+namespace pharext;
+
+/**
+ * Create a temporary directory
+ */
+class Tempdir extends \SplFileInfo
+{
+       /**
+        * @param string $prefix prefix to uniqid()
+        * @throws \pharext\Exception
+        */
+       public function __construct($prefix) {
+               $temp = new Tempname($prefix);
+               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
+                       throw new Exception("Could not create tempdir: ".error_get_last()["message"]);
+               }
+               parent::__construct($temp);
+       }
+}
+<?php 
+
+namespace pharext;
+
+/**
+ * Create a new temporary file
+ */
+class Tempfile extends \SplFileInfo
+{
+       /**
+        * @var resource
+        */
+       private $handle;
+
+       /**
+        * @param string $prefix uniqid() prefix
+        * @param string $suffix e.g. file extension
+        * @throws \pharext\Exception
+        */
+       public function __construct($prefix, $suffix = ".tmp") {
+               $tries = 0;
+               $omask = umask(077);
+               do {
+                       $path = new Tempname($prefix, $suffix);
+                       $this->handle = fopen($path, "x");
+               } while (!is_resource($this->handle) && $tries++ < 10);
+               umask($omask);
+               
+               if (!is_resource($this->handle)) {
+                       throw new Exception("Could not create temporary file");
+               }
+               
+               parent::__construct($path);
+       }
+
+       /**
+        * Unlink the file
+        */
+       public function __destruct() {
+               if (is_file($this->getPathname())) {
+                       @unlink($this->getPathname());
+               }
+       }
+
+       /**
+        * Close the stream
+        */
+       public function closeStream() {
+               fclose($this->handle);
+       }
+
+       /**
+        * Retrieve the stream resource
+        * @return resource
+        */
+       public function getStream() {
+               return $this->handle;
+       }
+}
+<?php
+
+namespace pharext;
+
+use pharext\Exception;
+
+/**
+ * A temporary file/directory name
+ */
+class Tempname
+{
+       /**
+        * @var string
+        */
+       private $name;
+
+       /**
+        * @param string $prefix uniqid() prefix
+        * @param string $suffix e.g. file extension
+        */
+       public function __construct($prefix, $suffix = null) {
+               $temp = sys_get_temp_dir() . "/pharext-" . $this->getUser();
+               if (!is_dir($temp) && !mkdir($temp, 0700, true)) {
+                       throw new Exception;
+               }
+               $this->name = $temp ."/". uniqid($prefix) . $suffix;
+       }
+
+       private function getUser() {
+               if (extension_loaded("posix") && function_exists("posix_getpwuid")) {
+                       return posix_getpwuid(posix_getuid())["name"];
+               }
+               return trim(`whoami 2>/dev/null`)
+                       ?: trim(`id -nu 2>/dev/null`)
+                       ?: getenv("USER")
+                       ?: get_current_user();
+       }
+
+       /**
+        * @return string
+        */
+       public function __toString() {
+               return (string) $this->name;
+       }
+}
+<?php
+
+namespace pharext;
+
+use Phar;
+use PharFileInfo;
+use SplFileInfo;
+use pharext\Exception;
+
+class Updater implements Command
+{
+       use Cli\Command;
+
+       /**
+        * Create the command
+        */
+       public function __construct() {
+               $this->args = new Cli\Args([
+                       ["h", "help", "Display this help",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       ["v", "verbose", "More output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       ["q", "quiet", "Less output",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG],
+                       [null, "signature", "Show pharext signature",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "license", "Show pharext license",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [null, "version", "Show pharext version",
+                               Cli\Args::OPTIONAL|Cli\Args::SINGLE|Cli\Args::NOARG|Cli\Args::HALT],
+                       [0, "path", "Path to .ext.phar to update",
+                               Cli\Args::REQUIRED|Cli\Args::MULTI],
+               ]);
+       }
+
+       /**
+        * @inheritdoc
+        * @see \pharext\Command::run()
+        */
+       public function run($argc, array $argv) {
+               $errs = [];
+               $prog = array_shift($argv);
+               foreach ($this->args->parse(--$argc, $argv) as $error) {
+                       $errs[] = $error;
+               }
+
+               if ($this->args["help"]) {
+                       $this->header();
+                       $this->help($prog);
+                       exit;
+               }
+
+               try {
+                       foreach (["signature", "license", "version"] as $opt) {
+                               if ($this->args[$opt]) {
+                                       printf("%s\n", $this->metadata($opt));
+                                       exit;
+                               }
+                       }
+               } catch (\Exception $e) {
+                       $this->error("%s\n", $e->getMessage());
+                       exit(self::EARGS);
+               }
+
+
+               foreach ($this->args->validate() as $error) {
+                       $errs[] = $error;
+               }
+
+               if ($errs) {
+                       if (!$this->args["quiet"]) {
+                               $this->header();
+                       }
+                       foreach ($errs as $err) {
+                               $this->error("%s\n", $err);
+                       }
+                       printf("\n");
+                       if (!$this->args["quiet"]) {
+                               $this->help($prog);
+                       }
+                       exit(self::EARGS);
+               }
+
+               foreach ($this->args[0] as $file) {
+                       $info = new SplFileInfo($file);
+
+                       while ($info->isLink()) {
+                               $info = new SplFileInfo($info->getLinkTarget());
+                       }
+                       
+                       if ($info->isFile()) {
+                               if (!$this->updatePackage($info)) {
+                                       $this->warn("Cannot upgrade pre-v3 packages\n");
+                               }
+                       } else {
+                               $this->error("File '%s' does not exist\n", $file);
+                               exit(self::EARGS);
+                       }
+               }
+       }
+
+       /**
+        * Replace the pharext core in an .ext.phar package
+        * @param string $temp path to temp phar
+        * @return boolean FALSE if the package is too old (pre-v3) to upgrade
+        */
+       private function replacePharext($temp) {
+               $phar = new Phar($temp, Phar::CURRENT_AS_SELF);
+               $phar->startBuffering();
+
+               if (!$meta = $phar->getMetadata()) {
+                       // don't upgrade pre-v3 packages
+                       return false;
+               }
+
+               // replace current pharext files
+               $core = (new Task\BundleGenerator)->run($this->verbosity());
+               $phar->buildFromIterator($core);
+               $stub = __DIR__."/../pharext_installer.php";
+               (new Task\PharStub($phar, $stub))->run($this->verbosity());
+
+               // check dependencies
+               foreach ($phar as $info) {
+                       if (fnmatch("*.ext.phar*", $info->getBasename())) {
+                               $this->updatePackage($info, $phar);
+                       }
+               }
+               
+               $phar->stopBuffering();
+
+               $phar->setMetadata([
+                       "version" => Metadata::version(),
+                       "header" => Metadata::header(),
+               ] + $meta);
+
+               $this->info("Updated pharext version from '%s' to '%s'\n",
+                       isset($meta["version"]) ? $meta["version"] : "(unknown)",
+                       $phar->getMetadata()["version"]);
+
+               return true;
+       }
+
+       /**
+        * Update an .ext.phar package to the current pharext version
+        * @param SplFileInfo $file
+        * @param Phar $phar the parent phar containing $file as dependency
+        * @return boolean FALSE if the package is too old (pre-v3) to upgrade
+        * @throws Exception
+        */
+       private function updatePackage(SplFileInfo $file, Phar $phar = null) {
+               $this->info("Updating pharext core in '%s'...\n", basename($file));
+
+               $temp = new Tempname("update", substr(strstr($file, ".ext.phar"), 4));
+
+               if (!copy($file->getPathname(), $temp)) {
+                       throw new Exception;
+               }
+               if (!chmod($temp, $file->getPerms())) {
+                       throw new Exception;
+               }
+               
+               if (!$this->replacePharext($temp)) {
+                       return false;
+               }
+
+               if ($phar) {
+                       $phar->addFile($temp, $file);
+               } elseif (!rename($temp, $file->getPathname())) {
+                       throw new Exception;
+               }
+
+               return true;
+       }
+}
+#!/usr/bin/env php
+<?php
+
+/**
+ * The installer sub-stub for extension phars
+ */
+
+namespace pharext;
+
+define("PHAREXT_PHAR", __FILE__);
+
+spl_autoload_register(function($c) {
+       return include strtr($c, "\\_", "//") . ".php";
+});
+
+#include <pharext/Exception.php>
+#include <pharext/Tempname.php>
+#include <pharext/Tempfile.php>
+#include <pharext/Tempdir.php>
+#include <pharext/Archive.php>
+
+namespace pharext;
+
+if (extension_loaded("Phar")) {
+       \Phar::interceptFileFuncs();
+       \Phar::mapPhar();
+       $phardir = "phar://".__FILE__;
+} else {
+       $archive = new Archive(__FILE__);
+       $phardir = $archive->extract();
+}
+
+set_include_path("$phardir:". get_include_path());
+
+$installer = new Installer();
+$installer->run($argc, $argv);
+
+__HALT_COMPILER();
+#!/usr/bin/php -dphar.readonly=0
+<?php
+
+/**
+ * The packager sub-stub for bin/pharext
+ */
+
+namespace pharext;
+
+spl_autoload_register(function($c) {
+       return include strtr($c, "\\_", "//") . ".php";
+});
+
+set_include_path('phar://' . __FILE__ .":". get_include_path());
+
+if (!extension_loaded("Phar")) {
+       fprintf(STDERR, "ERROR: Phar extension not loaded\n\n");
+       fprintf(STDERR, "\tPlease load the phar extension in your php.ini\n".
+                                       "\tor rebuild PHP with the --enable-phar flag.\n\n");
+       exit(1);
+}
+
+if (ini_get("phar.readonly")) {
+       fprintf(STDERR, "ERROR: Phar is configured read-only\n\n");
+       fprintf(STDERR, "\tPlease specify phar.readonly=0 in your php.ini\n".
+                                       "\tor run this command with php -dphar.readonly=0\n\n");
+       exit(1);
+}
+
+\Phar::interceptFileFuncs();
+\Phar::mapPhar();
+
+$packager = new Packager();
+$packager->run($argc, $argv);
+
+__HALT_COMPILER();
+#!/usr/bin/php -dphar.readonly=0
+<?php
+
+/**
+ * The installer updater stub for extension phars
+ */
+
+namespace pharext;
+
+spl_autoload_register(function($c) {
+       return include strtr($c, "\\_", "//") . ".php";
+});
+
+set_include_path('phar://' . __FILE__ .":". get_include_path());
+
+if (!extension_loaded("Phar")) {
+       fprintf(STDERR, "ERROR: Phar extension not loaded\n\n");
+       fprintf(STDERR, "\tPlease load the phar extension in your php.ini\n".
+                                       "\tor rebuild PHP with the --enable-phar flag.\n\n");
+       exit(1);
+}
+
+if (ini_get("phar.readonly")) {
+       fprintf(STDERR, "ERROR: Phar is configured read-only\n\n");
+       fprintf(STDERR, "\tPlease specify phar.readonly=0 in your php.ini\n".
+                                       "\tor run this command with php -dphar.readonly=0\n\n");
+       exit(1);
+}
+
+\Phar::interceptFileFuncs();
+\Phar::mapPhar();
+
+$updater = new Updater();
+$updater->run($argc, $argv);
+
+__HALT_COMPILER();
+package.xml            merge=touch
+php_raphf.h            merge=touch
+
+# /
+*~
+/*.tgz
+/.deps
+/*.lo
+/*.la
+/config.[^mw]*
+/configure*
+/lib*
+/ac*.m4
+/ltmain.sh
+/install-sh
+/Make*
+/mk*
+/missing
+/.libs
+/build
+/include
+/modules
+/autom4te*
+/.dep.inc
+run-tests.php
+raphf
+Michael Wallner
+# Doxyfile 1.8.9.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING      = UTF-8
+PROJECT_NAME           = "Resource and persistent handle factory API"
+PROJECT_NUMBER         =
+PROJECT_BRIEF          = "A facility to manage possibly persistent resources with a comprehensible API.  Provides simliar functionality like the zend_list API, but with more flexiblity and freedom."
+PROJECT_LOGO           = raphf.png
+OUTPUT_DIRECTORY       =
+CREATE_SUBDIRS         = NO
+ALLOW_UNICODE_NAMES    = NO
+OUTPUT_LANGUAGE        = English
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       =
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = YES
+STRIP_FROM_PATH        =
+STRIP_FROM_INC_PATH    =
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = YES
+QT_AUTOBRIEF           = NO
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS           = YES
+SEPARATE_MEMBER_PAGES  = NO
+TAB_SIZE               = 4
+ALIASES                =
+TCL_SUBST              =
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+OPTIMIZE_FOR_FORTRAN   = NO
+OPTIMIZE_OUTPUT_VHDL   = NO
+EXTENSION_MAPPING      =
+MARKDOWN_SUPPORT       = YES
+AUTOLINK_SUPPORT       = YES
+BUILTIN_STL_SUPPORT    = NO
+CPP_CLI_SUPPORT        = NO
+SIP_SUPPORT            = NO
+IDL_PROPERTY_SUPPORT   = YES
+DISTRIBUTE_GROUP_DOC   = NO
+SUBGROUPING            = YES
+INLINE_GROUPED_CLASSES = NO
+INLINE_SIMPLE_STRUCTS  = YES
+TYPEDEF_HIDES_STRUCT   = NO
+LOOKUP_CACHE_SIZE      = 0
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_PACKAGE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+EXTRACT_ANON_NSPACES   = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = NO
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+HIDE_COMPOUND_REFERENCE= NO
+SHOW_INCLUDE_FILES     = YES
+SHOW_GROUPED_MEMB_INC  = NO
+FORCE_LOCAL_INCLUDES   = NO
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES       = NO
+SORT_BY_SCOPE_NAME     = NO
+STRICT_PROTO_MATCHING  = NO
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+GENERATE_BUGLIST       = YES
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       =
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_FILES             = YES
+SHOW_NAMESPACES        = YES
+FILE_VERSION_FILTER    =
+LAYOUT_FILE            =
+CITE_BIB_FILES         =
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           =
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = php_raphf.h
+INPUT_ENCODING         = UTF-8
+FILE_PATTERNS          =
+RECURSIVE              = NO
+EXCLUDE                =
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       =
+EXCLUDE_SYMBOLS        =
+EXAMPLE_PATH           =
+EXAMPLE_PATTERNS       =
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             =
+INPUT_FILTER           =
+FILTER_PATTERNS        =
+FILTER_SOURCE_FILES    = NO
+FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE =
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = NO
+REFERENCES_LINK_SOURCE = YES
+SOURCE_TOOLTIPS        = YES
+USE_HTAGS              = NO
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = YES
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          =
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = .
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            =
+HTML_FOOTER            =
+HTML_STYLESHEET        =
+HTML_EXTRA_STYLESHEET  =
+HTML_EXTRA_FILES       =
+HTML_COLORSTYLE_HUE    = 220
+HTML_COLORSTYLE_SAT    = 100
+HTML_COLORSTYLE_GAMMA  = 80
+HTML_TIMESTAMP         = NO
+HTML_DYNAMIC_SECTIONS  = NO
+HTML_INDEX_NUM_ENTRIES = 100
+GENERATE_DOCSET        = NO
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+DOCSET_PUBLISHER_NAME  = Publisher
+GENERATE_HTMLHELP      = NO
+CHM_FILE               =
+HHC_LOCATION           =
+GENERATE_CHI           = NO
+CHM_INDEX_ENCODING     =
+BINARY_TOC             = NO
+TOC_EXPAND             = NO
+GENERATE_QHP           = NO
+QCH_FILE               =
+QHP_NAMESPACE          = org.doxygen.Project
+QHP_VIRTUAL_FOLDER     = doc
+QHP_CUST_FILTER_NAME   =
+QHP_CUST_FILTER_ATTRS  =
+QHP_SECT_FILTER_ATTRS  =
+QHG_LOCATION           =
+GENERATE_ECLIPSEHELP   = NO
+ECLIPSE_DOC_ID         = org.doxygen.Project
+DISABLE_INDEX          = NO
+GENERATE_TREEVIEW      = YES
+ENUM_VALUES_PER_LINE   = 4
+TREEVIEW_WIDTH         = 250
+EXT_LINKS_IN_WINDOW    = NO
+FORMULA_FONTSIZE       = 10
+FORMULA_TRANSPARENT    = YES
+USE_MATHJAX            = NO
+MATHJAX_FORMAT         = HTML-CSS
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+MATHJAX_EXTENSIONS     =
+MATHJAX_CODEFILE       =
+SEARCHENGINE           = YES
+SERVER_BASED_SEARCH    = NO
+EXTERNAL_SEARCH        = NO
+SEARCHENGINE_URL       =
+SEARCHDATA_FILE        = searchdata.xml
+EXTERNAL_SEARCH_ID     =
+EXTRA_SEARCH_MAPPINGS  =
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4
+EXTRA_PACKAGES         =
+LATEX_HEADER           =
+LATEX_FOOTER           =
+LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_FILES      =
+PDF_HYPERLINKS         = YES
+USE_PDFLATEX           = YES
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+LATEX_SOURCE_CODE      = NO
+LATEX_BIB_STYLE        = plain
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = rtf
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    =
+RTF_EXTENSIONS_FILE    =
+RTF_SOURCE_CODE        = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_SUBDIR             =
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+GENERATE_DOCBOOK       = NO
+DOCBOOK_OUTPUT         = docbook
+DOCBOOK_PROGRAMLISTING = NO
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           =
+INCLUDE_FILE_PATTERNS  =
+PREDEFINED             = DOXYGEN \
+                         TSRMLS_C= \
+                         TSRMLS_D= \
+                         TSRMLS_CC= \
+                         TSRMLS_DC= \
+                         PHP_RAPHF_API=
+EXPAND_AS_DEFINED      =
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+TAGFILES               =
+GENERATE_TAGFILE       =
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+EXTERNAL_PAGES         = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+MSCGEN_PATH            =
+DIA_PATH               =
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = YES
+DOT_NUM_THREADS        = 0
+DOT_FONTNAME           = Helvetica
+DOT_FONTSIZE           = 10
+DOT_FONTPATH           =
+CLASS_GRAPH            = NO
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+UML_LIMIT_NUM_FIELDS   = 10
+TEMPLATE_RELATIONS     = NO
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = YES
+CALLER_GRAPH           = YES
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+INTERACTIVE_SVG        = NO
+DOT_PATH               =
+DOTFILE_DIRS           =
+MSCFILE_DIRS           =
+DIAFILE_DIRS           =
+PLANTUML_JAR_PATH      =
+PLANTUML_INCLUDE_PATH  =
+DOT_GRAPH_MAX_NODES    = 50
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+Copyright (c) 2013, Michael Wallner <mike@php.net>.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without 
+modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, 
+      this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright 
+      notice, this list of conditions and the following disclaimer in the 
+      documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+# pecl/raphf
+
+## About:
+
+The "Resource and Persistent Handle Factory" extension provides facilities to manage those in a convenient manner.
+
+## Installation:
+
+This extension is hosted at [PECL](http://pecl.php.net) and can be installed with [PEAR](http://pear.php.net)'s pecl command:
+
+    # pecl install raphf
+
+Also, watch out for self-installing [pharext](https://github.com/m6w6/pharext) packages attached to [releases](https://github.com/m6w6/ext-raphf/releases).
+
+
+## INI Directives:
+
+* raphf.persistent_handle.limit = -1  
+  The per process/thread persistent handle limit.
+
+## Internals:
+
+> ***NOTE:***  
+  This extension mostly only provides infrastructure for other extensions.
+  See the [API docs here](http://m6w6.github.io/ext-raphf/).
+
+## Documentation:
+
+Userland documentation can be found at https://mdref.m6w6.name/raphf
+* TTL
+PHP_ARG_ENABLE(raphf, whether to enable raphf support,
+[  --enable-raphf           Enable resource and persistent handles factory support])
+
+if test "$PHP_RAPHF" != "no"; then
+       PHP_INSTALL_HEADERS(ext/raphf, php_raphf.h php_raphf_api.h)
+       PHP_NEW_EXTENSION(raphf, php_raphf.c, $ext_shared)
+fi
+\r
+\r
+ARG_ENABLE("raphf", "for raphf support", "no");\r
+\r
+if (PHP_RAPHF == "yes") {\r
+               EXTENSION("raphf", "php_raphf.c");\r
+\r
+               AC_DEFINE("HAVE_RAPHF", 1);\r
+               PHP_INSTALL_HEADERS("ext/raphf", "php_raphf.h");\r
+}\r
+<?xml version="1.0" encoding="UTF-8"?>
+<package 
+ packagerversion="1.4.11" 
+ version="2.0" 
+ xmlns="http://pear.php.net/dtd/package-2.0" 
+ xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" 
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+ xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
+ <name>raphf</name>
+ <channel>pecl.php.net</channel>
+ <summary>Resource and persistent handles factory</summary>
+ <description>A reusable split-off of pecl_http's persistent handle and resource factory API.</description>
+ <lead>
+  <name>Michael Wallner</name>
+  <user>mike</user>
+  <email>mike@php.net</email>
+  <active>yes</active>
+ </lead>
+ <date>2015-07-28</date>
+ <version>
+  <release>2.0.0-dev</release>
+  <api>2.0.0</api>
+ </version>
+ <stability>
+  <release>stable</release>
+  <api>stable</api>
+ </stability>
+ <license>BSD, revised</license>
+ <notes><![CDATA[
+]]></notes>
+ <contents>
+  <dir name="/">
+   <file role="doc" name="CREDITS" />
+   <file role="doc" name="LICENSE" />
+   <file role="doc" name="Doxyfile" />
+   <file role="src" name="config.m4" />
+   <file role="src" name="config.w32" />
+   <file role="src" name="php_raphf.h" />
+   <file role="src" name="php_raphf_api.h" />
+   <file role="src" name="php_raphf.c" />
+   <dir name="tests">
+    <file role="test" name="http001.phpt" />
+    <file role="test" name="http002.phpt" />
+    <file role="test" name="http003.phpt" />
+    <file role="test" name="http004.phpt" />
+   </dir>
+  </dir>
+ </contents>
+ <dependencies>
+  <required>
+   <php>
+    <min>7.0.0</min>
+   </php>
+   <pearinstaller>
+    <min>1.4.0</min>
+   </pearinstaller>
+  </required>
+ </dependencies>
+ <providesextension>raphf</providesextension>
+ <extsrcrelease/>
+</package>
+
+/*
+    +--------------------------------------------------------------------+
+    | PECL :: raphf                                                      |
+    +--------------------------------------------------------------------+
+    | Redistribution and use in source and binary forms, with or without |
+    | modification, are permitted provided that the conditions mentioned |
+    | in the accompanying LICENSE file are met.                          |
+    +--------------------------------------------------------------------+
+    | Copyright (c) 2013, Michael Wallner <mike@php.net>                 |
+    +--------------------------------------------------------------------+
+*/
+
+#ifdef HAVE_CONFIG_H
+#      include "config.h"
+#endif
+
+#include "php.h"
+#include "php_ini.h"
+#include "ext/standard/info.h"
+#include "php_raphf.h"
+
+#ifndef PHP_RAPHF_TEST
+#      define PHP_RAPHF_TEST 0
+#endif
+
+struct php_persistent_handle_globals {
+       ulong limit;
+       HashTable hash;
+};
+
+ZEND_BEGIN_MODULE_GLOBALS(raphf)
+       struct php_persistent_handle_globals persistent_handle;
+ZEND_END_MODULE_GLOBALS(raphf)
+
+#ifdef ZTS
+#      define PHP_RAPHF_G ((zend_raphf_globals *) \
+               (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(raphf_globals_id)])
+#else
+#      define PHP_RAPHF_G (&raphf_globals)
+#endif
+
+ZEND_DECLARE_MODULE_GLOBALS(raphf)
+
+#ifndef PHP_RAPHF_DEBUG_PHANDLES
+#      define PHP_RAPHF_DEBUG_PHANDLES 0
+#endif
+#if PHP_RAPHF_DEBUG_PHANDLES
+#      undef inline
+#      define inline
+#endif
+
+php_resource_factory_t *php_resource_factory_init(php_resource_factory_t *f,
+               php_resource_factory_ops_t *fops, void *data, void (*dtor)(void *data))
+{
+       if (!f) {
+               f = emalloc(sizeof(*f));
+       }
+       memset(f, 0, sizeof(*f));
+
+       memcpy(&f->fops, fops, sizeof(*fops));
+
+       f->data = data;
+       f->dtor = dtor;
+
+       f->refcount = 1;
+
+       return f;
+}
+
+unsigned php_resource_factory_addref(php_resource_factory_t *rf)
+{
+       return ++rf->refcount;
+}
+
+void php_resource_factory_dtor(php_resource_factory_t *f)
+{
+       if (!--f->refcount) {
+               if (f->dtor) {
+                       f->dtor(f->data);
+               }
+       }
+}
+
+void php_resource_factory_free(php_resource_factory_t **f)
+{
+       if (*f) {
+               php_resource_factory_dtor(*f);
+               if (!(*f)->refcount) {
+                       efree(*f);
+                       *f = NULL;
+               }
+       }
+}
+
+void *php_resource_factory_handle_ctor(php_resource_factory_t *f, void *init_arg)
+{
+       if (f->fops.ctor) {
+               return f->fops.ctor(f->data, init_arg);
+       }
+       return NULL;
+}
+
+void *php_resource_factory_handle_copy(php_resource_factory_t *f, void *handle)
+{
+       if (f->fops.copy) {
+               return f->fops.copy(f->data, handle);
+       }
+       return NULL;
+}
+
+void php_resource_factory_handle_dtor(php_resource_factory_t *f, void *handle)
+{
+       if (f->fops.dtor) {
+               f->fops.dtor(f->data, handle);
+       }
+}
+
+php_resource_factory_t *php_persistent_handle_resource_factory_init(
+               php_resource_factory_t *a, php_persistent_handle_factory_t *pf)
+{
+       return php_resource_factory_init(a,
+                       php_persistent_handle_get_resource_factory_ops(), pf,
+                       (void(*)(void*)) php_persistent_handle_abandon);
+}
+
+zend_bool php_resource_factory_is_persistent(php_resource_factory_t *a)
+{
+       return a->dtor == (void(*)(void *)) php_persistent_handle_abandon;
+}
+
+static inline php_persistent_handle_list_t *php_persistent_handle_list_init(
+               php_persistent_handle_list_t *list)
+{
+       if (!list) {
+               list = pemalloc(sizeof(*list), 1);
+       }
+       list->used = 0;
+       zend_hash_init(&list->free, 0, NULL, NULL, 1);
+
+       return list;
+}
+
+static int php_persistent_handle_apply_stat(zval *p, int argc, va_list argv,
+               zend_hash_key *key)
+{
+       php_persistent_handle_list_t *list = Z_PTR_P(p);
+       zval zsubentry, *zentry = va_arg(argv, zval *);
+
+       array_init(&zsubentry);
+       add_assoc_long_ex(&zsubentry, ZEND_STRL("used"), list->used);
+       add_assoc_long_ex(&zsubentry, ZEND_STRL("free"),
+                       zend_hash_num_elements(&list->free));
+       if (key->key) {
+               add_assoc_zval_ex(zentry, key->key->val, key->key->len, &zsubentry);
+       } else {
+               add_index_zval(zentry, key->h, &zsubentry);
+       }
+       return ZEND_HASH_APPLY_KEEP;
+}
+
+static int php_persistent_handle_apply_statall(zval *p, int argc, va_list argv,
+               zend_hash_key *key)
+{
+       php_persistent_handle_provider_t *provider = Z_PTR_P(p);
+       HashTable *ht = va_arg(argv, HashTable *);
+       zval zentry;
+
+       array_init(&zentry);
+
+       zend_hash_apply_with_arguments(&provider->list.free,
+                       php_persistent_handle_apply_stat, 1, &zentry);
+
+       if (key->key) {
+               zend_hash_update(ht, key->key, &zentry);
+       } else {
+               zend_hash_index_update(ht, key->h, &zentry);
+       }
+
+       return ZEND_HASH_APPLY_KEEP;
+}
+
+static int php_persistent_handle_apply_cleanup_ex(zval *p, void *arg)
+{
+       php_resource_factory_t *rf = arg;
+       void *handle = Z_PTR_P(p);
+
+#if PHP_RAPHF_DEBUG_PHANDLES
+       fprintf(stderr, "DESTROY: %p\n", handle);
+#endif
+       php_resource_factory_handle_dtor(rf, handle);
+       return ZEND_HASH_APPLY_REMOVE;
+}
+
+static int php_persistent_handle_apply_cleanup(zval *p, void *arg)
+{
+       php_resource_factory_t *rf = arg;
+       php_persistent_handle_list_t *list = Z_PTR_P(p);
+
+       zend_hash_apply_with_argument(&list->free,
+                       php_persistent_handle_apply_cleanup_ex, rf);
+       if (list->used) {
+               return ZEND_HASH_APPLY_KEEP;
+       }
+       zend_hash_destroy(&list->free);
+#if PHP_RAPHF_DEBUG_PHANDLES
+       fprintf(stderr, "LSTFREE: %p\n", list);
+#endif
+       pefree(list, 1);
+       return ZEND_HASH_APPLY_REMOVE;
+}
+
+static inline void php_persistent_handle_list_dtor(
+               php_persistent_handle_list_t *list,
+               php_persistent_handle_provider_t *provider)
+{
+#if PHP_RAPHF_DEBUG_PHANDLES
+       fprintf(stderr, "LSTDTOR: %p\n", list);
+#endif
+       zend_hash_apply_with_argument(&list->free,
+                       php_persistent_handle_apply_cleanup_ex, &provider->rf);
+       zend_hash_destroy(&list->free);
+}
+
+static inline void php_persistent_handle_list_free(
+               php_persistent_handle_list_t **list,
+               php_persistent_handle_provider_t *provider)
+{
+       php_persistent_handle_list_dtor(*list, provider);
+#if PHP_RAPHF_DEBUG_PHANDLES
+       fprintf(stderr, "LSTFREE: %p\n", *list);
+#endif
+       pefree(*list, 1);
+       *list = NULL;
+}
+
+static int php_persistent_handle_list_apply_dtor(zval *p, void *provider)
+{
+       php_persistent_handle_list_t *list = Z_PTR_P(p);
+
+       php_persistent_handle_list_free(&list, provider );
+       ZVAL_PTR(p, NULL);
+       return ZEND_HASH_APPLY_REMOVE;
+}
+
+static inline php_persistent_handle_list_t *php_persistent_handle_list_find(
+               php_persistent_handle_provider_t *provider, zend_string *ident)
+{
+       php_persistent_handle_list_t *list;
+       zval *zlist = zend_symtable_find(&provider->list.free, ident);
+
+       if (zlist && (list = Z_PTR_P(zlist))) {
+#if PHP_RAPHF_DEBUG_PHANDLES
+               fprintf(stderr, "LSTFIND: %p\n", list);
+#endif
+               return list;
+       }
+
+       if ((list = php_persistent_handle_list_init(NULL))) {
+               zval p, *rv;
+               zend_string *id;
+
+               ZVAL_PTR(&p, list);
+               id = zend_string_init(ident->val, ident->len, 1);
+               rv = zend_symtable_update(&provider->list.free, id, &p);
+               zend_string_release(id);
+
+               if (rv) {
+#if PHP_RAPHF_DEBUG_PHANDLES
+                       fprintf(stderr, "LSTFIND: %p (new)\n", list);
+#endif
+                       return list;
+               }
+               php_persistent_handle_list_free(&list, provider);
+       }
+
+       return NULL;
+}
+
+static int php_persistent_handle_apply_cleanup_all(zval *p, int argc,
+               va_list argv, zend_hash_key *key)
+{
+       php_persistent_handle_provider_t *provider = Z_PTR_P(p);
+       zend_string *ident = va_arg(argv, zend_string *);
+       php_persistent_handle_list_t *list;
+
+       if (ident && ident->len) {
+               if ((list = php_persistent_handle_list_find(provider, ident))) {
+                       zend_hash_apply_with_argument(&list->free,
+                                       php_persistent_handle_apply_cleanup_ex,
+                                       &provider->rf);
+               }
+       } else {
+               zend_hash_apply_with_argument(&provider->list.free,
+                               php_persistent_handle_apply_cleanup, &provider->rf);
+       }
+
+       return ZEND_HASH_APPLY_KEEP;
+}
+
+static void php_persistent_handle_hash_dtor(zval *p)
+{
+       php_persistent_handle_provider_t *provider = Z_PTR_P(p);
+
+       zend_hash_apply_with_argument(&provider->list.free,
+                       php_persistent_handle_list_apply_dtor, provider);
+       zend_hash_destroy(&provider->list.free);
+       php_resource_factory_dtor(&provider->rf);
+       pefree(provider, 1);
+}
+
+ZEND_RESULT_CODE php_persistent_handle_provide(zend_string *name,
+               php_resource_factory_ops_t *fops, void *data, void (*dtor)(void *))
+{
+       php_persistent_handle_provider_t *provider = pemalloc(sizeof(*provider), 1);
+
+       if (php_persistent_handle_list_init(&provider->list)) {
+               if (php_resource_factory_init(&provider->rf, fops, data, dtor)) {
+                       zval p, *rv;
+                       zend_string *ns;
+
+#if PHP_RAPHF_DEBUG_PHANDLES
+                       fprintf(stderr, "PROVIDE: %p %s\n", PHP_RAPHF_G, name_str);
+#endif
+
+                       ZVAL_PTR(&p, provider);
+                       ns = zend_string_init(name->val, name->len, 1);
+                       rv = zend_symtable_update(&PHP_RAPHF_G->persistent_handle.hash, ns, &p);
+                       zend_string_release(ns);
+
+                       if (rv) {
+                               return SUCCESS;
+                       }
+                       php_resource_factory_dtor(&provider->rf);
+               }
+       }
+
+       return FAILURE;
+}
+
+
+php_persistent_handle_factory_t *php_persistent_handle_concede(
+               php_persistent_handle_factory_t *a,
+               zend_string *name, zend_string *ident,
+               php_persistent_handle_wakeup_t wakeup,
+               php_persistent_handle_retire_t retire)
+{
+       zval *zprovider = zend_symtable_find(&PHP_RAPHF_G->persistent_handle.hash, name);
+
+       if (zprovider) {
+               zend_bool free_a = 0;
+
+               if ((free_a = !a)) {
+                       a = emalloc(sizeof(*a));
+               }
+               memset(a, 0, sizeof(*a));
+
+               a->provider = Z_PTR_P(zprovider);
+               a->ident = zend_string_copy(ident);
+               a->wakeup = wakeup;
+               a->retire = retire;
+               a->free_on_abandon = free_a;
+       } else {
+               a = NULL;
+       }
+
+#if PHP_RAPHF_DEBUG_PHANDLES
+       fprintf(stderr, "CONCEDE: %p %p (%s) (%s)\n", PHP_RAPHF_G,
+                       a ? a->provider : NULL, name->val, ident->val);
+#endif
+
+       return a;
+}
+
+void php_persistent_handle_abandon(php_persistent_handle_factory_t *a)
+{
+       zend_bool f = a->free_on_abandon;
+
+#if PHP_RAPHF_DEBUG_PHANDLES
+       fprintf(stderr, "ABANDON: %p\n", a->provider);
+#endif
+
+       zend_string_release(a->ident);
+       memset(a, 0, sizeof(*a));
+       if (f) {
+               efree(a);
+       }
+}
+
+void *php_persistent_handle_acquire(php_persistent_handle_factory_t *a, void *init_arg)
+{
+       int key;
+       zval *p;
+       zend_ulong index;
+       void *handle = NULL;
+       php_persistent_handle_list_t *list;
+
+       list = php_persistent_handle_list_find(a->provider, a->ident);
+       if (list) {
+               zend_hash_internal_pointer_end(&list->free);
+               key = zend_hash_get_current_key(&list->free, NULL, &index);
+               p = zend_hash_get_current_data(&list->free);
+               if (p && HASH_KEY_NON_EXISTENT != key) {
+                       handle = Z_PTR_P(p);
+                       if (a->wakeup) {
+                               a->wakeup(a, &handle);
+                       }
+                       zend_hash_index_del(&list->free, index);
+               } else {
+                       handle = php_resource_factory_handle_ctor(&a->provider->rf, init_arg);
+               }
+#if PHP_RAPHF_DEBUG_PHANDLES
+               fprintf(stderr, "CREATED: %p\n", handle);
+#endif
+               if (handle) {
+                       ++a->provider->list.used;
+                       ++list->used;
+               }
+       }
+
+       return handle;
+}
+
+void *php_persistent_handle_accrete(php_persistent_handle_factory_t *a, void *handle)
+{
+       void *new_handle = NULL;
+       php_persistent_handle_list_t *list;
+
+       new_handle = php_resource_factory_handle_copy(&a->provider->rf, handle);
+       if (handle) {
+               list = php_persistent_handle_list_find(a->provider, a->ident);
+               if (list) {
+                       ++list->used;
+               }
+               ++a->provider->list.used;
+       }
+
+       return new_handle;
+}
+
+void php_persistent_handle_release(php_persistent_handle_factory_t *a, void *handle)
+{
+       php_persistent_handle_list_t *list;
+
+       list = php_persistent_handle_list_find(a->provider, a->ident);
+       if (list) {
+               if (a->provider->list.used >= PHP_RAPHF_G->persistent_handle.limit) {
+#if PHP_RAPHF_DEBUG_PHANDLES
+                       fprintf(stderr, "DESTROY: %p\n", handle);
+#endif
+                       php_resource_factory_handle_dtor(&a->provider->rf, handle);
+               } else {
+                       if (a->retire) {
+                               a->retire(a, &handle);
+                       }
+                       zend_hash_next_index_insert_ptr(&list->free, handle);
+               }
+
+               --a->provider->list.used;
+               --list->used;
+       }
+}
+
+void php_persistent_handle_cleanup(zend_string *name, zend_string *ident)
+{
+       php_persistent_handle_provider_t *provider;
+       php_persistent_handle_list_t *list;
+
+       if (name) {
+               zval *zprovider = zend_symtable_find(&PHP_RAPHF_G->persistent_handle.hash,
+                               name);
+
+               if (zprovider && (provider = Z_PTR_P(zprovider))) {
+                       if (ident) {
+                               list = php_persistent_handle_list_find(provider, ident);
+                               if (list) {
+                                       zend_hash_apply_with_argument(&list->free,
+                                                       php_persistent_handle_apply_cleanup_ex,
+                                                       &provider->rf);
+                               }
+                       } else {
+                               zend_hash_apply_with_argument(&provider->list.free,
+                                               php_persistent_handle_apply_cleanup,
+                                               &provider->rf);
+                       }
+               }
+       } else {
+               zend_hash_apply_with_arguments(
+                               &PHP_RAPHF_G->persistent_handle.hash,
+                               php_persistent_handle_apply_cleanup_all, 1, ident);
+       }
+}
+
+HashTable *php_persistent_handle_statall(HashTable *ht)
+{
+       if (zend_hash_num_elements(&PHP_RAPHF_G->persistent_handle.hash)) {
+               if (!ht) {
+                       ALLOC_HASHTABLE(ht);
+                       zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+               }
+               zend_hash_apply_with_arguments(
+                               &PHP_RAPHF_G->persistent_handle.hash,
+                               php_persistent_handle_apply_statall, 1, ht);
+       } else if (ht) {
+               ht = NULL;
+       }
+
+       return ht;
+}
+
+static php_resource_factory_ops_t php_persistent_handle_resource_factory_ops = {
+       (php_resource_factory_handle_ctor_t) php_persistent_handle_acquire,
+       (php_resource_factory_handle_copy_t) php_persistent_handle_accrete,
+       (php_resource_factory_handle_dtor_t) php_persistent_handle_release
+};
+
+php_resource_factory_ops_t *php_persistent_handle_get_resource_factory_ops(void)
+{
+       return &php_persistent_handle_resource_factory_ops;
+}
+
+ZEND_BEGIN_ARG_INFO_EX(ai_raphf_stat_persistent_handles, 0, 0, 0)
+ZEND_END_ARG_INFO();
+static PHP_FUNCTION(raphf_stat_persistent_handles)
+{
+       if (SUCCESS == zend_parse_parameters_none()) {
+               object_init(return_value);
+               if (php_persistent_handle_statall(HASH_OF(return_value))) {
+                       return;
+               }
+               zval_dtor(return_value);
+       }
+       RETURN_FALSE;
+}
+
+ZEND_BEGIN_ARG_INFO_EX(ai_raphf_clean_persistent_handles, 0, 0, 0)
+       ZEND_ARG_INFO(0, name)
+       ZEND_ARG_INFO(0, ident)
+ZEND_END_ARG_INFO();
+static PHP_FUNCTION(raphf_clean_persistent_handles)
+{
+       zend_string *name = NULL, *ident = NULL;
+
+       if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|S!S!", &name, &ident)) {
+               php_persistent_handle_cleanup(name, ident);
+       }
+}
+
+#if PHP_RAPHF_TEST
+#      include "php_raphf_test.c"
+#endif
+
+static const zend_function_entry raphf_functions[] = {
+       ZEND_NS_FENTRY("raphf", stat_persistent_handles,
+                       ZEND_FN(raphf_stat_persistent_handles),
+                       ai_raphf_stat_persistent_handles, 0)
+       ZEND_NS_FENTRY("raphf", clean_persistent_handles,
+                       ZEND_FN(raphf_clean_persistent_handles),
+                       ai_raphf_clean_persistent_handles, 0)
+#if PHP_RAPHF_TEST
+       ZEND_NS_FENTRY("raphf", provide, ZEND_FN(raphf_provide), NULL, 0)
+       ZEND_NS_FENTRY("raphf", conceal, ZEND_FN(raphf_conceal), NULL, 0)
+       ZEND_NS_FENTRY("raphf", concede, ZEND_FN(raphf_concede), NULL, 0)
+       ZEND_NS_FENTRY("raphf", dispute, ZEND_FN(raphf_dispute), NULL, 0)
+       ZEND_NS_FENTRY("raphf", handle_ctor, ZEND_FN(raphf_handle_ctor), NULL, 0)
+       ZEND_NS_FENTRY("raphf", handle_copy, ZEND_FN(raphf_handle_copy), NULL, 0)
+       ZEND_NS_FENTRY("raphf", handle_dtor, ZEND_FN(raphf_handle_dtor), NULL, 0)
+#endif
+       {0}
+};
+
+PHP_INI_BEGIN()
+       STD_PHP_INI_ENTRY("raphf.persistent_handle.limit", "-1", PHP_INI_SYSTEM,
+                       OnUpdateLong, persistent_handle.limit, zend_raphf_globals,
+                       raphf_globals)
+PHP_INI_END()
+
+static HashTable *php_persistent_handles_global_hash;
+
+static PHP_GINIT_FUNCTION(raphf)
+{
+       raphf_globals->persistent_handle.limit = -1;
+
+       zend_hash_init(&raphf_globals->persistent_handle.hash, 0, NULL,
+                       php_persistent_handle_hash_dtor, 1);
+       if (php_persistent_handles_global_hash) {
+               zend_hash_copy(&raphf_globals->persistent_handle.hash,
+                               php_persistent_handles_global_hash, NULL);
+       }
+}
+
+static PHP_GSHUTDOWN_FUNCTION(raphf)
+{
+       zend_hash_destroy(&raphf_globals->persistent_handle.hash);
+}
+
+PHP_MINIT_FUNCTION(raphf)
+{
+       php_persistent_handles_global_hash = &PHP_RAPHF_G->persistent_handle.hash;
+
+#if PHP_RAPHF_TEST
+       PHP_MINIT(raphf_test)(INIT_FUNC_ARGS_PASSTHRU);
+#endif
+
+       REGISTER_INI_ENTRIES();
+       return SUCCESS;
+}
+
+PHP_MSHUTDOWN_FUNCTION(raphf)
+{
+#if PHP_RAPHF_TEST
+       PHP_MSHUTDOWN(raphf_test)(SHUTDOWN_FUNC_ARGS_PASSTHRU);
+#endif
+
+       UNREGISTER_INI_ENTRIES();
+       php_persistent_handles_global_hash = NULL;
+       return SUCCESS;
+}
+
+static int php_persistent_handle_apply_info_ex(zval *p, int argc,
+               va_list argv, zend_hash_key *key)
+{
+       php_persistent_handle_list_t *list = Z_PTR_P(p);
+       zend_hash_key *super_key = va_arg(argv, zend_hash_key *);
+       char used[21], free[21];
+
+       slprintf(used, sizeof(used), "%u", list->used);
+       slprintf(free, sizeof(free), "%d", zend_hash_num_elements(&list->free));
+
+       php_info_print_table_row(4, super_key->key->val, key->key->val, used, free);
+
+       return ZEND_HASH_APPLY_KEEP;
+}
+
+static int php_persistent_handle_apply_info(zval *p, int argc,
+               va_list argv, zend_hash_key *key)
+{
+       php_persistent_handle_provider_t *provider = Z_PTR_P(p);
+
+       zend_hash_apply_with_arguments(&provider->list.free,
+                       php_persistent_handle_apply_info_ex, 1, key);
+
+       return ZEND_HASH_APPLY_KEEP;
+}
+
+PHP_MINFO_FUNCTION(raphf)
+{
+       php_info_print_table_start();
+       php_info_print_table_header(2,
+                       "Resource and persistent handle factory support", "enabled");
+       php_info_print_table_row(2, "Extension version", PHP_RAPHF_VERSION);
+       php_info_print_table_end();
+
+       php_info_print_table_start();
+       php_info_print_table_colspan_header(4, "Persistent handles in this "
+#ifdef ZTS
+                       "thread"
+#else
+                       "process"
+#endif
+       );
+       php_info_print_table_header(4, "Provider", "Ident", "Used", "Free");
+       zend_hash_apply_with_arguments(
+                       &PHP_RAPHF_G->persistent_handle.hash,
+                       php_persistent_handle_apply_info, 0);
+       php_info_print_table_end();
+
+       DISPLAY_INI_ENTRIES();
+}
+
+zend_module_entry raphf_module_entry = {
+       STANDARD_MODULE_HEADER,
+       "raphf",
+       raphf_functions,
+       PHP_MINIT(raphf),
+       PHP_MSHUTDOWN(raphf),
+       NULL,
+       NULL,
+       PHP_MINFO(raphf),
+       PHP_RAPHF_VERSION,
+       ZEND_MODULE_GLOBALS(raphf),
+       PHP_GINIT(raphf),
+       PHP_GSHUTDOWN(raphf),
+       NULL,
+       STANDARD_MODULE_PROPERTIES_EX
+};
+/* }}} */
+
+#ifdef COMPILE_DL_RAPHF
+ZEND_GET_MODULE(raphf)
+#endif
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+/*
+    +--------------------------------------------------------------------+
+    | PECL :: raphf                                                      |
+    +--------------------------------------------------------------------+
+    | Redistribution and use in source and binary forms, with or without |
+    | modification, are permitted provided that the conditions mentioned |
+    | in the accompanying LICENSE file are met.                          |
+    +--------------------------------------------------------------------+
+    | Copyright (c) 2013, Michael Wallner <mike@php.net>                 |
+    +--------------------------------------------------------------------+
+*/
+
+#ifndef PHP_RAPHF_H
+#define PHP_RAPHF_H
+
+extern zend_module_entry raphf_module_entry;
+#define phpext_raphf_ptr &raphf_module_entry
+
+#define PHP_RAPHF_VERSION "2.0.0dev"
+
+#ifdef PHP_WIN32
+#      define PHP_RAPHF_API __declspec(dllexport)
+#elif defined(__GNUC__) && __GNUC__ >= 4
+#      define PHP_RAPHF_API extern __attribute__ ((visibility("default")))
+#else
+#      define PHP_RAPHF_API extern
+#endif
+
+#ifdef ZTS
+#      include "TSRM.h"
+#endif
+
+#include "php_raphf_api.h"
+
+#endif /* PHP_RAPHF_H */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+/*
+    +--------------------------------------------------------------------+
+    | PECL :: raphf                                                      |
+    +--------------------------------------------------------------------+
+    | Redistribution and use in source and binary forms, with or without |
+    | modification, are permitted provided that the conditions mentioned |
+    | in the accompanying LICENSE file are met.                          |
+    +--------------------------------------------------------------------+
+    | Copyright (c) 2013, Michael Wallner <mike@php.net>                 |
+    +--------------------------------------------------------------------+
+*/
+
+#ifndef PHP_RAPHF_API_H
+#define PHP_RAPHF_API_H
+
+#include "php_raphf.h"
+
+/**
+ * A resource constructor.
+ *
+ * @param opaque is the \a data from php_persistent_handle_provide()
+ * @param init_arg is the \a init_arg from php_resource_factory_init()
+ * @return the created (persistent) handle
+ */
+typedef void *(*php_resource_factory_handle_ctor_t)(void *opaque, void *init_arg);
+
+/**
+ * The copy constructor of a resource.
+ *
+ * @param opaque the factory's data
+ * @param handle the (persistent) handle to copy
+ */
+typedef void *(*php_resource_factory_handle_copy_t)(void *opaque, void *handle);
+
+/**
+ * The destructor of a resource.
+ *
+ * @param opaque the factory's data
+ * @param handle the handle to destroy
+ */
+typedef void (*php_resource_factory_handle_dtor_t)(void *opaque, void *handle);
+
+/**
+ * The resource ops consisting of a ctor, a copy ctor and a dtor.
+ *
+ * Define this ops and register them with php_persistent_handle_provide()
+ * in MINIT.
+ */
+typedef struct php_resource_factory_ops {
+       /** The resource constructor */
+       php_resource_factory_handle_ctor_t ctor;
+       /** The resource's copy constructor */
+       php_resource_factory_handle_copy_t copy;
+       /** The resource's destructor */
+       php_resource_factory_handle_dtor_t dtor;
+} php_resource_factory_ops_t;
+
+/**
+ * The resource factory.
+ */
+typedef struct php_resource_factory {
+       /** The resource ops */
+       php_resource_factory_ops_t fops;
+       /** Opaque user data */
+       void *data;
+       /** User data destructor */
+       void (*dtor)(void *data);
+       /** How often this factory is referenced */
+       unsigned refcount;
+} php_resource_factory_t;
+
+/**
+ * Initialize a resource factory.
+ *
+ * If you register a \a dtor for a resource factory used with a persistent
+ * handle provider, be sure to call php_persistent_handle_cleanup() for your
+ * registered provider in MSHUTDOWN, else the dtor will point to no longer
+ * available memory if the extension has already been unloaded.
+ *
+ * @param f the factory to initialize; if NULL allocated on the heap
+ * @param fops the resource ops to assign to the factory
+ * @param data opaque user data; may be NULL
+ * @param dtor a destructor for the data; may be NULL
+ * @return \a f or an allocated resource factory
+ */
+PHP_RAPHF_API php_resource_factory_t *php_resource_factory_init(
+               php_resource_factory_t *f, php_resource_factory_ops_t *fops, void *data,
+               void (*dtor)(void *data));
+
+/**
+ * Increase the refcount of the resource factory.
+ *
+ * @param rf the resource factory
+ * @return the new refcount
+ */
+PHP_RAPHF_API unsigned php_resource_factory_addref(php_resource_factory_t *rf);
+
+/**
+ * Destroy the resource factory.
+ *
+ * If the factory's refcount reaches 0, the \a dtor for \a data is called.
+ *
+ * @param f the resource factory
+ */
+PHP_RAPHF_API void php_resource_factory_dtor(php_resource_factory_t *f);
+
+/**
+ * Destroy and free the resource factory.
+ *
+ * Calls php_resource_factory_dtor() and frees \a f if the factory's refcount
+ * reached 0.
+ *
+ * @param f the resource factory
+ */
+PHP_RAPHF_API void php_resource_factory_free(php_resource_factory_t **f);
+
+/**
+ * Construct a resource by the resource factory \a f
+ *
+ * @param f the resource factory
+ * @param init_arg for the resource constructor
+ * @return the new resource
+ */
+PHP_RAPHF_API void *php_resource_factory_handle_ctor(php_resource_factory_t *f,
+               void *init_arg);
+
+/**
+ * Create a copy of the resource \a handle
+ *
+ * @param f the resource factory
+ * @param handle the resource to copy
+ * @return the copy
+ */
+PHP_RAPHF_API void *php_resource_factory_handle_copy(php_resource_factory_t *f,
+               void *handle);
+
+/**
+ * Destroy (and free) the resource
+ *
+ * @param f the resource factory
+ * @param handle the resource to destroy
+ */
+PHP_RAPHF_API void php_resource_factory_handle_dtor(php_resource_factory_t *f,
+               void *handle);
+
+/**
+ * Persistent handles storage
+ */
+typedef struct php_persistent_handle_list {
+       /** Storage of free resources */
+       HashTable free;
+       /** Count of acquired resources */
+       ulong used;
+} php_persistent_handle_list_t;
+
+/**
+ * Definition of a persistent handle provider.
+ * Holds a resource factory an a persistent handle list.
+ */
+typedef struct php_persistent_handle_provider {
+        /**
+         * The list of free handles.
+         * Hash of "ident" => array(handles) entries. Persistent handles are
+         * acquired out of this list.
+         */
+       php_persistent_handle_list_t list;
+
+       /**
+        * The resource factory.
+        * New handles are created by this factory.
+        */
+       php_resource_factory_t rf;
+} php_persistent_handle_provider_t;
+
+typedef struct php_persistent_handle_factory php_persistent_handle_factory_t;
+
+/**
+ * Wakeup the persistent handle on re-acquisition.
+ */
+typedef void (*php_persistent_handle_wakeup_t)(
+               php_persistent_handle_factory_t *f, void **handle);
+/**
+ * Retire the persistent handle on release.
+ */
+typedef void (*php_persistent_handle_retire_t)(
+               php_persistent_handle_factory_t *f, void **handle);
+
+/**
+ * Definition of a persistent handle factory.
+ *
+ * php_persistent_handle_concede() will return a pointer to a
+ * php_persistent_handle_factory if a provider for the \a name has
+ * been registered with php_persistent_handle_provide().
+ */
+struct php_persistent_handle_factory {
+       /** The persistent handle provider */
+       php_persistent_handle_provider_t *provider;
+       /** The persistent handle wakeup routine; may be NULL */
+       php_persistent_handle_wakeup_t wakeup;
+       /** The persistent handle retire routine; may be NULL */
+       php_persistent_handle_retire_t retire;
+
+       /** The ident for which this factory manages resources */
+       zend_string *ident;
+
+       /** Whether it has to be free'd on php_persistent_handle_abandon() */
+       unsigned free_on_abandon:1;
+};
+
+/**
+ * Register a persistent handle provider in MINIT.
+ *
+ * Registers a factory provider for \a name_str with \a fops resource factory
+ * ops. Call this in your MINIT.
+ *
+ * A php_resource_factory will be created with \a fops, \a data and \a dtor
+ * and will be stored together with a php_persistent_handle_list in the global
+ * raphf hash.
+ *
+ * A php_persistent_handle_factory can then be retrieved by
+ * php_persistent_handle_concede() at runtime.
+ *
+ * @param name the provider name, e.g. "http\Client\Curl"
+ * @param fops the resource factory ops
+ * @param data opaque user data
+ * @param dtor \a data destructor
+ * @return SUCCESS/FAILURE
+ */
+PHP_RAPHF_API ZEND_RESULT_CODE php_persistent_handle_provide(
+               zend_string *name, php_resource_factory_ops_t *fops,
+               void *data, void (*dtor)(void *));
+
+/**
+ * Retrieve a persistent handle factory at runtime.
+ *
+ * If a persistent handle provider has been registered for \a name, a new
+ * php_persistent_handle_factory creating resources in the \a ident
+ * namespace will be constructed.
+ *
+ * The wakeup routine \a wakeup and the retire routine \a retire will be
+ * assigned to the new php_persistent_handle_factory.
+ *
+ * @param a pointer to a factory; allocated on the heap if NULL
+ * @param name the provider name, e.g. "http\Client\Curl"
+ * @param ident the subsidiary namespace, e.g. "php.net:80"
+ * @param wakeup any persistent handle wakeup routine
+ * @param retire any persistent handle retire routine
+ * @return \a a or an allocated persistent handle factory
+ */
+PHP_RAPHF_API php_persistent_handle_factory_t *php_persistent_handle_concede(
+               php_persistent_handle_factory_t *a,
+               zend_string *name, zend_string *ident,
+               php_persistent_handle_wakeup_t wakeup,
+               php_persistent_handle_retire_t retire);
+
+/**
+ * Abandon the persistent handle factory.
+ *
+ * Destroy a php_persistent_handle_factory created by
+ * php_persistent_handle_concede(). If the memory for the factory was allocated,
+ * it will automatically be free'd.
+ *
+ * @param a the persistent handle factory to destroy
+ */
+PHP_RAPHF_API void php_persistent_handle_abandon(
+               php_persistent_handle_factory_t *a);
+
+/**
+ * Acquire a persistent handle.
+ *
+ * That is, either re-use a resource from the free list or create a new handle.
+ *
+ * If a handle is acquired from the free list, the
+ * php_persistent_handle_factory::wakeup callback will be executed for that
+ * handle.
+ *
+ * @param a the persistent handle factory
+ * @param init_arg the \a init_arg for php_resource_factory_handle_ctor()
+ * @return the acquired resource
+ */
+PHP_RAPHF_API void *php_persistent_handle_acquire(
+               php_persistent_handle_factory_t *a, void *init_arg);
+
+/**
+ * Release a persistent handle.
+ *
+ * That is, either put it back into the free list for later re-use or clean it
+ * up with php_resource_factory_handle_dtor().
+ *
+ * If a handle is put back into the free list, the
+ * php_persistent_handle_factory::retire callback will be executed for that
+ * handle.
+ *
+ * @param a the persistent handle factory
+ * @param handle the handle to release
+ */
+PHP_RAPHF_API void php_persistent_handle_release(
+               php_persistent_handle_factory_t *a, void *handle);
+
+/**
+ * Copy a persistent handle.
+ *
+ * Let the underlying resource factory copy the \a handle.
+ *
+ * @param a the persistent handle factory
+ * @param handle the resource to accrete
+ */
+PHP_RAPHF_API void *php_persistent_handle_accrete(
+               php_persistent_handle_factory_t *a, void *handle);
+
+/**
+ * Retrieve persistent handle resource factory ops.
+ *
+ * These ops can be used to mask a persistent handle factory as
+ * resource factory itself, so you can transparently use the
+ * resource factory API, both for persistent and non-persistent
+ * ressources.
+ *
+ * Example:
+ * ~~~~~~~~~~~~~~~{.c}
+ * php_resource_factory_t *create_my_rf(zend_string *persistent_id)
+ * {
+ *     php_resource_factory_t *rf;
+ *
+ *     if (persistent_id) {
+ *         php_persistent_handle_factory_t *pf;
+ *         php_resource_factory_ops_t *ops;
+ *         zend_string *ns = zend_string_init("my", 2, 1);
+ *
+ *         ops = php_persistent_handle_get_resource_factory_ops();
+ *         pf = php_persistent_handle_concede(NULL, ns, persistent_id, NULL, NULL);
+ *         rf = php_persistent_handle_resource_factory_init(NULL, pf);
+ *         zend_string_release(ns);
+ *     } else {
+ *         rf = php_resource_factory_init(NULL, &myops, NULL, NULL);
+ *     }
+ *     return rf;
+ * }
+ * ~~~~~~~~~~~~~~~
+ */
+PHP_RAPHF_API php_resource_factory_ops_t *
+php_persistent_handle_get_resource_factory_ops(void);
+
+/**
+ * Create a resource factory for persistent handles.
+ *
+ * This will create a resource factory with persistent handle ops, which wraps
+ * the provided reource factory \a pf.
+ *
+ * @param a the persistent handle resource factory to initialize
+ * @param pf the resource factory to wrap
+ */
+PHP_RAPHF_API php_resource_factory_t *
+php_persistent_handle_resource_factory_init(php_resource_factory_t *a,
+               php_persistent_handle_factory_t *pf);
+
+/**
+ * Check whether a resource factory is a persistent handle resource factory.
+ *
+ * @param a the resource factory to check
+ */
+PHP_RAPHF_API zend_bool php_resource_factory_is_persistent(
+               php_resource_factory_t *a);
+
+/**
+ * Clean persistent handles up.
+ *
+ * Destroy persistent handles of provider \a name and in subsidiary
+ * namespace \a ident.
+ *
+ * If \a name is NULL, all persistent handles of all providers with a
+ * matching \a ident will be cleaned up.
+ *
+ * If \a identr is NULL all persistent handles of the provider will be
+ * cleaned up.
+ *
+ * Ergo, if both, \a name and \a ident are NULL, then all
+ * persistent handles will be cleaned up.
+ *
+ * You must call this in MSHUTDOWN, if your resource factory ops hold a
+ * registered php_resource_factory::dtor, else the dtor will point to
+ * memory not any more available if the extension has already been unloaded.
+ *
+ * @param name the provider name; may be NULL
+ * @param ident the subsidiary namespace name; may be NULL
+ */
+PHP_RAPHF_API void php_persistent_handle_cleanup(zend_string *name,
+               zend_string *ident);
+
+/**
+ * Retrieve statistics about the current process/thread's persistent handles.
+ *
+ * @return a HashTable like:
+ * ~~~~~~~~~~~~~~~
+ *     [
+ *         "name" => [
+ *             "ident" => [
+ *                 "used" => 1,
+ *                 "free" => 0,
+ *             ]
+ *         ]
+ *     ]
+ * ~~~~~~~~~~~~~~~
+ */
+PHP_RAPHF_API HashTable *php_persistent_handle_statall(HashTable *ht);
+
+#endif /* PHP_RAPHF_API_H */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+/*
+    +--------------------------------------------------------------------+
+    | PECL :: raphf                                                      |
+    +--------------------------------------------------------------------+
+    | Redistribution and use in source and binary forms, with or without |
+    | modification, are permitted provided that the conditions mentioned |
+    | in the accompanying LICENSE file are met.                          |
+    +--------------------------------------------------------------------+
+    | Copyright (c) 2014, Michael Wallner <mike@php.net>                 |
+    +--------------------------------------------------------------------+
+*/
+
+#include <php.h>
+
+struct user_cb {
+       zend_fcall_info fci;
+       zend_fcall_info_cache fcc;
+};
+
+struct raphf_user {
+       struct user_cb ctor;
+       struct user_cb copy;
+       struct user_cb dtor;
+       struct {
+               struct user_cb dtor;
+               zval data;
+       } data;
+};
+
+static inline void user_cb_addref(struct user_cb *cb)
+{
+       Z_ADDREF(cb->fci.function_name);
+       if (cb->fci.object) {
+               Z_ADDREF_P((zval *) cb->fci.object);
+       }
+}
+
+static inline void user_cb_delref(struct user_cb *cb)
+{
+       if (cb->fci.object) {
+               Z_DELREF_P((zval *) cb->fci.object);
+       }
+}
+
+static void raphf_user_dtor(void *opaque)
+{
+       struct raphf_user *ru = opaque;
+
+       zend_fcall_info_argn(&ru->data.dtor.fci, 1, &ru->data.data);
+       zend_fcall_info_call(&ru->data.dtor.fci, &ru->data.dtor.fcc, NULL, NULL);
+       zend_fcall_info_args_clear(&ru->data.dtor.fci, 1);
+       user_cb_delref(&ru->data.dtor);
+       zend_fcall_info_args_clear(&ru->ctor.fci, 1);
+       user_cb_delref(&ru->ctor);
+       zend_fcall_info_args_clear(&ru->copy.fci, 1);
+       user_cb_delref(&ru->copy);
+       zend_fcall_info_args_clear(&ru->dtor.fci, 1);
+       user_cb_delref(&ru->dtor);
+       memset(ru, 0, sizeof(*ru));
+       efree(ru);
+}
+
+static void *user_ctor(void *opaque, void *init_arg TSRMLS_DC)
+{
+       struct raphf_user *ru = opaque;
+       zval *zinit_arg = init_arg, *retval = ecalloc(1, sizeof(*retval));
+
+       zend_fcall_info_argn(&ru->ctor.fci, 2, &ru->data.data, zinit_arg);
+       zend_fcall_info_call(&ru->ctor.fci, &ru->ctor.fcc, retval, NULL);
+       zend_fcall_info_args_clear(&ru->ctor.fci, 0);
+
+       return retval;
+}
+
+static void *user_copy(void *opaque, void *handle TSRMLS_DC)
+{
+       struct raphf_user *ru = opaque;
+       zval *zhandle = handle, *retval = ecalloc(1, sizeof(*retval));
+
+       zend_fcall_info_argn(&ru->copy.fci, 2, &ru->data.data, zhandle);
+       zend_fcall_info_call(&ru->copy.fci, &ru->copy.fcc, retval, NULL);
+       zend_fcall_info_args_clear(&ru->copy.fci, 0);
+
+       return retval;
+}
+
+static void user_dtor(void *opaque, void *handle TSRMLS_DC)
+{
+       struct raphf_user *ru = opaque;
+       zval *zhandle = handle, retval;
+
+       ZVAL_UNDEF(&retval);
+       zend_fcall_info_argn(&ru->dtor.fci, 2, &ru->data.data, zhandle);
+       zend_fcall_info_call(&ru->dtor.fci, &ru->dtor.fcc, &retval, NULL);
+       zend_fcall_info_args_clear(&ru->dtor.fci, 0);
+       if (!Z_ISUNDEF(retval)) {
+               zval_ptr_dtor(&retval);
+       }
+}
+
+static php_resource_factory_ops_t user_ops = {
+               user_ctor,
+               user_copy,
+               user_dtor
+};
+
+static int raphf_user_le;
+
+static void raphf_user_res_dtor(zend_resource *res TSRMLS_DC)
+{
+       php_resource_factory_free((void *) &res->ptr);
+}
+
+static PHP_FUNCTION(raphf_provide)
+{
+       struct raphf_user *ru;
+       char *name_str;
+       size_t name_len;
+       zval *zdata;
+
+       ru = ecalloc(1, sizeof(*ru));
+
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sfffzf",
+                       &name_str, &name_len,
+                       &ru->ctor.fci, &ru->ctor.fcc,
+                       &ru->copy.fci, &ru->copy.fcc,
+                       &ru->dtor.fci, &ru->dtor.fcc,
+                       &zdata,
+                       &ru->data.dtor.fci, &ru->data.dtor.fcc)) {
+               efree(ru);
+               return;
+       }
+
+       user_cb_addref(&ru->ctor);
+       user_cb_addref(&ru->copy);
+       user_cb_addref(&ru->dtor);
+       user_cb_addref(&ru->data.dtor);
+
+       ZVAL_COPY(&ru->data.data, zdata);
+
+       if (SUCCESS != php_persistent_handle_provide(name_str, name_len,
+                       &user_ops, ru, raphf_user_dtor)) {
+               RETURN_FALSE;
+       }
+       RETURN_TRUE;
+}
+
+static PHP_FUNCTION(raphf_conceal)
+{
+       zend_string *name;
+
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &name)) {
+               return;
+       }
+
+       RETURN_BOOL(FAILURE != zend_hash_del(&PHP_RAPHF_G->persistent_handle.hash, name));
+}
+
+static PHP_FUNCTION(raphf_concede)
+{
+       char *name_str, *id_str;
+       size_t name_len, id_len;
+       php_persistent_handle_factory_t *pf;
+       php_resource_factory_t *rf;
+       php_resource_factory_ops_t *ops;
+
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss",
+                       &name_str, &name_len, &id_str, &id_len)) {
+               return;
+       }
+
+       ops = php_persistent_handle_get_resource_factory_ops();
+       pf = php_persistent_handle_concede(NULL, name_str, name_len, id_str, id_len,
+                       NULL, NULL TSRMLS_CC);
+       if (!pf) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               "Could not locate persistent handle factory '%s'", name_str);
+               RETURN_FALSE;
+       }
+       rf = php_resource_factory_init(NULL, ops, pf,
+                       (void(*)(void*)) php_persistent_handle_abandon);
+       if (!rf) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING,
+                               "Could not create resource factory "
+                               "for persistent handle factory '%s'", name_str);
+               RETURN_FALSE;
+       }
+
+       zend_register_resource(return_value, rf, raphf_user_le);
+}
+
+static PHP_FUNCTION(raphf_dispute)
+{
+       zval *zrf;
+
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zrf)) {
+               return;
+       }
+
+       RETURN_BOOL(SUCCESS == zend_list_close(Z_RES_P(zrf)));
+}
+
+static PHP_FUNCTION(raphf_handle_ctor)
+{
+       zval *zrf, *zrv, *zinit_arg;
+
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz",
+                       &zrf, &zinit_arg)) {
+               return;
+       }
+
+       zrv = php_resource_factory_handle_ctor(Z_RES_VAL_P(zrf), zinit_arg);
+       RETVAL_ZVAL(zrv, 0, 0);
+       efree(zrv);
+}
+
+static PHP_FUNCTION(raphf_handle_copy)
+{
+       zval *zrf, *zrv, *zhandle;
+
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz",
+                       &zrf, &zhandle)) {
+               return;
+       }
+
+       zrv = php_resource_factory_handle_copy(Z_RES_VAL_P(zrf), zhandle);
+       RETVAL_ZVAL(zrv, 0, 0);
+       efree(zrv);
+}
+
+static PHP_FUNCTION(raphf_handle_dtor)
+{
+       zval *zrf, *zhandle;
+
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz",
+                       &zrf, &zhandle)) {
+               return;
+       }
+
+       php_resource_factory_handle_dtor(Z_RES_VAL_P(zrf), zhandle);
+}
+
+static PHP_MINIT_FUNCTION(raphf_test)
+{
+       zend_register_long_constant(ZEND_STRL("RAPHF_TEST"), PHP_RAPHF_TEST, CONST_CS|CONST_PERSISTENT, module_number);
+       raphf_user_le = zend_register_list_destructors_ex(raphf_user_res_dtor, NULL,
+                       "raphf_user", module_number);
+       return SUCCESS;
+}
+
+static PHP_MSHUTDOWN_FUNCTION(raphf_test)
+{
+       php_persistent_handle_cleanup(ZEND_STRL("test"), NULL, 0 TSRMLS_CC);
+       return SUCCESS;
+}
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
+\89PNG\r
+\1a
+\0\0\0\rIHDR\0\0\0Ù\0\0\0l\b\ 6\0\0\0ç¹\17°\0\0\0\ 4gAMA\0\0±\8f\vüa\ 5\0\0\0\ 6bKGD\0\0\0\0\0\0ùC»\7f\0\0\0 pHYs\0\0\v\13\0\0\v\13\ 1\0\9a\9c\18\0\0\0\atIME\aÝ\f\ 4\b\10'É=)\85\0\0 \0IDATxÚì½G\8fÜùu5|*ç\9csWçfhr\98&hFÒ(YòH\90 Ë\ 6\1c\0ÛðÆ6¼´\97\ 6¸ñ\að'0\fm´²$À0\ 4\aÙ3\8f$\12\138$;\87ê®\9csÎõ.Fç¢z,ùµ¤ç}\17\ 4k£Ñ\f\7f\7fáÞsÏ9Wñ\ fÿð\ f\8bÉd\ 2¯×\8b\ 2½^\ f\9dN\87\9eÉ?\ f\87CÌf3,\16\vôû}¨Õj4\1a\r¼öÚkP©TÈd2è÷ûX,\16°Ûí8<<Äîî.ªÕ*>÷¹Ïáää\ 4\83Á\0\9dN\a\15+++°X,8;;C¹\\86ÛíÆh4Ât:E§Ó\81ÅbA¯×Ãöö64\1a\r\9e={\ 6§Ó  »Ý\ e\0H§Óp:\9d0\9bÍè÷û\0 \9f\v\0­V\vÝn\177nÜÀ|>\87Ëå\82F£A6\9b\85Ãá\80ÇãA©TÂùù9VVV0\9fϱ²²\82|>\8fx<\8e\81~¿\8fñx\8cñx\8c\9b7oâää\ 4*\95
+'''hµZxóÍ71\9fÏ\11\ e\87¡R©Ðjµ\90ÉdÐn·\11\8fÇ1\1e\8f1\9dNáv»Q©Tðüùs\f\87Cܺu\v\13Ï\9e=\83ÉdB,\16Ã`0\80R©ÄÖÖ\16
+\85\ 2^ÆãÅ\8a\87ê\8d7ÞxØét R©p||\8c\8bH$\ 2\8dF\83`0\88Ñh\84\ 1\9dN\87Ñh\ 4\0\18\8fÇðûý\18\ e\87¸¸¸\80\81Åb\81ÕjE¥RA(\14Âb±\80ÃáÀ³gÏ°X, Õj¡Õj¡Óé`4\1aQ­V¡Ñh P(Ðjµ0\1e\8f¡ÓéÐjµ`·Ûáóù T*Ñn·a0\18`2\99 T*¡P(0\1e\8f\11\b\ 4P«Õ`2\99\10\89D`6\9b\11\f\ 6Ñl61\9bÍpÿþ}\8cÇc\94ËeD"\11(\14
+L§S¬®®¢×ëa2\99\0\0æó9ö÷÷Ñn·±³³\83Ùl\86
+\8bÅ\ 2\97Ë\85x<\8eóós\f\87Clooc8\1c¢\.c>\9f\ 3\0Ün7l6\e:\9d\ et:\1d,\16\vNNNÐh4àt:±X, R©\0\0>\9f\ f\1e*\95
+\1e\8f\a\9dN\aív\eÑh\14Óé\14Íf\13õz\1d/ãñbÅCõÎ;ï<ôx<¸¸¸Àl6\83Á`Àb±\80ÕjE£Ñ\80Á`Àh4\82Çã\81ÃáÀp8\84Éd\82ÅbA2\99\84Íf\83ÍfC³ÙD£ÑÀh4B$\12\81ÍfC»Ý\86^¯G³ÙD:\9dF$\12\81J¥Âh4B»ÝF¯×\83\80Á`@¯×\83\86ßïÇx<\96\80\9aL&x<\1e        \82×ë\95\93\10\0´Z-ìv;Úí6jµ\1a\1eÌf3¦Ó)4\1a\ræó9L&\13\86Ã!b±\18Òé´üÎ^¯\87t:\8d\9d\9d\1d\98Íf¼ÿþûP(\14¸~ý:\86Ã!ªÕ*úý>ìv;¦Ó)\12\89\ 4\16\8b\ 5nÞ¼ ¯×\v\9dN\87L&\83\ 6\9bÍ\86\95\95\15Yl*\95
+\9dN\a\8dF\ 3\17\83Á\0³Ù\f\1d\15Ýn\17­V\v\91H\ 4ãñ\18Éd\12ív\e6\9b\r/ãñbÅCõÕ¯~õa>\9f\87Ãá\80Éd\92Sp4\1aáÃ\ f?Ä`0ÀÍ\9b7Q«ÕP(\14°¹¹        \8dF\83\8b\ 3\8dF\83Åb\ 1\8bÅ\82áp\b\8fÇ\83Ñh\84ããc\f\87Ch4\1aøý~(\14
+\98Íf,\16\v\8cÇc\1c\1c\1cÀjµB£ÑÀl6Ãn·C­V\ 3\0L&\13\0@§Óa±X`8\1cb4\1aA¡P@­VC¯×C«ÕÂb±Àãñ ßïc:\9dÊ"Ðëõ\98ÏçrÂL&\13èõzôû}8\1c\ e\0Àh4\82Á`@(\14\92ÓÐjµ¢^¯Ãáp`±XÈ{6\9bMìììÀåra:\9dÊßU©TÐëõ\98\98L&øè£\8fàñxàñx`µZ\91J¥`³Ù\90Íf¡Ñh ×ëáp8ptt\84\.\a£Ñ\88`0\b³Ù\8cD"\81`0\b¥R\89\97ñx±â¡úÂ\17¾ðp}}\1d¥R       \ 6\83Av`«Õ\82Çã\81Óé\84R©Äb±\80ÍfÃb±@µZ\85\80ÏçC­VÃ|>\87\87Éd\82V«E³ÙD¿ßG·Û\85Á`\80ÝnÇÎÎ\ e\9aÍ&\ 6\83\ 1ªÕ*¬V+ü~?F£\11l6\9b\9c\bÍf\13*\95
+F£\11\8bÅ\ 2³Ù\fÍf\13óù\1cF£QN\ f¦*Óé\14\1e\8fG>3\97ËÁ`0 V«Ál6C­V\7fòCU*L&\13(\95J(\95Jx<\1e¨Õj(\95JÌçs8\1c\ eܺu\v\16\1a\16\12\1aý~\1f:\9d\ eõz\1d\17óù\1c\9dN\a\95J\ 5\17ñx\1c\17\17\17rºµÛm\ 4\ 2\ 18\9dNèõz\8cF#Ìçslll\0\0\ 6\83\ 1ºÝ.l6\eêõ:\8aÅ"\1e<x\80ñx\8cÁ`\80\97ñx±â¡úæ7¿ù0\91H ×ëA§Ó¡Z­âðð\10\16\8b\ 5\17\1a\8d\ 6ý~\1f\1a\8d\ 6Óé\14\12\95JEN\ e\9bÍ\86Éd\ 2«Õ
+µZ\8dÅb!?Øãñ \1a\8d\ 2\0NOO%Hãñ\18f³Yþût:E:\9dF«Õ\82Ñh\84Ñh\84J¥B©T\82Z­Æêê*4\1a\r\ 6\83\ 1Æã1\16\8b\85\9cªÅb\11\15Åb\11F£Q¾ïl6\93\93P£ÑÀn·Ëb©Õjp»Ýèv»\9fäÌ*\15\1eT*\15L&\13T*\15\86á,T\87Ã\81L&#Å3\08\1c\ e\18\8dFôz=\9c\9e\9ebkk\v\00\1c\ eÑl6Ñét T*át:aµZáp8`³Ùp~~\ e½^\8f·Þz\v¥R  ³Ù\fN§SN\7f\9dN\87\97ñx±â¡øû¿ÿûÅb±@»ÝÆl6\93\87±X,°X,P(\14\10\ e\87aµZQ*\95 T*a2\99Ðn·qíÚ5\14
+\ 54\9bMX­V)>Õj5¬V+\94J%\1a\8d\ 6Òé4NNNðꫯB©TÂívK:\92Ïç¥\88n·ÛÐét\98Ïç¨×ë\0 é\8eÏçC£Ñ\80Ýn\87Ñh\94\87Ì\82<\9fÏc:\9dB­Vc8\1cÂív£V«Áëõb8\1cb±X@­VË\8fÏçó\18\8fÇp»ÝÐëõ¨×ë0\99L°Ùl\18\ e\87¨×ëðûýh6\9bèv»\88ÅbH$\12r"\12`p8\1c\82zõû}\ 4\83A¨T*är9\ 1\17\10\16\86Ã!æó¹<k\93É\84Ñh$)\9e^¯G»ÝÆËx¼XñP}ñ\8b_|xqq\81\8e`0\88µµ5\98L&Ôëuär9¸ÝnÌf3(\14
+x<\1eT*\15Ìçs¨T*,\16\v\f\ 6\ 3(\14
+Ìçs,\16\v4\9bM8\9dN¨T*\14
+\ 5\94ËeØl6¬­­a±XHQX«Õ\90Ïçå\ 4dJ0\9bÍ R© Óé P(Ðl6\ 5\ 6f\81Ê\13Z¡P \97Ë   BÖn·\ 1\0\11\93É\ 4áp\18Ýn\17ù|\1e³Ù\f6\9b\rÕj\15\83Á\0\13\ 6\83\ 1
+\85B\16¢V«E·ÛÅx<\86ÉdÂ`0Àh4B§ÓA­VC8\1c\86\87ÕjÅp8D:\9d\86\83Çã\11X[§Ó  ¤íóù ÓéP(\14\90\11\f\ 6a·Û1\99L`³Ù0\1a\8d°²²\ 2µZ\8d\89\89Åb\81\97ñx±â¡òù|\ f\ 3\81\0\1c\ e\a\1a\f\ 6\ 3\12|>\1f,\16\v¢Ñ(\86Ã!\14
+\ 5.//a4\1a1\9dNaµZQ(\14°X,àr¹\ 4­\89ÇãÐjµ8::B£Ñ\90\13Á`0@£ÑH
+Ñív¡Óé T*%]á   ÂÜ»V«ÉÉ`4\1aQ¯×a4\1a\ 5\16&|<\9fÏ¥ðÖh4\18\ e\87èõzr\9aÙl6h4\1aY\18Óé\14&\93       \9dN\a\ e\87\ 3\1a\8dFÒ&ötôz=\ 2\81\0\9aͦ¤>\1e\8f\a\83Á\0¥R        óù\1c\ 6\83\ 1óù\1cÍf\13\1a\8dF\8az\87Ã\ 1\9fÏ\87\.\87\ 3\83Á\80[·n¡Ñh P(Àf³Áëõ"\16\8báìì\f\85BANü\83\83\ 3¼\8cÇ\8b\15\ fÕ\9fþé\9f>ÜÞÞ\86\86N§C³ÙÄt:E·Û\957è÷û\18\f\ 6è÷û(\95JP(\14è÷ûP*\95\b\87ÃP*\950\1a\8d°Ùl¸¼¼Äññ1ôz=|>\9fäÊ*\95
+J¥\12½^\ fý~\1fóù\1cN§S
+O\85B\81Á`\80Á`\0µZ-péÆÆ\86¼/¡`\85B\ 1\85B\ 1½^\ f\8bÅ\82J¥"¹;¿«ÝnG2\99Ä|>\87ÏçÃt:\95\93W«Õb2\99 ßï£ÕjA§Ó¡\.C§ÓIÏh4\1aÉo\0p¥À\1f\ e\87°X,èv»0\9bÍp8\1cò\9d\12\1aÖ××áõz\91N§%àÁ`\10år\19ÿöoÿ\86ét
+§Ó\89\93\93\13hµZ¬®®âe<^¬x¨~ÿ÷\7fÿá`0\90þF³Ù\84\93^F§ÓA*\95B¥R\91ëy8\1cÂårÁh4"\1a\8d¢ÕjI\97\9b»7\1c\ e#\93É \18\fÂét
+RÅ¢\18\0\ 2\81\0\0ÈéÂff4\1a\15\ 4\88\ 5çx<Æp8\84R©Äd2\11DI§ÓIóq8\1c¢T*ÉIY.\97\11\8fÇ\85-`6\9b¥ð/\16\8bÂ\0(\95J\922¹\.éó$\12  x½^Øív(\14
+\81~\ 3\81\80Ô\rÌáY_°\1eQ*\95ðù|rKðÏp!=zô\bV«UX\10ìóX­V¼\8cÇ\8b\15\ fÕ×¾öµ\87\85B\ 1ççç\98Ïçr\82E"\11\f\87CÔj5Ôj5,\16\v\98ÍfA©\14
+\ 5\1c\ e\aÔj5Z­\16\ e\ e\ e\ 4â\f\ 4\ 2\92sW*\15Ìf3ôû}ù{>\9f\ f\0Ðëõ0\9dN\11\8dFÑíva±Xàp8Ðjµ¤°\9cN§(\14
+òÃY\80v:\1dD"\11Ìçsôû}øý~´Z-Äb1L&\13\94Ëeܽ{\17år\19ív\eãñ\18kkkÈårÐëõ\18\8fÇP©TW~\a\17\8f^¯G«Õ\82ÏçC·Û\95\13ßçó       \88À÷q8\1cÐjµ¸¸¸\90~\11\19\ 2lôÚl¶+H\17Ó$ö\90Æã1F£\91¤7/ãñbÅCõ;¿ó;\ fm6\e\1c\ e\aÒé4Úí¶ô9:\9d\ e<\1e\ f\18¼^/&\93\8949É׺¼¼D­V\13$\87\81á\8f(\97Ë(\97ËX__\97ÞÆd2\91¦¥ÓéD¯×\93\1a\81\ f­Ùl"\93É`:\9dÂl6C¥R¡\.£ßïÃ`0Àf³Áï÷\vE¦ÑhHJsyy)?P£Ñ P(`}}]`èr¹\8cp8\8c­­-i\1a\92\87V*\95\90\11\b\ 4¤Ø&S\82§¿^¯\87Ñh\14\14«ÝnÃáp\bt~qq!ÏÂãñ ^¯#\91H\b\bÁß\«ÕP©T°ºº
+«Õ*,\8b\97ñx±â¡úæ7¿ù\90hQ8\1c\10@¹\\86R©DµZ\15ªL \10\80Åb\11ZL£Ñ@·Û\85\82Ãá\80Åb\ 1\0L§Sá\8717w¹\\12\15Ãá\10\ e\87\ 3\8dFC\98\ 6<YXdÛl6\18\8dFa.èt:¨Õj\98Íf\98L&ø|>T«UéG°°e\8f¨Õja:\9dÂn·£Ûíb6\9báüü\1c\16\8b\ 5\16\8b\ 5\93É\ 4\8bÅ\ 2N§S\ 2d±X`·ÛÑét\84\87æt:¡ÑhÐëõ Õjqzz
+³Ù\f\8bÅ\82D"!E~¯×\83ÅbÁúú:òù<*\95
+:\9d\8e@Ç$ΦÓi¨Õji\8e^^^¢Óé`6\9bÉ\9f{\19\8f\17'\1eªû÷ï?\9cÍf0\1a\8d\b\ 4\ 2ÒÁ¯×ër\9aL&\13d³Yèõz\84Ãa4\9bM\f\87C\0\80ÕjÅx<Æd2Á`0\10(´Ûí"\14
+!\18\f\82ï_­VÑëõ\84±=\18\fàr¹\84®²\8cb\19\f\ 6t»]AÊ\1a\8d\ 6\ 2\81\0\86Ã!¼^¯ü¹v»\r·Û\8dét*\ 19??\87\11\bÚd2a>\9fc0\18\0\0l6\e¦Ó)¦Ó)z½\9eð×Æã1ÔjµÐfxÂ\17\8bEL&\13!Ôò$eo&\12\89 Ýnc4\1a!\1c\ eÃápH1Î\82\98ý$6\82ÙÄt»Ý0\99L\82¾µZ-¼\8cÇ\8b\15\ fÕ\9bo¾ù\90]óÉd\ 2µZ-Ô~\85B\ 1¥R\89\0\9dN'4\19£Ñ(½\17\9bÍ&ù1ósµZ\r\93É$y6\99ÕF£\11:\9d\ en·[z\1eäÅ-\16\vÌçséY$\12  h4\1aI[x\ 5\93vc±X\ 4ý2\99LH&\93Èår\12øù|\8eáp\b\9dN\a­V\8b\80x<\ e³Ù\f\85B!iÒb±\80ßïG¹\Æh4\92n¿V«\85\11f¶J¥\82Õj\15ä¨ÑhÀb±`ccC>Ïçóa±Xàôô\14\16>\9fOè@Ï\9f?G¿ßG­VC4\1a\85\86B¡Àp8\14ôN­V£Ûíâe<^¬x¨¾ýío?$lÉ¢¯V«Áétb8\1c¢X,"\14
+A¡PH7\9e'\9bN§Ãt:\85Ëå\92kx4\1aa4\1aÉ)zyy\89áp\88x<\ eµZ\8dñx\f\83Á l\82L&#hV.\97Ãx<\96\93\91\8b\85\14\9eÅb!'´Ùl\96bX¡P Ýnc8\1c¢Ñh\b²¦P(Ðét\84JCé\86Ãá\90\9e
+\19åÃá\10Ýn\17Z­V´C\h\ 4\f\98b©T*\91It:\1dÉÅ\8dF#òù<NOO±»»+\84Ö~¿\ f\8bÅ"t¡R©$\rÚÙl\86\8b\81d2\89\95\95\15¼\8cÇ\8b\15\ fÕç>÷¹\87l®±×P,\16Ñjµ ×ëa6\9b\ 1\0«««è÷ûÒq',\(\14$÷e\ 3\91MÂËËKÉUÙ\ 1×étÒ\14mµZÒ姬 ÕjÁår]y?\92B\89\16åóyáÔ±\ 6\18\f\ 6°X,h4\1aR\94ûý~Io\94J%f³\19t:\1d\8aÅ"\.\17t:\1dt:\1dºÝ.úý>L&\13\19\ e\ f\ faµZár¹\ 4îµX,P(\14H¥R0\9bͲ8É\84p:\9d\98Ïç\18\8fÇ\b\87Ã\82\7fy2Îf3¸Ýnôz=är9L&\13¸Ýn¸ÝnÄãqÔëu¼\8cÇ\8b\15\ fÕÛo¿ýÐï÷Ë\95Üëõ0\1c\ e¥síp8àt:qyyy¥\10%9\94'N«Õ\82\15¶v£Ñ@(\14\92^\ 5\9b\89üaz½^Цv»\8dX,&Wr³ÙD8\1c\96Þ\f¹nÌß\99\82Ôëu\81h©ª­Õj\98L&ØÚÚÂb±@¯×\13\91`£Ñ\90\a\1f\f\ 6aµZ¥\87\ 2@(C&\93\10²"f³\19Ìf³\9c®
+\85B\18×n·\eù|\1e\0`6\9beq\9e\9d\9d\89þ\88i\ 6å\19óù\1c±X\fÃá\10¹\\ e\16\8b\ 5ù|\1e
+\85\ 2/ãñbÅCõå/\7fùa0\18\84N§Ãéé)t:\1d\1c\ e\aÎÏÏá÷û¡×ë\91Íf¥\18eÎÊ\9eÀd2\11\b\97BAµZ\8d`0(?\84ªS½^\8fÁ`\80\0£Ñ(ª]\92P«Õ*\.\17Ôj5²Ù,:\9d\ eìv;f³\99À©£ÑHȬÌ\99É\ 2ÈårÐh4\b\85B\98Íf\98Ïç\b\ 4\ 2H&\93P«Õ\98Ïç(\97ËØÙÙ\11Z\ f\fà2*g2\99\84²3\1e\8f\14BR}LÎ\1cû:äãY,\16èõzèõz¸\.ôû}á¼ÅãqA¢ìv;*\95
+\1a\8d\ 6l6\e^ÆãÅ\8a\87ê«_ýêCþ\1fæ\9c<í´Z-ÎÏÏát:\11\f\ 61\9fÏá÷ûQ«Õ\84Z\ 2\0\16\8bEÄtÁ`PÐ\19jlòù¼¤\1d\9dNGh3kkkh4\1aèt:\b\ 4\ 20\1a\8døðÃ\ f\ 5áÑh4899\91\82÷îÝ»P©Tøøã\8fE»£V«¥ÉÈ^\85ÕjÅh4\92\9a$\18\f
+%\87\8c\avéÙ\88%¬Ûï÷%¿¦èp:\9d
+\9bÀl6Ã`0\88¬a<\1eKss>\9fÃjµ¢ÕjÉÉ;\9bÍàñx$=S*\95\b\ 4\ 2"'!° P(°ºº\8aÑh\84\97ñx±â¡zýõ×\1fúý~ôz=á|ñdªV«0\99LX]]E«ÕBµZ\85\85Ûí\86\90âu0\18H\1f\85=\ 5¥R)_\8aâ<\16´ô\80¨V«\98ÏçR\170gv»Ý¢!r¹\P(\14B\9d\19\8dFP*\95\92÷×j5øý~Ìf3\84Ãa\f\ 6\ 38\1c\ eù=ô£ Èn<\1eK\1a2\9fÏa6\9bÑh4®4c\99"\91r´X,\10\89D\84\ËÞ\12É«f³\19\93É\ 4~¿\1fétZH·z½^
+~\0¨T*p¹\¨Õjèt:\b\ 6\83p8\1cH¥R°X,è÷ûèt:x\19\8f\17+\1eªx<þÐl6c{{\e\ e\87\ 3*\95J®n\0\b\ 6\83h4\1aèõzÂIëõzh4\1aÒùW(\14ò÷\98\86\10å\1a\f\ 6"Îc\9f¤Ýn\vm\87M@æø.\97\vÉd\12\95J\ 5jµZÐ,\1a\95\8cF#èõzÌf3T*\15lmmÉ©ùôéS\91@¬¯¯c8\1c~Òqÿ9¥F¯×K\ e_*\95Ðëõ`4\1aEë¤Óé ×ëÑëõ®,
+­V\v\83Á\0\8fÇ#é\10\ 5\82,¢©Áâ\82S«ÕÈårR\a\91%Þï÷a4\1a1\18\fDêO1âññ1*\95
+^ÆãÅ\8a\87ê\ fÿð\ f\1f\12MâÕKo\87ÕÕUi¼QÁÊ^\8bV«E.\97\93\ fæ\89\83Õj\85ÅbA§Ó\81ÏçC¡P\10\ 2)û7v»]\14±ìß\18\8dF¹þ{½\1e\16Ìf3\94J¥ðÖ\94J%²Ù¬¤1\9dN\a\89D\ 2:\9d\ eëëë0\18\f¨T*(\95JÒ±\9fL&"ê;>>\96f$õO\81@@\16\r\1f<\9b\8d$Æò{)\14
+Ôj5)¬\97û5ü-Íf\13&\93IôY.\97KD\7f\91H\ 4:\9d\ e\9dN\a\99L\ 6±X\fÍf\13\93É\ 4Ñh\14/ãñ\82ÅãÞ½{\ f\97¯}\97Ë\85\93\93\13Aa
+\85\ 2ìv»Øk©T*´Ûm)î\12\89\ 4úý>¬V«@ºZ­\16+++ØÛÛ\83ÛíÆd2A£ÑÀd2A»Ý\86\108\98\92\b­V\v\93É$Ww±X\84\94^Êd2A(\14\12\19\86ËåB¯×\13Ö\82Ûí\86ÙlÆÚÚ\1a²Ù,\9e>}\8aÝÝ]ôû}9¹\89ö¸Ýn        \bû\1f4Ká©W©T R©`±X\ 4í¢c\12\9b\93v»]ôU\14#º\.Éùçó9r¹\1c\.\97 i\16\8bE\8cnjµ\1a4\1a\8dô±2\99\8c¤u/ãñâÄCI©4O¿\8b\8b\vøý~QÕR\90Ç"\94]{î|RGÎÎΤ\ 3Î×úú:\1a\8d\ 62\99\8cô/t:\1d\9cN§¸\10±ï Ñh`µZ\85\8cêñx ×ë\85\9c¿\9bL&Qâ\12a
+\85B\b\85Bx÷ÝwÑï÷ñÆ\eo`8\1c\8aÌÜjµÂf³    Ê5\9bÍ\84¡NvÀh4B«Õ\12\rÓÆÆ\ 6:\9d\ e\11,\16\v2\99\8c\18À0Eêt:¨V«¨×ë¢Çj·Ûh4\1a¢ébQM½S¿ß\17\7f¿@  °¹×ëÅËx¼xñP}ùË_~8\18\f\10\8dF1\9fÏ\ 5¹¡Ä\81VXÌÉm6\e\1a\8d\86|A³Ù\8cz½.×&)þ¥RIòv\9e\16<QhpÉÿN\9e\18I\9fL\17Ø8\8cÅbâ\bK\ f\9cM&\13îÞ½\8b\8b\8b\v|øá\87ØÞÞ\16oÁb±\b\93É\ 4\83Á\0¯×\8bD"\81\83X,\ 6\9bÍ&,o\83ÁðÉÃø9\89V©T"\1a\8dÊBeѯP($Ía_&\97Ë¡ÝnckkKÄ\81$åòä§NJ­Vãüü\1c\8bÅBrùÃÃC¸\.ܺu\v\1d­V\v/ãñbÅC9\9bÍðæ\9boÂív#\9dNãüü\1c6\9b\rÉdRdê¹\\ e6\9bMP\13j\82T*\95ô/X\fW*\15´ÛmÌçs!^\8eF#øý~awët:qE"òåp8ðÁ\a\1fÈ d2\99 V«qûöm©\19¨\ 5êõz(\14
+¨ÕjxõÕWqvv\86D"!Wú|>\97Â\94Z¦^¯\87p8\8cµµ54\9bM\14
+\ 5\1c\8fÇÐjµ(\97ËXYYÁÖÖ\96\18]®¯¯\8b\8b,\9d\9a\8cF#F£\91ôMØíç\9faaìr¹¤ïC¿?\97Ë\ 5³Ù\8c³³3hµZ¬­­\89\88\92Ìô\97ñx±â¡úË¿üË\87\12årY<õìv;\ 2\81\80äµ»»»èv»¨V«\98Íf¢\94-\16\8b\82ªÐNù\95W^\11'ØH$\ 2«Õ\8aÉd\82b±(ð¦ÏçC¹\\96\9c×jµ"\99LÂï÷Ãçóa<\1e#\91HH#\94ý\10ö]H\0µÛíÈf³\ 2§¾ùæ\9b"_\9fÍf\18\ e\87\b\ 6\83\88F£¨ÕjòïhGV­V\ 5\11j4\1a\94Ëe\18\8dFÄãqÑ\19±?Â\94Àd2Ájµ\8aï^­V\13\96\ 5\8dg¦Ó)Âá° cN§\13\17ù|\1eÑh\14ëëëÒ,e:CCÍ\97ñxqâ¡øÞ÷¾·\98L&èv»øà\83\ fðÙÏ~V\1c])»¦4a>\9f\8b¥3;í½^O¸Z\91HD®g:Á²7ë\96¦ü¡PH¤\a\14Âñä#|\9cÍf1\1e\8fqÿþ}±å¢¯{*\95\82Á`@«Õ\92\0G£Qa)\94Ëe4\1a\rlnn"\9fÏK~ìv»át:\ 5]#\9af±XÄ*\9aÀ\ 1Ù\ 5\94\94³·²¹¹\89\ 5·Û-§ål6\13\ 66\1d\8cÈXg_\8a\fð@  è\13µLÑhTNýñx\8c\87\ f\0o½õ\96è¨\18\ f£Ñ(ñ H\91ñà     þ\8bâA¸ýW\8d\a\15ÁL\ fÿÿ\8cG¿ß\17ó\9db±(ñ Læÿëx\90\ 4ý\9bì\ fÕ·¿ýí\87ì\93¼ùæ\9b\ 2£Ò\96\8b½\f\0â½Ç\93\81\9d\9e)\9e£¬B£Ñ\bA5\10\bH/D«ÕJß\86ü/."þýL&\ 3\8fÇ\ 3\0Ðh4H&\93X]]\85ËåÂÙÙ\19vvv\ 4\rcÁËàP±k·Û\91ÉdÐívåïrÃ(\14
+T*\158\9d\ 2§\87°¯\94ÍfÅÕ\88ÄXÊ?Hl¥ÄA£Ñ\88 Òf³I³\97\ 2Jòýl6\e\9a\80\v~¿\1f\ e\87\ 3Íf\13¹\N\18
+\9dN\ao¼ñ\ 6\f\ 6\ 3²Ù,æó¹,\fn¢z½.µ\86\17í\18ãqvv\ 6\8bÅ\ 2\93É$ú«ét
+¯×\8b`0(ñÐét\98Ífp¹\âÞË\e\8añH¥Rðz½\12\8fËËK¬¬¬ÀétþÒxt:\1d\98ÍfI\ fm6\eÒé4ºÝ.âñ¸X¶\11¡,\97Ëp8\1c².\9aÍæ\15¨>\97ËawwW\1aå*\95JPQ­V+·3)_\8c\a='\99&\9aÍæ_9\1e¿êþX\8e\87ê\eßøÆÃ÷Þ{\ f>\9fO\82AÒ#\e\8c¤\96èõz(\95JØl6\11é\11V¥'\ 2ÙÓ\95J\ 5
+\85â\8aáÈh4\12ÓM\85B!A¦¿:¡dÂÏf³\19¡PH8p\e\e\e888@8\1cÆáá¡ÀÄÕj\15Á`\10\a\a\aBÌ\[[C§Ó\11SÌF£!t"vÿ\9dN'¦Ó)ªÕª°\eh\IÔl<\1e#\1a\8dÊûv»]Ù8¥Ré\8aò\97RýeOv¥R)¶ÖË\b\98Ýn\17°\80l\ 5¦rï½÷\1e\9cN§,\18ö\88úý>
+\85\ 2ºÝ®¸ùr¡¨ÕjÔëu)¾'\93\89¨\98\97\9d{m6\9b@ç<èH\18®V«"\1dY\9ePÂþ\92Á`@ \10\90Ó~}}\1dGGG\b\85B8>>\96ú¦Z­Âï÷ãàà@\9c\9c\b\96Ð-¸^¯#\9bÍ¢ÑhÈçsQRKF\ e¤R©\94\r;\1c\ e\11\b\ 4ÐëõäÖµZ­0\1a\8dÂ\8e_\9e8c4\1a¡P(¤\16åá4\9dNåÐ!\80A\e=Z Ð\83ÿ'?ù    ¼^¯0Iþßö\87Ýn\87\91g®øîw¿» \13`8\1c\8a?\82ÙlF­VC©T\12¶3U´\14¸\91÷Öï÷?!BþÜf\8c\90èt:\85\17(\99¾\ fLqÈzæ\83¡ù%­¸<\1e\8fH
+B¡\90ôvø°\9f={&vÉn·[z9Åb\11~¿\1f\16\1e\8f\açççWXÛäóQÚÐëõ\84Y@V\ 1\e\99&\93I\j3\99\8cøý\95Ëe\1c\1d\1daeeE\82±ºº
+\95J\85'O\9eÀl6c6\9b!\14
+       £\9c\82E
+\1eI\m4\1a\b\87ÃÈår\b\ 6\83ò]È)ä\ 6æfäf\9dÏçrÐðp \9f<UÃtgb<è\1c¥×ëQ­V1\1e\8f\ 5ö¾~ý:Úí¶\98\9cúý~1Í¡D¦^¯C§Ó!\12\89|RÔ«Tr`<\7fþ\|4\1c\ e\87¤ûÙlö\13ñâÏ­\112\99\8c0.\ 6\83\ 1Ün·4¬9@\82R\16ò\ 1ÉÚ'3\83^!4Ï©×ëH&\93ò=\17\8b\ 5\90\8c<"s\9f·1½\1c¹1x\18r=ììì \.css\13n·[bö¿Ù\1fôF\19\f\ 6\9f\(ÿø\8fÿ¸`
+a6\9b\ 5qI§Óòeø&³ÙL\1caio\9cÉdpxx(5\vM!y\12\11ZåÉÈÓbÙk\8fÐ*O\7f\9fÏ\87X,\ 6¥R\89ÍÍM¬¬¬HÁIn\19     ¢o¾ù&Þ{ï=\94J%)@É\1eP(\148??G¥RA<\1eÇb±\10÷¤ÿüÏÿ\94Åi4\1a%¥8>>dåðæ\0\0 \0IDATF±XD"\91Àp8\14\ 4L§ÓÁn·#\1e\8f£R©\88 \91"EÖ0¤\ 39\1c\ e\9c\9c\9c \18\fJ*I_\88ÓÓS\\\ P(H\1a\ 1oOê­X{PfÂ\8d´\9c\96ÐÎÚn·Ë"
+\ 4\ 2p¹\¢\90¦ç\ 4­\ 6\1a\86Ã!\1e=z$ß\83§;k\96Åb!\87\ eá}\83Á\0«Õ
+\83Á\80­­-ܾ}[\80\8añx\8cÏ|æ3x÷Ýw\85ÂÄÙ`\p´\ 5 ô\9fk©R©\88E\81Á`\80Ïç\13a©ÏçC¥RÁéé©@êô5ämÍú\94\87:\99\1dL+\99fsSÑ^\ 1\0\99\04t¬¢öíõ×_Çb±\90L\8fÍì_¶?\98½q¨\86\82úæÍ\9bÈår888\90üýøøXN\94ÕÕUÔëuôz=x<\1e\99^H²æ£G\8f\90Ïç%íãb!x±üâ\89Á\7f^þw´\1cc\8aÄÑ5£Ñ\b\89DB\86Èííí¡Ýncmm\r\12ÿñ\1fÿ!\8e­Ùl\167oÞ\94S\8a\ 4\8cL&\93XD³Þ##áøø\18\0P­V±··'´ ét
+\83Á\80·Þz\v\eûûûP*\95\b\ 6\83â\97ÁÏbJC\950g{±Fk6\9b8;;ÃÓ§Oq~~.\16llÆþ¢\17\9fϧ\9f\eÿy6\9bÉÍe0\18ÄÄ4\95JáÞ½{²¸\ 1\b9\97#}ø;©\80æë\17Å\8e\9fÇz<\12\89È\8dj2\99°¹¹    \85B\81\1fÿøDz\19÷÷÷\91J¥p~~.©Ú/{o¾?­à\b\83߸qCêçt:\8dd2)\aö/ZgL\13Ù\18çóZþsüoü>T\/\16\v\8fÇc¬¯¯ãúõë¨ÕjØÛÛû_í\8fl6\8bn·+Ö\a©T
\8b\8b\v\94J%\91\98s\82ÅÆÆ\ 6êõ:\8e\8e\8eàt:\11\8bÅ\ 4\ e¨×ëÉIÌT\11\80\9f~x\84S        \98°\9eXN\8b(\11`!Ûn·±¹¹\89\.\87\ 2«Õ\8aõõuhµZ¤Ói¹®9Å\83>\r\17\17\17\f\ 6\83è÷ûH$\12(\14
+p8\1c\98ÏçX__Ç|>\97|}:\9d¢R©HzI³\17¦§¹\N\18Øv»]
+îÁ` µ\1eÇ\9bò´^NõÚíö\15=\14k\86ét*\13\18x»sa\13\8càmÃFñd2\11\90\825\14Ó­Ùl\86\e7nÀl6ÃårÁétJêƦ-o\81åŹü=>½Áx{\98L&<\7fþ\1cáp\18ׯ_\17Ù\a\9bÉlî²\94X^ø\ÐË/ÖM\1c\95Ôï÷Q,\16ñÎ;ï\88t\84ô)Ú\87\7fú}ب&I\9a¿\89\9fÉõIô\91 \16×ðò\8b1Îçó¨×ëâñÈÃñ\7fÚ\1fd\99\18\f\86OHÂÛÛÛ\ fùÅÈ\17óûý2?¸Óé\88\85\18Ñ\17ö(è<\e
+\85°²²\ 2\83Á\0¿ß/h\90\95tÌf³auu\15\ e\87\ 3¡P\b.\97K\16\96ÏçÃÖÖ\96,\\8aô\86áÐ`h\1a\19
+\85àóùP¯×\ 5Õq¹\R\83)\14
+¹U)¡gï\86ßm±XÀ`0\b\va\19:\7fòä \1a\8dÆ\95ßKð\86ô!¯×+\104{=\1cÌ@\1fB2»ÉÕ«V«8;;\13\1fy·Û\8dk×®       Ôn0\18ĨÅh4ÂápÀjµbss\137oÞ\94´Q¥Raee\ 5\e\17\9b\9b\9brCqÜ\ fk%\12\84\99P>'£p1\8b     çÏy\82d*p\93Ó$Õn·ãÁ\83\aØÜÜ\84R©Ä\9fÿù\9fcww\17ñx\@\fZº¹Ýn\91Õ,\ fè£T\86^\89tãu8\1c\88\92\93?û³?\83Ùl\96\ 1\82\1c\91˹̬}¨(°Z­Ò÷óûý²Îâñ¸L\eµÛíXYY\9145\10\b\b\84Ïær8\1c\86Ïç»â\1e\f@\b¿ÿÓþ\b\ 4\ 2\98L&0\99L(\16\8b\9f\94F+++¨T*RË05a\87\9cÁ¢\vët:\95<Øív#\14
+¡V«\89ç\1cGÔP¤·\8cL½þúë¸}û¶\90:\89\10Qð·¿¿/6Ë\9cæÑï÷Ñl6¥ÓÏ\9aÅ`0 \1e\8f_ñô£¢Õl6£ÝnË÷äìß\e7nH*Õh4\ 4Yâ¨ÕZ­\86r¹,§\19û1¼-hriµZÅq\97\13\19¤ï;=\ ey\vV«UlooË\109\ 6zgg\a\97\97\97\18\8dFò¼9.Õëõâ\eßø\ 6Âá0Þ}÷]\ 1S(Q¡=öææ&~úÓ\9fb±X\b\e\9c\1a+ÎSÞØØ\90zË`0\88¯Å½{÷P.\97¡ÕjåæN¥RÂlw»Ýâ)Oòî\9b\89@  \ 2Ë\8b\8b\v\f\87C¬­­]\81ËÃá°è´\b\90Íçs|üñÇ2³\99Y\r\ f\86{÷îÁëõ
+÷ñôô\14\8dF\ 3\ f\1e<@¡P@¡P\80\95Ú\8e0;3\ 6\9bÍ\86o~ó\9b²ykµ\1a¬V« á¼í\93É$¼^¯8qU*\15$\12    að\17
+\ 5|ç;ß\81×ë\15s!Ú\83ÿOû\83é3Ùÿ\81\93>\99Åb\91\93 V«É(\e\9a\82ØívádÑÅU£ÑH1ÈùLd\12p\80\9cB¡ÀÖÖ\96 twîÜ\11Æ3eÞ\91HDd\13\1c\92ÍÞ\84Ñh\14`a>\9f\8bÁ?\83§ÓéÄv«T*ÁívK\8aÐh4dáðtÕh48::B·ÛÅÚÚ\9aÜ°årYÆ\9fòvæÉÄ[nssSÜfkµ\1a´Z­Èèù`kµ\9a,¨f³)·2{DÜ<ô\8d0\18\fh4\1a(\16\8b(\95J\92\8eÆb1\84Ãa¬¬¬ \18\fÂh4bssS\80\90`0(\96ÕL·].\97ÜRn·[Ð4ö\ eé0\15\8bÅäû²¦"û\9d­\0\9aÊX­VAhý~?~÷w\7f\17_ûÚ×àñx°¶¶\86ÍÍM$\93IhµZ±\8c#c¤\.#\14
+ÉÁÄv\ 6E\93\94ÖÐ\18çîÝ»ø\93\13¬¯¯£Ýn#\12\89\b
+yãÆ\rifÓÑ\8a>ûÝnWD¤lZß»wOØ\e[[[2mfÙÎ\80Ïßn·£Z­¢Z­"\9fÏËaʲ\80ë\97ëvyÔÓ/Ú\1fÌ\1a4\1a\8d¨\v\94\99LFN\18jr\98JqÊ;=\1e\bû6\9bMI\87\b¡Òû\81½\1c2\94\8f\8f\8f\85sFQ\1cQ>\87Ã\81b±(\8bÂår!\1c\ e\v\91\94Ó\11WWWáóùp~~.-\ 2nN6\ eYg°Ðf\9f\83½+\82\13´\86&\ 2§P(°¶¶\86½½=q\84eNΠx<\1eÑb1 \9cMÅi\90ív\e>\9f\ fgggÈd2¢Âå¼*\9aÎÐ\9c¥ßïãàà@`a¶\13h<£Õj%\1eä ®®®
+0ÀC\85z*\ eË#\18Ãô.\12\89 Ñh V«áòò\12?ýéOÅR\9b \89ÍfÃîî.B¡\10òù<²Ù¬pü\82Á 
+\85\ 2ªÕªÔ\89ñx\1c\1e\87\87\87h·ÛhµZ\88F£X,\16°Ûíâ\8dQ*\95\84¢¤R©\84´Ì¾$×\ f]\8a···át:ñ\85/|\ 1ï¿ÿ>Úí¶l`\ e\9f\88D"2X\9d}OöCÃá°¤Ú½^\ f·nÝB6\9bEµZ\85×ë\15\ 6\86Ñh\84ÙlF,\16\93z\8fh53:\ 2W©T
+½^ï\7f½?è\rÂ6\90\82Òçó¡Õj¡ÙlJ·»X,J±~çÎ\1d¡\99¤Ói\914\14
+\ 5I\1d\99¾\11â¤Þ\88\82¿gÏ\9eá\87?ü!t:\1d|>\1f"\91\bÎÎÎpyy    §Ó)S\19É"áµl6\9b%E`Z7\9dN1\9bÍ Ñh°¹¹)´\17ö%\.\97°¸):\9cÏçÂøv»Ýxã\8d7 P(\ 4\9e®V«â\8bÁ\17¥ \1e\8f\a\1a\8d\ 6\87\87\87\98ÏçÈf³"AçxÔ\.'è!OM\1e\0¡PHü6\9aͦ\8cý)\95JB"e}I\0\89\90øÚÚ\1a\1c\ e\aNOO1\1a\8d\90Éd°½½-N·§§§W\86ì1McZH\84\8bðu,\16\83N§Ãþþ>Þ}÷]èõz\ 4\83AiK\94ËeY¼¬'\89ÄòPËårxÿý÷ñïÿþïøøã\8fÅ¥\89\9bo6\9bI=N»\ 2*\91Ûí¶l:²(\.\17>ÿùÏ\8b6K­V#\95JáîÝ»r\13\90YCïúÁ` \8c\12\ 2hF£\11J¥Rê%ZàÑÀ\94`\1aY@ét\1a\97\97\972W\9b
+k\ eª§Õ[4\1a\95rãWÙ\1f\Ó&\93     Êjµz\85:Ãü\9dÈÈÑÑ\91\f)\b\ 6\83\ 2}\12-")²Z­"\9dN\v¬LN\1cÓ­;wî`4\1aáÑ£G\88D"2ö\94¬ ·Û\8dd2\89\8bëׯË&èv»RT/\8fí¡x\8f\e!\9bÍ\8aÅ\99\81Ëå\12ð\83ð*A
+\8bÅ"º&ª}Ë岤wz½\1e\1e\8fGx\83ô\ 2¤5óp8Äd2\81Ýn\17¾Ú|>\17'Y»Ý.3\8fÉ|1\1a\8dò[è\9b±µµ%-\ f¢±t;2\1a\8d8<<Äl6õkפqúüùsäóyär91\ 2eo\86VÛ4æ<>>\86ÃáÀ½{÷D)­×ë±X,pëÖ-Ìf3<\7fþ\1c¡P\b\1e\8fGÆÖ\12Èév»(\16\8b¸\7fÿ¾\80
+z½\1eûûû8==E"\91ÀÖÖ\96¨\86\89Øy½^d³YA$U*\95|7\8eM"#\9f)^­V\93ÅÌt\8b\r^\8bÅ">\88´\17XF°É¹dÉBÒðññ±x\96\94J%\8cF#1we[\80ÙѲ·äb±À׿þu1Q%\10ô«î\8fÅbñ\89\ 4\86\r´\83\83\ 3I/ªÕª,\8aeêϵk×dt\fùxD$Yè25"\12ÆÔ\87sª666°··\87\8eT*\ 5\93É$H\14­½ØØäUn6\9b±±±!\fj\9e\92¬\1fÊå²\ 4q4\1a!\1a\8dÊÈ\9b££#looË\rãt:å»\10\ 2¯T*\ 2ù+\14
+\84B!¼óÎ;èõzxòä\89ܲì\9b1\1dãTG»Ý.¬tö &\93       r¹\1c"\91\88L£$=\8a\v\82u
+af¢\95Óé\14ûûûðz½p:\9d²\88\v\85\824ó;\9d\ evvv$\1e\ 6\83\ 1³Ù\fGGGr"sü,[-LÍidêñx$Å\1d\8fÇ(\14
+\98L&ò]x#år9ôû}\1c\1f\1fcwwWZ(³ÙL\9aÚì\11v:\1d¡¤\r\87C¡¥\95J%¡¦q!2\ 3I&\93²\86ø¾GGGÂ\ e\8aÅb\ 2&\9d\9e\9eÊ\9a\~f\84ã{½\1evwwe
+&A\1c\8dF\83l6{%\1e´Î#-¯ÛíJ\93Üëõ¢ßïËgìïïÃf³!\1c\ eÿÊûCI\9bb¯×\v¯×\8bb±(\88\1a\11:»Ý.<?~\ 1\ 6-\10\bàìììʤÄå¾\ 5=\14\83ïqyy        ¿ß/5D"\91À\9d;w\ 4ý"\8by8\1cÊ÷¡O\1e\aÅ5\1a\rñJ'½G­V£P( R©ÀápàÆ\8d\e\922,\16\vd³YñX'©9\99L\8ac\12ae²\ 3\88@y<\1e|üñÇR\83\91\16\ 4oõt:-§!§\91\90¥A\9a\13§£x½^a¼,/\18¦EÁ`\10ÙlöÊð\ 3Æ\83}3\ eKg\9a\85é\14aäX,\ 6¿ß/z«`0(3\91\15
+\ 5Òé´¸øòE\9d\16=1Z­\16þë¿þ\v:\9dNPS¢¹ÙlVN}ÞâËÃÞ)]Ñh4\92Êóö\1f\f\ 6\b\85Bp8\1c8::\12)˲Cñ£G\8f Õj±»»\v·Û-ïÃÃ\9cæ5\93ÉDjíR©\84\8b\8b\viøÛl6ÑÖ\91\ 5¢Ñhàõz\11\8fÇqãÆ\rD£Q\98L&É8Úí6²Ù,<\1eϯ½?ÔL}h­Å\8e~.\97\13
+N·Û\15».²£»Ý.666$HF£\11O\9e<¹Ò\1cä4\f6g9Ac±XàæÍ\9b¸¸¸\10n\eÕ®:\9dNÐ;\9evüÌ\e7nÈ\ 6có5\1e\8fãÁ\83\a888\10x\95õK,\16\83F£A8\1c\16h>\9bÍJ^}qq\ 1­V+}1¦\8a´
+Ëd2(\95JÐëõØØظâdËÁ\f¤1\r\ 6\ 3\99dB \81¦\98ôF§±èh4\92÷åɹ̶`\7f\89 \86\17a Ãá\90±>\16\8bE\9eM§ÓÁöö¶\10\91Ëå²ô\11¹ ûý>Âá°\1c\ 2*\95
+Éd\12Ãá\10ÛÛÛØßß¿\92\89Ìçsi\8f\90½îõz¥\ 6ôx<Ðjµxþü¹øÇollàþýû8::\92[z4\1a!\95JI¯\8f\a0QåÅb!ó\96766$ÍnµZh·Û¸¸¸ÀÊÊ\8aÔBìi-?3Òôü~¿üVn¬z½\8e\86@ p%\1eTH\93?ËAíÄ)®_¿\8e\9füä'èt:\82p\13üùUö\87\92¨\17?¬X,¢^¯Ãn·KMÃ>\17\84My\92\8eÇc4\1a\røýþ+'\fS4\95J%i\ 2û\16\16\19\17\17\17Â\1d$\93\80\8c\fæíä@6\1a\r\9c\9e\9eâéÓ§xë­·pûöm¨T*\9c\9e\9e"\1c\ e£V«\89\95W^A³ÙD­V\93q<z½\1e\9fÿüç1\9bÍ\90Éd\84fU(\14® \8aßùÎwä¤î÷û¨V«RóÑÒL­V\8bÑ\vµT\94m\90×Æ\1a\90\ 4X6ÂYO\\\È©½üÒétp¹\\92nT*\15Ióþ§xP3Å\98ð¶h6\9b¸¼¼\94\96\ 6­»Õj5\9aͦ@üÔÓ-³<(ì\,\16ØØØ\10OFZQ'\93IX,\16ܽ{W¨UgggWâ1\1e\8fqíÚ5a\97,3H^yå\15L§S$\93Iø|>Ìf3\9c\9e\9eJ\r<\1e\8f\85wÊ´\90³Ë\96×\19ÇèªT*Ù°T\85ü²x°>å\l¶\9d¨Ú.\16\8bB\12çä\9b_g\7f(¯]»&(T·ÛE*\95\92æ\1cE~\9cÈøìÙ3\11ä\85ÃaL§S\81¤Y°.ÿx¢\80¤¹\18\8dF¼òÊ+¢"­V«R¼s$)\9b\99$Åò¤âB'SºÙlÊ\ 4úÕÕU\81\99Ùí???\87ÇãÁÖÖ\16\86Ã!ö÷÷a6\9b\91Ïç¥\10???G:\9d\96Ïa\8eN§!"¤$¸\16
+\ 51oá¦%û\80\vÏ`0`ss\13«««R\vP/ÅT\90h,g~-¿ôz½0ê[­\16\12\89\ 4\8e\8e\8e\90ÏçÿÇx\90\15Ï´\987!\19\1d¬\97\9e<y"¾÷f³\19×®]C¯×C½^\97aè|\11e£Ù\ ee/&\93 étZho$FÛív\98L&Äãñ+ñ \ 1\8043Ö{\1a\8dF¼1\9cN§hͨd ÂLñ(\9bÖ¬1\97ÓE¦àÍfSnB¶\86¶¶¶þ[<¸>©McVÁßS.\97ñ³\9fý\f«««rÈüºûCI\ 4\8f\6³Ù,4\15\83Á \83§IybqHõg,\16Ã`0Àáá¡\böø"4:\9bÍP.\97¥\91Ûjµp||\8cP($\8c\10r
+\e\8d\ 6\8e\8e\8eäÇòE6\85ÏçÃ\17¿øEÌf3q\1c\1a\8dFp»ÝøÒ\97¾\ 4\97Ë\85ÓÓSlmmassS
+T¿ß\8f\9e¡Ñh\88}\97Ñh\94[\8cµM¿ßG4\1a\95T\80\ec\7f\7f_ ÙÅb\81\ 4¥R\89ëׯ\võ\87\e{ggG¨8ü~ÍfS\8cE­V«ôÏ8_xù`"\b\1a\r79âè\97Å\83½F
+\12yú§R)ܸq\ 3ëëëò½©Xfm\99H$¤¶[î\15v»]ìííÉâÞÛÛ\93æ/¥\1dT\d³Y\ 1\9f\96ãqvv\86x<.\1e\18¼}\1a\8d\86¬£`0\88ÝÝ]Aü(\b-\97ËÒ\ 6 8Â6ÑrºH2Ã\83\a\ f\ 4\94:88\80Ïçû¥ñ`M­R©¤\ 6óx<\98N§(\97Ëxíµ×¤Õ\90Íf\7fíý¡ænãàîP($^r\0ppp\80\e7n \91H\88%\17\vø~¿/jÖ¯\7fýëxþüù\95\93\90ÊZ\1a±p´\8cÉd\12ÈxY\ 4\97N§ås©>]&t\92\9bÈAãgggðx<(\95J"\1cìõzÂçÛÛÛ\93æ$óir"§Ó©Pv\96OÃ/}éKW\1cb¹P§Ó©\f\7fûÙÏ~\86»wïâòò\12³Ù\f+++Ò'#\95\89í\ 1\93É$Ú(\8aS3\99\8c\10P3\99Ì\95MFí\19Á\96û÷ï£R©È ó_\14\ f\12¯»Ý.\92Éä\95l\82,\8c\1fýèGðx<ø\8b¿ø\véÕ\11í#·ðÓ\84[\8e6â¼d¿ß/r\9aB¡ 4;ZÉ]^^"\1e\8f\8b\9d\ 1Ó¾µµ5!\95ó\10f\v\88Sb8àB¡Pàþýûxüø±¬Çét*¶\ 2Ô=òFdí8\99L\90N§¡Õjñ­o}K¼BR©Ô\95\11Í6@:\9d\16ò@4\1aE±X\84Ãá\80Ïç\13\95D.\97û\8dö\87²Ñh \9dN\8b\9bQ"\91\80Ùl\86Ãá\10~Z*\95\92ü\95BÊB¡ ©Ä`0@³ÙÄÚÚÚ\95\9a\8c©âÞÞ\1e\9aÍ&´Z-l6\eîܹ#ðs¹\9cð\1cçó9R©\94\0\ eËiË`0\10¦\ 5§&^¿~]\1c]3\99\f\ 2\81\0¶··±³³#f/\ 4<J¥\12nݺ%Á©T*H&\93ò\19ì#ùý~¸ÝnD"\11Ñy1\85¥Ó\92Ãá¸ÒßJ¥R¸¸¸Àl6C6\9bE"\91\10º\12\17-)Pìélll \95J]©S\98F\11\91¼¼¼ÄÉÉ     ¬Vë\15rô/\8aG>\9f\97\9b\94§\ 5D4\1a\15g§½½=iÎZ­V\»vM\94Á\ 4\94øj·ÛrÐÄb1ܸq\ 3?úÑ\8f\90L&\91Éd\90Íf\ 5à¢ü\85sü^/Ö××±¹¹yÅ.\80\e\83\ 6:TAd³Y¬­­a±X`ggG¦g\92^W¯×\91ÏçÅ\87\7f9]d\8d©P($Åfl\96E»dïS!°··\87½½=\94Ëe<\7fþ\ìÜ\9aÍ&NOOQ¯×\7fãý¡ÜÜÜ\14\1e\9fÃá@¡PÀl6\13ÊÊîî.Âá0¢Ñ(|>\9fì~Ne¤áH0\18¼rR-\13l\ 3\81\0\8aÅ"~ð\83\1f\0\0
+\85\ 2ÖÖÖ°±±\81[·na8\1câñãÇBy:99¹\12lææwîÜ\91<\9a\rßJ¥\82ííma\apV\14ç÷j4\1aq)â\80ºR©\84½½=¡ÉÐ×\8fòw¦[\84çé£Á\91«ì©ñ\ 6&[\84Mo\83Á |Èv»\r§Ó\89ÕÕU\99\88rëÖ-\19Pn·Û%\95á3³ÙlÐëõ°X,²\88\14\9aÍ&nݺu%\1e½^\ f©T
+*\95
+'''âu²|[\10î¿wï\1eúý>¶¶¶\90J¥ðOÿôOÒz\88Åbâ\7f¸¼x\99>F"\11Ôëu|÷»ß\15ß\94\80V«%ÈaµZE*\95\12º\19YùO\9f>\15[\ 3®\ fZ\1cÐÆâèè\b\1a\8d\ 6\1f\7fü±ÔÕl\95ôz=É.ØD_Feys/\1f$\9cNãóù`0\18P*\95¤\rÂ\81\82\8f\1f?Æññ1Êå²XÂ9\9dN\84B!ißüßØ\1fj·Û\8d×_\7f\1d{{{\12\búàE"\11\99ÙD\7fp\95J%\83\vØí¾\7fÿ¾8ú,çôlÔíììÈ¿?==\95Ñ£\84QYèÿä'?Áññ1.//¯\9cÄìU)\95JüÝßý\1dòù<ÎÏÏ\11\8bÅP©Tpyy)\80\b\17\9bÉdÂ\9d;w°²²"\ 2Sz`\90áÁ\ 2\98\´ßû½ßC$\12\10Àóçϱ½½-`\09\85$\83îíí!\10\bàââ\ 26\9b\e¾\1fYõ4éaÀ\97O`Jb\96{\8b\1a\8dFÈ­*\95
+_ýêW\85\ fº½½-ua4\1a\15\7f\fò\ 5ß\7fÿ}\9c\9f\9f_I³  \f}þó\9fÇ\87\1f~\88¯|å+¸\7fÿ>\9aÍ&ÎÏÏqqq!VjD&\97ãÇ\99eôÅ BúéÓ§"¥a\1aëv»1\1a\8dðäÉ\13¹¡\99MðöàáI \88\19\ 2[8\ 4±ÎÎÎ\84¾¦ÑhP,\16±µµ%\83û\96y¦Ô+N§S\1c\1d\1dá·~ë·¤n&!¹×ëÁl6\8b\95\eµoäd\92\83\e\89DD\8fǹϿéþPw»]iĺÝn\11\1fÒ\1c\87¦4©TJè>jµ\1aét\1a»»»P*\95ø×\7fýWÄb11ç_\ e²V«ÅÏ~ö3\98Íf|éK_\12_\87G\8f\1e   ª¨ÑhÄ3\83|<\ 6Âf³\89ì#\18\f
+R\19\8bÅ\90Ëåpvv&ý*\8fÇ\83D"!'e¡P\90>      y\94\9c#Ì[\8cßÓjµ"\10\b`0\18àüü\¬\ 5"\91\b\9cÔ\94\89D\ 2¯½ö\9aÈ\1d83\99t*ÒÌh°É\86&\89Æ­VKÒ
+³Ù\8cL&s%Å&ÐB/\91\ e\8bÅ\ 2\9bÍ\86Á` NOÉdRdô\93É\ 4ûûû\ 2{óE6y¿ßÇéé)þê¯þ
+Íf\13?þñ\8fÑívñöÛo\v³ÿôô\14Ífó
+jÇø\11)\__Çåå%NOO¥õÀZ\95\87èòMÅ\rÄZo\99AÁf0o\8e|>\ f\8fÇ\ 3\9bÍ\86\8f\bf³Yüé¹\ e\98¸Z-?3ʳ¸ñ\98:Ïf3\19µD\90\8bÀ[:\9dF*\95\92¿\1f\f\ 6±³³#Þ\92ìÙr\90âo²?Ô¼n)<\e\8dFb\96Â\1eJ¹\¾b&ât:áñxÐl6Q*\95àñxÄpeùE§ZjÁÈí+\14
+H$\12R\90R¯³|:q\0Á²\b/\12\89`\7f\7f\1f\1e\8fG~P·ÛÅÊÊ\8aè\9ahj³\8cn>yò\ 4\137oÞÄþþ>\ e\ f\ fåÁÑ:\8c\8b+\18\f"\9dNÃëõ
+\90Á\80òÄ\1c\ e\870\18\fÂh¿~ýºlb2U8\0\81µ\0Ó\ZËQ.Do\93å\17]¤X\v\96Ëe\91Y(\95J\14
+\ 5X­Vq­âB \85\ 2\ f(\9aÚX­VT«U$\93I|å+_AµZÅÿù?ÿG\18\1aäz\92y¿Ìø àb±Xpxx((){\88t\1ecìI\15\ 6àÿ2]d\rå÷û¯ØK0ýe\7f\94ýÍjµ*©éåå¥Ô¬Ë/Nz¹¼¼Äõë×ÅA*\95J¡ÓéÈ÷#Ð\92ÏçeÓ³¥aµZáp8\840@äù7Ý\1fj\ 6$\9bÍJqIò-eÞ\94·sÇSR>\1e\8f±²²\82\95\95\15$\12\89+\ 3Öøbξºº\8a\8dÓÓS\91\95ÐzëÓþ\16\1a\81@@ÆýÜ¿\7f\1fßùÎwP.\97åôyüø1\1a\8d\ 6>ûÙÏ
+»áÚµk8??\17½\1ak'ª¶Éãã\rÄá\bñx\1cwïÞ\95ïÁô\8b°ð²)\8aÕj\15åu½^Çúúº¤|TýR:Ab)Õ\ 3\9cöa·Û%0¿ÈÛ\83ñX[[\13 \85\86§¼9é\16V­VñôéS\1c\1c\1c\y\ f\97Ë\85`0\88\0»Ý\8eo\7fûÛèõz(\16\8b899\81Íf\ 3³\18Î\84\8eÇãW6\19g#¯¬¬È­;\9dNñÆ\eo X,\8aø\95Eÿl6C0\18D§ÓÁx<\96\r\12o%n`Z\19PºÂM¿³³\83çÏ\9f\vw\92¾õl{,\9b:-³d\88\f\8eF#ñ\17!mkÙ_d9=çaÎÍÍõÛï÷áóùpyyù\eï\ f5{1\1c\9aÍü´R©\\11ܱxäè\9d\8b\8b\vi\14\96Ëe\81L\97\7f\ 1\1a\8d\ 6\99LF¨E<¥>ý°X§Äb1!y¾óÎ;¸}û6NOOát:ñ¹Ï}\ eßûÞ÷D¨Hn\1eQ3*«kµ\1a\ e\ f\ fÅZ\8e\ 5~¹\\96¡ÝL©t:\1d¶··Å²\8d\9e\e\84î9a\84¹ør:DfÁêêªØY\13ºg;\83ü¾ÍÍMQ\16\90~ói?\r\1aópÔì`0\80R©ÄÉÉ\89¸óv»]ôû}I{i\85À\17\vöh4
+\8dF\83?ú£?ú\84C§Vãý÷ßG©T\12\94\8d\r[ö.)ñà­T(\14àt:qíÚ5ìîî
+dÿýï\7f\1f\e\e\e¸}û6Þ{ï=ñwd£\9e\0\93Åb\11}\17ëoúx\90\ 2F#¡N§\ 3\9bÍ&\ 2Ýjµ*h%\91ÜN§#³\9f\977\19\aO\18\8dF\99\9c\9a.\13±Ù®à\1aå÷\9eL&\ 2xe³Y\84B!üßØ\1fj\ 6\9cÐv$\12A­VÃêê*\86áxA\90«vtt$b>½^/\ 51A\8cåS\82Å?5I\1c\MÂ0sýe\a^£Ñ\88P(\84·ß~\e÷îÝ\93\8d¹¾¾\8eT*\85\1füà\aB²e h7@û3\16ׯ½ö\1aæó9úý¾<øåF&9pkkkÂE¬T*\92J\18\8dFܽ{\17\99L\ 6Åbñ\8a-¹ÍfC<\1e\17Ý×ññ±\98ö0\9d\98Ïç(\16\8bÂvÉçóðù|¢îV«Õøà\83\ f®Ô*¬ÉÈ\93T«Õxòä\89h 8M\92ò\9aå\17\11°X,\86x<\ e\93É\84/~ñ\8bÂ`/\16\8bÒ¬w»Ý°Ùl¸¸¸\10Ù¾×ëýoé"\9dÄ
+\85\ 2þöoÿ\16\9dNGê§B¡\80Ñh\84?þã?Æp8\94´Z¯×KíI¿G:\e\9f\9d\9d!\97Ëáââ\ 2ápX\ eâV«\85·Þz\v\83Á\0[[[Øßß\97øòw\ 6\ 2\ 1a\93<\7fþüJª¨P(\84äëõzqrr\82h4\8aN§s%í£º\9a\9cUÖ~ñx\tuõz]ÔÝÝnWÔ\ 2¿îþP\13\96äµ9\18\f\10\8fÇ¥'A×Ør¹\f\95J%j\.\bNûX6\9e\þñÅb\11¯¾ú*Âá0nß\12¯\96&\0\0 \0IDAT¾\8dét\8aG\8f\1eÉà\81\1fÿøÇ¢\\9eL&XYYÁ\1füÁ\1f \14
+       ªöꫯJ\9aDuíêêª\18þ·Z-!»\8eF#lmm!\14
+a6\9b!\99L"\9fÏÃjµ"\95J]é\8dq@^,\16\93áu\1cÝJÙ>{läÑQ¤J\9dR±XÄÙÙ\99\fÁcó\99T 6j9c+\95JI¾NÁà§)Bd}8\1c\ eQ\a\93yÀC\8cMf\85B!
+nzgºÝn¼ýöÛðx<\b\87Ãè÷û¢1£â\97\8c\ 5\8bÅ\82D"\ 1¯×+\fúåC\92é¢×ë\15ÆÌ\e\81@  |M\1e4ív\eétZ4b\14OÞ¸q\ 3\1e\8f\a{{{x÷Ýw\91L&\853Øï÷EþÔét`2\99DûÅþ\19']\86Ãa,\16\v©å?Í]díùúë¯ãÁ\83\a\925ðÙQû×ívQ.\97Q«Õppp ZC¶\8a\0àääDÌ}\98ùüÚû\83\ e­\84à\99¿rî/;õ$\84r\92 ÙçdqP\86¾|º\12¢5\99LBÁùÆ7¾\81\a\ f\1e \9fÏãââ\ 2·oßÆÑÑ\11\14
+\ 5"\91\b¶¶¶ðÏÿüÏbÖòÚk¯áìì\fÉdR\9a\80\91H\ 4O\9f>\15\8a\14õW+++\ 2÷\92Çæõz¥®zòäÉ\15£\1c
+<)\8e,\95J8??¿"6eÚÈ\9b\83·>ÿ\99ô\9d7ÞxCܱXøó&b\7fnyJ ½E\96©cË\142ÊD\8e\8f\8fe\9e\17ý<Ȥ\99N§R¤\a\83A1+b¯\8b\eÒétâðð\10\97\97\970\9bÍ¢Ã#\90âóùD\7f·|H\92SÈÚëöíÛøìg?\8b\88óós\89G4\1a\951K\14¸>\7fþ\1c\e\e\ep:\9d\92B\7fôÑGâ§È>×l6ÃG\1f}\ 4\8bÅ\82ñx,u\10k\Þ<\e\e\e\0\80çÏ\9fË\0ùet\911& \81u43(\96&óù\\0²áp\88ÍÍM\94ËeܺuKRQ¦³üÿ¿éþP\93Ä»ì=\9eH$®8\1aQ&Ïi\82$¶Ò#\91éÚòD\16æ»\84¾\99k3\ f\ f\ 6\83¢Cóx<Âõb\9dÁúà\87?ü¡äõ\1e\8f\aù|\1eÿò/ÿ"´£\83\83\ 38\1c\ eܽ{\17ÑhT
+S\ 6\82cqNOO¯\98x²QKGZ\9a\0\91rEq&óxJ)8\19\84·¬Á`\90q=Ëu&å0³Ù\fn·[Ná½½=iz//\92åúb\99Áð7\7fó7ØßßÇ÷¿ÿ}looË\88£¯|å+â\ 6FT\93uH0\18D2\99\84Á`@¡P\10\ 42\12\89HàÉ°§X\96àÍ2]\89\aÄh4Â\9d;w\10\f\ 6ññÇ\1f\8bM\9cÉdÂÉÉ       \1e?~,-\8a\8f\b\13ׯ_\97\f\81\v»V«I¯\8c5\10\ fæT*u\85©â÷û1\9fÏ\ 5RO$\12â±É\ 6óòM6\1c\ e¥eÃì\80\ 1Éx\90Uòøñc\ 1Ç8¤\83Ss\82Á \8e\8e\8e\ 4\92ÿMö\87\9aì\0ú\1a\12\1d\v\ 6\83h·Û\98L&²H:\9d\ e\9c°)R©\94(K}>\9f°+\96\83¤×ë\85SF\90 X,\8aE×l6\93éö\89D\ 2+++ÂuËår²\19èÊûþûï\v\15¨ÛíâöíÛ\18\f\ 60\99Lâ7o±Xp~~.'R>\9fG"\91@6\9b½Ro\90®3\18\f\84\8aåóùP«ÕD`j·ÛÑn·áv»¥%@_½Z­\ 6§Ó)è%½þ      írr
+\91/§Ó)DgÒ\9d(åù4\14]©Tpýúué÷üõ_ÿµ\fÊS(\14\88F£b\0JD.\95JI­Kçä\8b\8b\v¤Óilll\bu*\93ÉHL       ÖÐ\v\19\1d¦Ô\9fñ(\95JR§ñ;>~ü\18\19ÛÛÛèt:ØÝÝ\95\ 6÷x<\12K\1eÂ\ 4~&\93        nܸ!Ên\ 2 >\9f\ fétZ@,ö5].\17\9e>}z\85ô@^+¹\8fL\v      º]^^Ân·\8b·?g5°ßåt:\ 5\1ddy°X,\10\ e\87¥¶üMö\87:\10\b \9bÍ
+»¡X,â3\9fù\f\92ɤäç×®]\13çY\1a^rp\ 3\11ª_t\93qÁìîîÂd2ɬ^zø-ç¯\1cøMÊÔb±@:\9dF(\14\92ÓÔl6ceeEЦeÿs
+!«Õª\f\1aè÷û\88Åb8??G2\99\14£\1c¦n\81@@,í\8cF£¤U\1e\8fG<\ 6\99rµZ­OF\93þ\1cº\9dÏç\ 2^ÐÎí·\7fû·\ 5ú5\99L\92\9a\92\98|~~\ e\95J\ 5¯×+sèÀ^®\13ùÌ\95J%\ e\ f\ fñ­o}K¸xjµ\1a¯¼ò
+\92ɤ\90¬é\87á÷û\85ÅÂÙ\´WcÚÅѬ¼)³Ù¬\10\ 2X#}Ú®\9bÏ\96õ7u\87\9c³Lí\14Ójº(\97J%!7Óä\87\v\99¤^~'\1eXä4Òº`\7f\7f_\fH\8dF£<ßgÏ\9eý7\12ôÖÖ\16æó¹hÜÖ××Eâ¤×ëq~~~åséµ\12\ e\87¥ÇÈç\95\84:F\ 3£_w\7f¨¹k94\8dW -½®]»&·MµZÅÚÚ\1a¢Ñ(2\99\8cðÀ8³\89Þ{|Ñä\85óÏø y\92ü?í\9dYSÛé\99öo\10b\11\bÐ\8a$$@\ 6\83ñ\86ín·S\1e§&\9dNW¥jªf¦æd²U\96\93|\ e¾A*\87ù"ÉA*©¤;\9d®ôô¤Ûv³X\80¬]BB\v\12Bìz\ fÞù]%\9cdÞtú=¢ðQ¯¶Ðóÿ?ÏýÜ÷uý.jbæ?´¬\1d\ e\87ÍÏÏ["\91°_ýêW¶¼¼lóóó\1aHrÒ<xð@
+\80ÁÁA\8bÅb\16\b\ 4lkkK´\\9a\1d½J\88±±1\8bÅbö­o}KyX»»»¶°° ²/âÙýý}å#ã,Îd2öÁ\a\1fØññ±Ý¿\7f_T&8\17¨âý~¿åóyËårj2°yP¢y<\9eKÚÅ^ÈL2\99´\7fþç\7f¶T*¥\97vyyÙö÷÷e­'\90c{{ûRW\12N!Z¾N§cårÙÆÇÇ­Ùl*\87ÍëõÚþþ¾Ê\9eÞ2\f\19ÕÄÄ\84\ 4»¨)\b\9d(\14
+¶··g\95\1e>|hfvi=ü~¿Æ\ fð;Øx|>\9fÆ\f\91HD\9aÑ££#Ù\98\18ü\ 3®á¤zÓ´\89¨wyyY\9cM Ql\16\90ÅPÝ\87B!EI=}úT´+\94úT _õýpüøÇ?^Íçó\97r¶À¯\ 1\9f<??×\90×ívk\9e\80\91¯7¥cssÓ*\95\8aJ2x\f\98 á!|þùç¢,Q§»\.«ÕjÖl6UrÀÊp:\9dªÉ)Ý8\9d(\178qÀ,sÇZ__×\8b×××g·nݲ`0hï¾û®vj\90Ü\10\99¸OÂ\85ðûý\16
+\85¬ÝnÛöö¶\8c§§§§\16\8dF5\98¦arpp`ýýýV©T\942sttd\81@@PVRlP´\9b\99¹ÝnÍq\ 2\81\80-..Z­VS\89IJåÚÚ\9a,\15\90^¡½£Ôåå\ 5ð
+\8c\88ÐF2\93OOO5®à¡t:\9d\ 2å,//ë4\1f\19\19±íím9Ä\87\87\87¥Æè]\8fF£a\91HÄÜn·½zõÊ\8aÅ¢N´ÑÑQ[ZZ²ÙÙYëv»öèÑ#U3ÀOéðöÎ\13³Ùì%i\1c!\11\9f<ybûûûânð{öFæ\92A\10\8bÅ\ 4\92D\ e4²¾¯ú~ô_\\X<\1e·ÙÙYÕ«Ü\ 3\90\9b@I\85g\80\8c§¿¿_\9c\87^ûwïNÈ\f\8cÈ\9a\83\83\ 3ûÓ\9fþd\ e\87CZD\1e`\bÂäöîîîʸG\88D±XÔ\8e\ 5\83Yvræ=^¯W°IÊ( 0?üá\ f¥tç\81\80Dlooϲ٬º\9e###\9a¯p\9f \94Â\8d\8d\12\1a3m_\1eÎ\.§M\ 3pM/û\82FÐìì¬år9\ 1\bØH¨ \9aͦÕj5«Õj\978\91è\ 2\199\02j4\1a\92s\ 1\8a}ùò¥9\1c\8eK0\98Þî"ëN×\96¦D>\9f×fãv»56ù[ë\ 1ö ·ÒÙÜÜ´f³iËËË\9a±ñÒÐlà3ãà&\83¬÷N\ 6î\9d±\a®y\1a4àÝ ü¢Ú\80\9d¨àððPò1bj¿êûÑ\9fN§eÁ =\90\85¥!\12\ e\87mnnN\ f"\96mN\17ZÊLÝ{\1f\18ÂÞ\10\9b¦Ói5.\80bÞ¾}ÛÂá°:@x\8cFFFlmmÍJ¥\92ýö·¿ÕÎ\0\8a\8c¡",F\94\10\84HàSë\15\ 3»\.k·Û\96H$.\r¢{[¶\98ý¸Çäóy+\95Jvrrb\9b\9b\9b2\8fB  &L\8f{    \7f\1d\89Dd\88ÅÊ\ f\18\96ú¿·TäÄ!\96\95õ@ÝM)\16
+\85\ 4*­×ëb%\ e\f\f\88¦Ä¬n||ÜÆÇÇ­Ñh¨s:22¢î"âçÅÅE\95÷üB\1e5??oñxÜ&''í£\8f>²õõuÛØØ\10\hppÐjµ\9aÖ\83\jÖ\83TP^ÜÞ\12\ f¸Ñï~÷;EYMMM\99×ë\95A\97\13\11á\ 1X¼Þ_N§Sw9þ=\90(\9eÃ`0hù|^
+\11Ö\83,ìb±x       Ýpvvfÿ?Þ\8f\ 1vÞW¯^i\97&\1fÊív[,\16Ó\eîóùÔaCPÊüÀétÊÌØû\83³\13±¸$h\94J%í(N§S`Ô±±1iÔÎÎÎ,\1c\ eÛÙÙ\99\95J%ÕÄ\94\ eÄ\99Ò\89k·ÛºÄ·Z-5$(_Ù­#\91\88ÍÎÎ
+§Ì\v\86ZÃívkþ·¿¿oápØÖ××ÍétÚ½{÷dÎ\84`Ûn·\952I3ÀëõÚÔÔ\94(K 
+\18\8aò"râ¿ùkssS\1aJ·Ûmù|ÞÂá°\1a\rÿ¯õà\ 4I&\93"CE"\111JºÝ®0ÝtÏÞt\1cÓlB­Aö6/{¡P°ééi½\9c¨aÊå²Ý½{×\ e\ e\ eTbñàõ6Å°ñ\87B!\r\99Ýn·\86Ê\94áÌ\a¹\1a`N}Ó´\89^pppÐ^¾|)[\12
+ùx<n333
+\ 3á\19â\1eHr\ f\1eHÀ8_õýèïïï\97@\13@\rYÍ­VKl\aXt°\16\bë;<<ÔîòòåË¿xX&''mhhHísvev@\86®ápØ\1e?~,Å\ 4\88\ f´\84ñ\ 2¥Ói¡¡ÿé\9fþI\17{\1e\ e\e\e\e\1a\º\.»}û¶}ó\9bß´¡¡!\ 1H\19\ f0÷¢K
+@åùóçb\1d\11b~zzj{{{*\83\9cL\83ÇÇÇJ¼ä\ 1¡$âçÁVÿ¦z\9e]¸Z­ÚÄÄ\84ÍÍÍé.ð÷®ÇÇ\1f\7f¬\ 6\ 3\ fc,\16\93¼\8cÓ\94;\16ÃùÞS\9fr\94M\81à\86ááa\8bÅb2\8dòàÎÍÍÙ³gÏd½g=p·³¡p\12ÄãñK¹jµZMsSF\ 6\9câ\ 47¾Ù`ã;ÝÝݵÓÓSe¤\99\99e2\19)YH\94\ 5\18\8bS`hhÈ\.\97\9a\1e1OüªïG?\93{\86\94\ f\1e<Ðe\9aä\vºO\94s\81@@¾)\87ÃaÕjÕ\ e\ f\ f\15)ôfp\9cÇã\916\10è     ZB.Ë\0O\0\99ðÅ°ÃÌÌÌØÈÈ\88íììÈ"\81\14\a\80e<\1e×\83H\84k¯}\86¹\15\19cËË˲ÚP\ 6d2\19   Y\ 1ªÎÍÍ©Y188h>\9fÏ\ 2\81\80\8c§\9cL­VËb±\98\86 ëëëò°Q~ÑÎ\1f\e\e³{÷îi¦Ó{z0T><<´Ç\8f\1f\9bÓé´z½.Ç.\10\98\ 3N"\18<6\82½½==H\bx¹Ó°\9b\17
+\ 5=\18½\95Èéé©mllè\9f3À¦\8cs8\1c\9asmmmÙáá¡P\fñx\0ÑÞö=Ï\86Ëå\12X\96\96;\8a÷óósÉ´z×\ 3\98RïÝ\9f±
+\98AHb\84ò\81ðÛÙÙ\11\95\8aþ\0³Z·Ûm+++\9a\aâOû*ï\aëÑ?;;k[[[æt:-\16\8b\8dÅb\96L&ÕR/\95JÂjÑí"\18\81ûÉ\9b6\ 2Ôì´¾IsAèÙ\vè§\83599i\91HDÌ\ f\1e<\94\vÁ`Pª\b"l+\95\8avl\8fÇc[[[Öh44: áÁé477§ShrrR\16\f¾ RVÚí¶\ 6Íü·\94P(Í\99ót»]\r{\7fùË_ênùÙg\9fY©T2§Ó©\9fóüü\.m.Ͻs20i³³³\92nÍÎÎÚææ¦\1d\1e\1eZ__\9f\95J%\9d\ 2ÜÉ\bnÇk\87ª\824\1e¸\16\9dNG%Z$\12Ѭ¨P(\\92\19óûý\1aò3óÊår\96L&5ô\86çQ©T$4ðûý\92U\81\93ë½N0ò\b\ 6\83\87B!¡¿éNCñe\13{Sô@W\91n/\96\17\Ð¥RI\1dÅ\17/^È×Ƚ½ÛíJÈ\80§\8cÍý\1f}?z×£\1f\8c6í`\bEÍfÓnܸ!hãÍ\9b7Íív[6\9bµl6k>\9fOe\ f.d\14ù½¿P\ 6à£\82ïÇ \ f;;ÆÉ`0h>\9fÏ\.\97°c\94(wîÜ1§Ói\1f\91vóããc[XX°n·k¯^½RÐ\ 1@\9eÞÝÎívÛ\7füÇ\7f\98Ëå²\e7nX©T\12Ú\19\9bM³Ù¼Ô\9db\9e7>>n¯_¿V{\e\86\1fó\9a½½=\99)£Ñ¨²­¡d}öÙg2\81.,,Øøø¸ýñ\8f\7f\14@³·YD÷\11æ\7f·Ûµl6k¡PH;øÂÂ\82<^(8z!±\942Ìu\18ô\12]Äz´Z-k·Ûz1z\85·l\80\94î¬\15\9bêÒÒ\92\9d\9c\9cX:\9d\16õybbBÐÙ­­-Å`õ"ØØ\8c¹#\93\ 3F\89\88\92\82ç\10n?\16\13X+½¿xø!G§R)K¥RR\9cüùÏ\7fÖ\89åv»U\ 5\1d\1c\1cØòò²MMMÙ\9fÿügU\15\8c6þÑ÷£w=\ 6`ÞÑmÁÔH4\10\13vì"½\9a°z½n.\97Ë\92ɤµZ-K$\122U²H~¿_¥b/Ñ\17\82R__\9fE£QQ_Ab³\v\8c\8d\8d©u\.\97­ÛíÊbÂÃ\8f\89ÑëõZ2\99´t:métú\12ñ
+       Õîî®\95ËeµéÏÏÏ-\1a\8dJ\9dÝl6e\92d8\8b\vöääD TÒA\90ã\10\80¾µµeÃÃò\83`\91Á$é÷û-\9bÍÚÎÎ\8e\15
+\ 5-Jï%\9e»\1f\7f.É0X*âñ¸fZ\94\fd5ûý~Ù<<\1e\8får9\e\1c\1c´\e7n\\8ax¢B@\9dÑ+=ë\8d·­Õj\96H$¬¿¿ß²Ù¬:y\ 3\ 3\ 3¢T¥R)óûý\1aq\80:Ïd2J²\14\7f\9a\\0o8\1d\18âÂ\ 4\81òupp qL.\97»ô\9dѽ½yó¦¼w¬\r\81ê½zUÌ\94gggò\ 1\12mË8 ^¯k~÷eß\8f7×c \16\8bÙg\9f}f\87\87\87\16
+\85ìáÃ\87\96H$\84Ñ¢\94á®@Ë\1e·ë\1fþð\aͯzU\15Ôô}}}Òye³Y\11\8d8¢ÉÛ\9a\98\98PûøèèÈîÝ»g©TÊ\8aÅ¢MOO[¹\V§\11,r>\9f7§Ó©Å£>N¥R\97fO\94\96¥RIò\99\ f?üP\ fô½{÷TwS.\11î\80l«×
+\93H$¤\0yÓ6\83ÄgjjÊ666Ô\14    \87ÃÒ
+f³Y{ñâÅ_@:qjg2\19\e\19\19±\99\99\19s»ÝöâÅ\vu7éàú|>\v\ 6\83¢bq\19ÇèÈ]\ 3T@/½\17¦\ 6\97/_Z©Tºt\1fcýè\ 4Çãqk4\1a\96ËåÔÐ\88F£RÏ3·\1c\1c\1cTî6á|kkk²!õ~_$UÆb1Ù_¶··\ 5\v"\84Âáp\88\8f¸½½-\15Fïïåt:­X,*\95'\9bÍ^zIãñ¸}ñÅ\17*Açææ\948\ 4va||\\9e³¥¥%k·Ûö\8f¼\1fD{±\1e\8e[·n­\ e\r\rÙÂÂ\82\8d\8c\8cX¥R±ÝÝ]Ío\98}y<\1eÛÜÜ\94>+\95JY©T²µµ5ÛØظôÀÑ!óx<²i\0\17\ 1ËÅÀ\96\16/w\r\86\80Ì0P\1cà\83¢ì!y\12ü\e,\8ct:ý\17\8b\19\89D\14´Ðh4\94\ eC\88!wF~Næ]ü\1c.\97Ëöööl\7f\7fßþøÇ?Z2\99¼T®\80\ f#ácxxXFI\14û \9dÏÏÏíùóçöêÕ«¿Ø\b\18gx<\1e¥\97¼xñÂ^¼x¡q\b­ï\99\99\19+\16\8b¢ë\16
+\ 5\e\1a\1a²p8¬!.ÆS\14,\8c\10H­I¥RöñÇ\1fÿ\ 5\10\155\ 6¥\ \100\8fÇcù|^ó*Æ+4@òù¼\bZ\10\84³Ù¬ýéO\7fÒ\ 3Ù+kC|\10\b\ 4Ôu$\ fºZ­Jq\ 3r0\97ËÙÚÚÚ%W;ê\f:z|\8fxÈèX\12\9f    '\14\81\0ê\1cþ\1cª¯V«e;;;öeÞ\ fÔ=ù|^ë1@§fvvVü\8d§O\9fên\ 3ïýøøØâñ¸\1c°}}}¶¾¾.\1d\17\16\96n·k£££Z|èTGGGJ$   \87ÃÖjµleeEI\93ÐiA\1f\97J%\9b\9e\9e\16\a\91\99\11æH\10ßñxÜ^¼xa_ûÚפ ¨ÕjæñxtBòbÞºuëR¶u¹\\16\9e\80Y
+»'\18\82h4*åÿþþ¾\8cx\9c¨4\19`\92`ù¨V«\16\f\ 6mggG³\16¼MÌjh¢°À\ e\87榦ÌãñØ\93'OdÏùÏÿüOûä\93O\14\11Åå\7feeE6\vÔ6©TÊB¡\906\89b±x      oÆÅ\1cû\v\17\17\17R¿àS\8b\12\ 6ìîîÚ[o½¥Nr\7f\7f¿-//[4\1a\15M\18Ì^¹\VìÒÙÙ\99MLL\88\87áñxô¼\84Ãaóz½699©\97\8cT¡L&c·oß\96¢(\95J]\1a8ÓÈà4"ó\8d\80ö\87\ f\1fjäCC\85® b\82l6+d\1e\9b\a\86ÌT*¥´Ò/ó~°\99òYR©\949~úÓ\9f®NLLØÇ\1f\7fl\ e\87Cmm\8eÞ`0(é\ f\92'¾¨jµª{\ 2§\96ÇãQª&;<÷­\93\93\13Eðt»]«V«¶°° \99\ eö\ 4jèÑÑQiÿ0-F"\91K\81\100ö/..ì­·Þ²b±(\89N,\16³±±1]èévñ°\82ï^\\T\9bøõë×\1axC\ ff\a£9@®ðÔÔ\94Pe$¢\84B!\19)_¿~­&\ ew\84\9füä'Ößßo\89DB\1aJ<a\1e\8fÇîܹcÑhÔ~ûÛßZ\7f\7f¿½ýöÛÖn·õ²¬¬¬(z\8aÝ\96\8d\ 4}\1dã\84Z­f\83\83\83ò¡A΢\95Í\9d\8a\91    Þ-¿ß¯õdÈÊð\1a4ú×¾ö5Ëçóöøñc\9b\9e\9eVç´R©\88Ü\ 58\bÁm<\1e·ññqÍ(q;Ð\ 2çDà\9e\v)znnN\1dG*#6z·Û­4\1e¿ßo\85BAÝãZ­fËË˶¼¼lÕjU\ 1ód3\f\r\ri\98\8c\95\ 5T\ 2â     ·\7fïû\81ÙÔëõj\18ß÷\8b_ü¢ûêÕ+»\7fÿ¾u»]kµZV­VUbÌÎÎÚúúº\1d\1f\1fÛÝ»w5\ 5/\95JJ©\ 4CM×®X,*\ 6Éáp¨)À\84\7fppP`\9d¯\7fýëÒ3öÆÿð×Ìe¸§ôv´îÝ»gwïÞµv»m\9b\9b\9b\96Ëå,\12\89È,Ç\89\88ßï\17\83\11\155\16\97Z­fëëë\ 2©p\1a÷b¿:\9dÎ%ËG»Ý\96\8e\8eïÎëõÚÌÌ\8c\ 4Ç5\1a\r\9dw¬ÑhèÎ\82ú\ 5¡ôÛo¿mëë붽½mo¿ý¶\94(ܳÆÆÆleeEi\9a·oßÖ:0\80\85q\98Édħ\84hËX\ 4¥
\1e\18\92ÃÃÃöðáCÝÃ8e9\89è*âñ\8aÅböèÑ#{ùò¥ýæ7¿\11I·V«Ùöö¶º­4Ë\18EPix½^1&Ýn·>³×ëµÁÁA\95t{{{:Aéüö\96ß$µ\92\98\89î±V«\99×ëµÅÅEѾFGGíóÏ?·\.g\v\v\vvxx(|\ 5Ò¾³³3\e\1e\1e\95\95\15{ùò¥}\99÷\83Æ\a§ùÅÅ\859nß¾½Úét4\ 3`\88Fc\82Á%ìz\0\98$\°3¼õÖ[v÷î]»¸¸°¥¥%»sç\8eår9\19ã8]\8e\8e\8elkkË<\1e\8f<:årYÁ  {{{\16\8fÇÕ\19¤\94\9b\99\99Ñ<effÆB¡\90ÍÌÌÈ\87Öl6í½÷ÞSp\ 5¡\81\fqC¡\90U*\15\11\82\91\8bÓ@\80\9bÁ)\80\84\8a\92êæÍ\9b633#.ÉÓ§O5l\1d\1d\1dµùùyûôÓOmhhÈæææÔB\7fôè\91À3\8dFÃfgg¥Ø\1e\1a\1a²\1fýèG\96\15bqûöm\rúyH\9bͦJ¬ññqËd2V(\14´V(1\8aÅ¢E£QÍ\9c\82Á \85Ãa{ýúµ0k\ 4­óûNOOÛ£G\8ftr3to6\9b¶²²"û
+e\13M\19\1aI\f¹\89|jµZöôéSEü\9e\9c\9cØÃ\87\ f­ÕjÙÌÌ\8c$lÌM\91\ 6\8aðý£\1eñz½º\ 6ÌÏÏÛðð°-//[0\18\94!ôÑ£Gê\0¢\bb\ 3Ç\7f·»»kóóó: È,çE=::²÷ß\7fß666twþ2ï\a\8e{ÖÃñôéÓÕgÏ\9e\80°\12ÐMµZÕ?C\ 2U©TÄ\1f$8\9b\16»Ëå²ùùy«×ëR-³+\11\986::ªÿ\9fÎ$w\12\98\1d\80t\98ñp"ܸqÃnݺ¥\80\ 2üM\81@@'^¯\1c)\1c\ e[½^\17O¤V«©3È)·±±!æßÙÙ\99¼QívÛ²Ù¬E£Q\e\1f\1f×\97Ì\1d\8c\ 1n2\99´n·« n2¹Z­\96½xñBA\1305z-B\17\17\17æñxl{{[w¨o|ã\ej#3ÔäÏK§ÓV«Õ¬T*iÀÎz \ eèe\89¸\.\8bÇã\9a\85Ñ-\85n\8cõ(\14
\80Ê\1c\8d\ ec§Ó±h4*\ 5\r\ 3Ûµµ5iA\99\87Öj5iTQªà)\84\16\¯×íõë×Z\ f"\97 K%\93IQ\82  |À·\97Ïçm~~^ee&\93Ñà;\18\fZ&\93±­­-©/À\87C\9fB"Ç\15\82a8ìDL£¹\Nø\85/ó~ôÚi$ÖøÙÏ~Ö\85qçóù¤ßZ\\\94w       D±×ëUn\96ÏçSÍÉ\9d\ 3»A©TR#\84\ eZ¹\¶¥¥%Ûßß×\f\87K6z?ðqp4àÁSR\81Ù*\16\8b\96Éd¤\8a@kÈ]ä\93O>\91W\8cÏ\85ä\86Ù\18ð\1f>; Õ\8b\8b\v\8bÅbr.OOOÛÑÑ\91\94å\18ø\88°%ì­ÓéØþþ¾\ 5\83A\91ª@\95ÑU}ç\9dwìââÂö÷÷u\8f\93ÙÐää¤\18ÿ½ÙØKKKò5\91á\fi\f¿\e\84-îR4~þÚzT*\15»yó¦5\9bM\v\ 4\ 2Jyáä\ 6\13Þ»\1e\9cô\98Ri&0\vs8\1c\9a}"Øm·Ûöé§\9fڻᆱ{Ûÿ¶\1e\10\981\91â@/\95\7f\11÷Ä|\vÁ8  \99\7fm=¸~0°>>>¶Ç\8f\1f\v[7==mÝn÷¯®Ç?ò~ô®\87ãÉ\93'«üM¹\¶ÃÃCåf¡ºFÝqtt¤K"`\eâRÛí¶ìú¹\Îîß¿¯Ë*ô&äÿP\91Úí¶0Ù^¯W¤'\1a)\be1ÀÕëuI\94\90B\ 3é\12¡¨xöì\99\r\ f\ f[6\9b\95âbppP\8b\86M¦7\ 6\15\11ëøø¸%\12  Q\88é^Ñi\8aF£¶»»kív[§®Ïç\93\89\ f!,\fI0\ 1Ø<\92ɤÅãqóù|öêÕ+»uë\96\80e(ÅQ\83\80³kµZ\16\8fÇ\85F@\9dQ©T\84\1dS`LÌçóöàÁ\83K\98pdeÃÃò֠åã\9e\8a\16\95a:P$²\98Q¹ ¤§\89\ 1\82\ f5ɳgÏlddäïZ\ f\1céà\aÜn·Ö\ 3·2\e°ßïWb\10£\89¿µ\1eccc6::*$\1f\7fÖëׯõ\8commÙòòò%        \18ª\90/û~ô®\87ã\a?øÁêÚÚ\9a\ 2áæççÕ\99
+\85\9c÷Ö\98øjðQ\1d\1f\1fk\ 2Î\a:==µX,¦öf«ÕÒ\8b\ 3\1f\82Î\10Ãâ^·0¡z\10¢¸tú|>Í>°VÐ%üà\83\ fÔ­CkÈð\16üZ¥R\11\95\16ùRµZU{\98\b[NeþÝÄÄ\84J
+.Û|\1f\94a4i\10\ 1\8f\8d\8dY4\1aUøßÍ\9b7mmmͦ§§m}}Ý|>\9f\91HÄÖÖÖTÎý­õh4\1aÒ>b¶d=è\0³\1e\8c-\80ïÐðøßÖ\83v>\ f.3Ì^êoïz  ¥ùÓív¿òz\80\ 6`\f\84\11\16SçW]\ fz\ 6\8b\8b\8b¶¾¾®õðûýj¸°\1e_öýè]\ fÇw¿ûÝU\1cÂ\f\89\a\a\amaaAG4\ f\18júJ¥b\87\87\87
\86c\8e\14\88Ù\165/AÖ¨\933\99\8cMMM©\95\1f\8fÇÍårÙÚÚ\9a\1d\1f\1fë\ 1\aÈ200 »\\7f\7f¿$Wù|Þ"\91\88\882=99\91à\93\12    ¯\19¤%üD½\81ß\ 4Õ\818ÀÞ\81\0øââB-|J\9aL&cwîܱóós5-@\1f°£Á\84÷x<¶¼¼lµZMß\95Ëå²Ï?ÿ\vy\86Ù×ëquÖÃ199¹\8a\10\17Qìàà ÂÀ}>\9fôrÝn×~ýë_K~Ã.¨\99Æ\0\0\ fÕIDATÐÍëõ\8aîK\87\85ú\9edLZ»dôâqBõ\9eN§U6ré$B\94ŤnO¥R:\9eé\ 6\ 5\83Ak6\9b
+xcøMH\ 2]<Ø\82½¡ñØ\1f\80s2sA\7fÉ.\88y\90x×jµªpAÔ\1aÌ©P\ e\8c\8f\8f\v¦   Ú\9a\90\85R©d»»»æp8ìÙ³g¶¶¶¦Ü³ëõ¸:ëáøÆ7¾±zpp`7oÞ\14à\91#\96ä\10p^­VKR§ÅÅEé\11\99± Qr¹\R«ß¸qü^¯\8e\\94\ 4äyÑ=\e\19\19±\89\89      \89\82Ù\19\88\19\82©N\17\a\9aQ\7f\7f¿ÝºuK^ µµ5\rA³Ù¬þß\99\99\19]¦=\1e\8fæ^½æ>\ÙápXêï³³3\95\92\0K{\ 3ñ¸[Âqìt:\96ËålqqÑnÞ¼i\1f\91Ô/[[[º\98'\93I«T*6;;k>\9fÏ>ùä\13á\18®×ãj­\87ã»ßýîj/\94\ 5\ e|0\18´ééiù­Ø\r;\9d\8eÍÏÏ[__\9f\1d\1f\1f\ 1^\99\v>L\bò´\18¦¢¦ÀÆ\81ÿ\89\8bÿá᡾,À$0ï\81P6\9bM)E\16\17\17\ 5\1a-\14
+\92f%\93I«Õj\16\89Dìøøø\92\8fò\aòñ\9b¹ÃÔøÐ`ý~¿2\80{Cé\80_â$@\19\ f\96lggG\83ÐjµjñxÜ&&&ì¿þë¿ìèèÈâñ¸\1a4tç°Á\¯ÇÕY\ fÇw¾ó\9dUZäänÁt§LÀ\ 1J\13¢ÑhX©T\92\15\82\96<mãh4ª!2Ð\98óós\r&i§ri\ 5D\8a\8b\18È&3\87D"a\93\93\93Â~¡_\f\ 4\ 2Ößß/µ\a\19b\85BÁ<\1e\8f\85B!ÛÚÚÒ°\9b\92ÈétZ8\1c\16       \98ø%,9\\8eQîw:\1dYHÐjRæÐ\9dCU±´´$Å\ 5V\88ããc»sç\8eõõõY*\95\12(ÆëõZµZ\95\9fÌçó)\fâz=®Îz8Þ}÷ÝU\97Ë%\\16P\94\81\81\ 1+\97ËV«Õ,\18\f\9aÇã±ýý}¹>\91¢ \10Èår
+\ e\aÅ]«ÕäÇ¡³\84Ý\9dÝ\13\1dCZ\88º\bLóù¼ÍÍÍÙÌÌ\8cJ\17$[\95JŶ··íÆ\8d\eâ\82`íGغ³³£ðt´et¥\18Ê\1e\1d\1dY8\1cV}Ïð¼ÓéHUÍ\94\9fîW4\1aµv»­N\1cXî±±1ÛÞÞÖ]¤¿¿ßÆÇÇíððP\88¸¡¡!\ 5\àg\ 3U\87-åz=®Îz8\9e>}ºê÷ûUcÖëuiÜ\98O9\9dNÛØØ°\83\83\ 3\98\93¸Ýn)\92\1f<x`\8dFC\96\88@  ù\86Ëå\92æëõë×*\ 3(-H(Ä\1c\89«\9a\06\ 6¬\945H\94\0s\86B!]Jiõv:\1dóz½\1a!@/"\97
+&$\97j4\88\10\8dqKïííY(\14Òî>00 {@¯8õôôT¿7_2\96\bJ5\8fÇ£Y\eäb\86»ããã
+\92»^\8f«³\1e\8e\7fÿ÷\7f_­×ë\92Ó\1c\1f\1f\vRÙË4$g7\16\8b©Ì\98\9e\9e¶Ï>ûÌFFF,\10\bHlI}\8dM\81ö1ÆG\f\9aÔøÁ`PÙYÌ'P5cã\80¥xrr"z®Ûí\96¤\88\0\ 1.£¨¨÷öö,\16\8bÉÍ\8aÀ\17J1\9f\9b\9d\v  \10j\87b±hÙlÖÊå²ÍÍÍɲ\8f¿\výd±X\14\8f\82®\12¤,Z×£££æt:¥&è\9dÍQÛÃr¼^\8f«³\1e\8e\7fý×\7f\a>??×\1fÀb¤ÓiÙB\0\85P·Ã«p»Ý644d\85BÁFGGíààÀb±\98h=ggg\8a6e\16C;\17\v\f4^\ 6¢H\8a\90Îð\99
+\85\82Õëu\9b\99\99\91L\86¬âF£aÇÇÇ\16\8dFE=B\83·´´¤äÏD"!f<DX\ 6ìÌ\83
+\85\82:j8²\v\85\82%\12    \v\87Ã:\150)\12`\8e\89\ fÈÎÔÔ\94¢w°Ë0Ó¡T\ 1øBiv½\1eWk=\1c÷ïß_%k\17\8b\amKÄ¿ÀO\82Á D®|ÙÁ`P0\1a.Áh\10Q#3/A\19ÀÔ\1fV\1fØmÒY\ 6\ 6\ 6\84ÁFÊ\83ð\15\v
+\96\ 2\80RQò\ f\ e\ e\8fO\8c(X\14õtÞH*\19\1e\1e\83\83\ 3Ëd2\97¢\85`\8ct:\1du§¶¶¶\ 4\8ca\91\90^%\12        ;99\91=\ 2õ\ 5h5PoårYpQ\ 6²ÉdÒ®×ãj­\87ãÛßþö*_äôô´\f\8a_|ñ\85\ 5\83AAbp53Ü#§        !m§Ó±¹¹9e"ïììH\8e\83¥\829\bG4pS"f¨¯wwwåµj·Û\9aÙ@xeG\ 6ÆÙn·\95˼¶¶fff³³³ªÃ\11\8bòåc3aÇìv»\97ò\9c\19>æóyµ\97Q>\10\15\85O\8b¼/\16Ï̬P(X$\12Ñ\83Ë}¨Ûí*õ£ÕjY«Õ\92Ï\v\98\rì\8bëõ¸:ëáxÿý÷W1!âP\9d\98\98\10!\bµ<\8b\10\8bÅÌáp(/\vÜ\0¾\9cíím\ 5\94cl£s\ 5}\89<+v\rD¥ØÒq`÷\9a8É8æR     w\9dèSZÐcccr\b`%á³ãØ\ 54\83£\1aÜZ>\9f7·Ûm\13\13\13"\ fá|mµZ\16
+\85\847s»ÝÖét,\9dN+\r\ 6vúýû÷¥(\1f\1a\1a²½½=K¥R\8aiÂAÌ\1d\ 6\8a-\ 4ãëõ¸Zëáx÷ÝwWÙÝ:\9d\8e¥R)±+ø ìf\b\1f_¿~m\91HDA১§V«Õ\ 4\12¡v\ 5¦Cû\17-\1ae\f:;f\1c\f)'&&d7\18\19\19\11s\ 2Åy·Û\95G«^¯[<\1e·r¹,a1¨m>7\9e) ¨Ìg\90\1cÍÎÎ\8ax\ 4\1d
+\13"¦F\16\11hkµZUÍ\rj\eÎ<\ fùññ±,\19<\1c\ 3\ 3\ 3b\91$\12      q(|>\9f~\8eëõ¸Zëáøá\ f\7f¸\9aÉdlwwWr\90b±(`\ e\1fðþýûV¯×ÅJàH\a\84C\10\1e»\0jn\8eZ\94Ø|q`¾¼^¯\10lX.\.\97.½ü>ÃÃòÍ\93\1dÕ\víÜßßWZýÑÑ\91\0\98 Þ°«\93\16\83ª\1c»\vBU,\14Ü\v0!òsP\7f\13hHK\9bÐsî(иÎÎÎ\14ìÝl6-\1a\8d*\ 6\8aa)ÿ}:\9d¶H$b×ëqµÖÃñäÉ\93Õ\.'U@2\99´`0(¼×ÖÖ\96þ\9aé;"Êóósí\96\84RÓ¶ÅóÃ\11Ì\91N\88\97\93\93\13µm\81ÐPÎà?#è\0û\ 2\ 3LPp;;;\ 2Ë øN§ÓÖh4t\99\1e\1d\1d\15\816\9bÍ*\8c\ f$\19öz\9c¼õzÝæçç\95f\82º\ 1«G8\1c\16S±^¯Ë\ 3å÷û­R©X$\12\11\13\83\87ùüü\\0U\18ýP\9bh\8dg³Y»^\8f«µ\1e\8eï|ç;«·nÝ\12cáöíÛr·f2\19\9b\98\98°\9d\9d\1d\rî0£¥Ói+\14
+\8a      "\14\9cv&íM¢\88(\19èÈD£Qk4\1aò\16\85Ãa[XXPÈD¯\12\80\19\8bËå\12Ó\ 2æ\ 2ü\f<D\85BA\12 Ü·Løq·2$¤®\1e\1d\1d5\8fÇcÕjÕ\9e?\7fnwîܱÝÝ]kµZv÷î]aÈ©çc±\98U«U¡Õ ×\92êHè]2\99Ô}\84\9d\15\93¡Ëå²\83\83\ 3\95e¸Ä\87\86\86ìz=®Öz8¾ÿýï¯&\12        ÁBÇÆÆ,\91H\88\12L\r\eÃ9¦Ûx\870[R\ fw:\1dÅà s9<<T64¢Ï©©)©\aX$ (½`NÊ\12jaìò´§\ f\ e\ e,\9fÏËß³¸¸(\9b~\7f\7f¿}þùç2NÞ¼yS_(;<     \98+++\92Û\9c\9f\9fÛÆÆ\86Rgp
+ã¡êÕÕqÉ\a\1d@©F\12%\\10\18\94¨&NNNDÍ¢ëu½\1eWk=\1cO\9e<Y\ 5B²°° c\13ÄX©T\12v\8d\bÐt:­\9d+\10\bX½^\97L\ 5\85@¹\¶x<®\84\96z½.¢\ f\ eRä>½\11\9c ÀFxJîï½{÷l}}]\17vvKêê±±1Ëd2\ 2ÔÀÂh4\1a
\ 6BJè:,óóós;;;\93\ 5\9dÖ5H4ÈL\ÔI]á3ÀÅ Õ\92ò#\18\fZ,\16³ßÿþ÷ffV*\95\94ê922¢ÈX\10Ñ×ëqµÖÃñ½ï}o\95YC>\9f\97}\9a8"\ 2Óè<q\ 1Ìf³¶´´¤.\ fØ/ÂÐ\1e<x`\a\a\aöðáC\85³AX\8aÅbæóùdãÆ\95êp8¬^¯+I1\16\8b\99ßï·µµ5\e\e\e\13´òääD\8b\ 5\95\b©\vw\90Þ09R&ÍÌB¡\90\ 5\83Ak4\1a\ 2\99îïïÛìì¬\1d\1c\1cØÌÌ\8c¼MìØKKKê²¥R)[[[³ÙÙYÍxÀXCa
+\85B2\182\1cþðÃ\ fE\9d\ 2±\r\8f\82Nß­[·ìââ®×ãj­\87ãéÓ§«ôú777õe:\9dNy\7fzcsHE\f\85BÚ­èP\8d\8f\8f[¥R\11ùÇãñØóçÏ­Ûí
+jJÙ±··§\ 5\80[\ eC\11:/|Gf\15\884  ¡«V«6::*R0R\9eóós{üø±\9d\9c\9cX¹\\16%\96\14\8f^ÁéÅÅ\85}ñÅ\17
+\a\87]\ 2Q7\1e\8fÛöö¶\1d\1d\1d        zS.\97¥PðûýÂ\7f¡ß{õê\95N
+ÚÔffSSS\9a       \ 5\ 2\ 1kµZ20\9e\9d\9dY£Ñ°Z­f×ëqµÖÃñ/ÿò/«tM\184ÂG'SùøøX»\ 3S~·Ûm©TJ\83¹Þ@êX,f\13\13\13\12g6\1a\rËd2\1aÔa[G\19\80M\1eo\ eÎS\ 6\88\81@@\8b@~\19q¦¨\14\9aͦb\99ÆÆÆä eg%Ð-\93Éèç\84   ±¼¼lcccöÉ'\9fX__\9fݹsG\ 2ZèDggg¶³³#D6s\96l6{)r\96\87\ríZ½^W\1cêùù¹|X\84"\808K¥Rò)]¯ÇÕZ\ fÇ·¿ýíULu¨\92Ýn·\1d\1f\1fÛ§\9f~j\9dNÇîÝ»gÕjÕ\8aÅ¢-..\9aÓéÔ´\9b \ 1ðmpà7775K\b\85BRyÃG\[[S\88\95\88G\99=\0ï<::\12;\ fcÞàà ¹Ýnµ\9b\89°¥5L¾\15\1c        ¼JHm\18LÂUD¯\aB\1a\96D³Ù´F£aËËËB\8dñÿöÒµNOOí¿ÿû¿-\10\b(X"\9dNËÜǽÇãñØÆÆ\86åóys¹\ò<íììX$\12±þþ~»^\8f«µ\1e\8eo~ó\9b«\v\v\vºÈñ\ 6\92\1c\85©~·Ûµ½½=ëë볩©)1ó\10\8b\83Ö322b\93\93\93¶¼¼,ã\1d\14\9fQ\14\80°\86ý\a¹\b\14\19\81ç´\9f)9¸Ü\1e\1e\1eZ>\9f·\91\91\11u¤èXa\10$A%\10\büß<ßÿ\81\90z<\1e[YYQÇhppP*\ 5¬\17\18ôÀ¡U*\15\v\ 6\83\16\8fÇ-\99LjwëÅi#²\ 5ñ\r\14\95Ü,hÀï¼ó\8e\18\81×ëqµÖÃñoÿöo«;;;\82uîííÙúúº¹Ýn¥g0ÔD&S©T´s`ý&*\ 6>")\19333ff\96H$´H'''ò7Qÿf2\19\ 5ï\91w¼»»k\ 3\ 3\ 3vãÆ\rᢡø²«\96J%ÙÒ].\97>/\89,\äA(cV¤í\9cL&ÍápÈUKH\ 6*pf6ÙlÖNNN¤0@\9eÔn·-\91HØÒÒ\92\88Å@V¹\18\83µ\9e\98\98°íím\e\1e\1e¶¯\7fýërâ\924Ã\æz=®Özôýüç?ïÂ-8??×\97\ 1\ 3\8fð\ 2\ 4Ä5\9bM»}û¶\15\8bEk4\1a\7faW\80©W¯×-\93ÉØ«W¯ìÉ\93'Ößßo~¿_å\b\9e'j~ÂêHí¤Ü\99\9a\9aRkÚåréKæB^(\14¤#cÒOØ\ 2s\10\³p'\90ì\f\ f\ f[­V\93Ø\15ùN(\14RÖñìì¬íììhG¤Á@ô-\ 1ô\91\1c\ e\87Ðk\83\83\836==mûûûb­ó]\83¤¦Ä\e\1e\1e¶f³i×ëqµÖÃñÞ{ï­ö\92\84°O×j5ËçóB\r\93\8aQ©T¤Ì\86\ f\81¼\85¤\v\ 2ç\8aÅ¢\95Ëe\9b\98\98°ùùy)ÄÝn·hFì\80\94\ 4\18Þ\86\86\86¤gCKÇ\ 5\95\1dº¯¯O\89\86Ð\84\18H\9e\9e\9eZ4\1a\15Y       í\1d._¯×+Í\1c\ f"¨jZß\9dNGVy8\12¸l        ;@
+ôüùsóz½
+°óz½655%5w&\93\11[ãôôTv\8d¹¹9ùµ &_¯ÇÕZ\8fÿ\ 3\ 3dDÿÚ³{V\0\0\0\0IEND®B`\82--TEST--
+pecl/http-v2 - general and stat
+--SKIPIF--
+<?php
+if (!extension_loaded("http")) {
+       die("skip pecl/http needed");
+}
+if (!class_exists("http\\Client", false)) {
+       die("skip pecl/http-v2 with curl support needed");
+}
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
+
+$c = new http\Client("curl", "php.net:80");
+do {
+       $c->enqueue(new http\Client\Request("GET", "http://php.net"));
+} while (count($c) < 3);
+
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
+
+unset($c);
+
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
+
+?>
+Done
+--EXPECTF--
+Test
+array(2) {
+  ["http\Client\Curl"]=>
+  array(0) {
+  }
+  ["http\Client\Curl\Request"]=>
+  array(0) {
+  }
+}
+array(2) {
+  ["http\Client\Curl"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(1)
+      ["free"]=>
+      int(0)
+    }
+  }
+  ["http\Client\Curl\Request"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(3)
+      ["free"]=>
+      int(0)
+    }
+  }
+}
+array(2) {
+  ["http\Client\Curl"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(0)
+      ["free"]=>
+      int(1)
+    }
+  }
+  ["http\Client\Curl\Request"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(0)
+      ["free"]=>
+      int(3)
+    }
+  }
+}
+Done
+--TEST--
+pecl/http-v2 - clean with name and id
+--SKIPIF--
+<?php
+if (!extension_loaded("http")) {
+       die("skip pecl/http needed");
+}
+if (!class_exists("http\\Client", false)) {
+       die("skip pecl/http-v2 with curl support needed");
+}
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+$c = new http\Client("curl", "php.net:80");
+do {
+       $c->enqueue(new http\Client\Request("GET", "http://php.net"));
+} while (count($c) < 3);
+
+unset($c);
+
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
+
+
+raphf\clean_persistent_handles("http\\Client\\Curl");
+raphf\clean_persistent_handles("http\\Client\\Curl\\Request", "php.net:80");
+
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
+
+?>
+Done
+--EXPECTF--
+Test
+array(2) {
+  ["http\Client\Curl"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(0)
+      ["free"]=>
+      int(1)
+    }
+  }
+  ["http\Client\Curl\Request"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(0)
+      ["free"]=>
+      int(3)
+    }
+  }
+}
+array(2) {
+  ["http\Client\Curl"]=>
+  array(0) {
+  }
+  ["http\Client\Curl\Request"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(0)
+      ["free"]=>
+      int(0)
+    }
+  }
+}
+Done
+--TEST--
+pecl/http-v2 - clean with id only
+--SKIPIF--
+<?php
+if (!extension_loaded("http")) {
+       die("skip pecl/http needed");
+}
+if (!class_exists("http\\Client", false)) {
+       die("skip pecl/http-v2 with curl support needed");
+}
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+$c = new http\Client("curl", "php.net:80");
+do {
+       $c->enqueue(new http\Client\Request("GET", "http://php.net"));
+} while (count($c) < 3);
+
+unset($c);
+
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
+
+raphf\clean_persistent_handles(null, "php.net:80");
+
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
+
+?>
+Done
+--EXPECTF--
+Test
+array(2) {
+  ["http\Client\Curl"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(0)
+      ["free"]=>
+      int(1)
+    }
+  }
+  ["http\Client\Curl\Request"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(0)
+      ["free"]=>
+      int(3)
+    }
+  }
+}
+array(2) {
+  ["http\Client\Curl"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(0)
+      ["free"]=>
+      int(0)
+    }
+  }
+  ["http\Client\Curl\Request"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(0)
+      ["free"]=>
+      int(0)
+    }
+  }
+}
+Done
+--TEST--
+pecl/http-v2 - partial clean
+--SKIPIF--
+<?php
+if (!extension_loaded("http")) {
+       die("skip pecl/http needed");
+}
+if (!class_exists("http\\Client", false)) {
+       die("skip pecl/http-v2 with curl support needed");
+}
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
+
+$c = new http\Client("curl", "php.net:80");
+$c2 = new http\Client("curl", "php.net:80");
+do {
+       $c->enqueue(new http\Client\Request("GET", "http://php.net"));
+       $c2->enqueue(new http\Client\Request("GET", "http://php.net"));
+} while (count($c) < 3);
+
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
+
+unset($c);
+
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
+
+raphf\clean_persistent_handles();
+
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
+
+?>
+Done
+--EXPECTF--
+Test
+array(2) {
+  ["http\Client\Curl"]=>
+  array(0) {
+  }
+  ["http\Client\Curl\Request"]=>
+  array(0) {
+  }
+}
+array(2) {
+  ["http\Client\Curl"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(2)
+      ["free"]=>
+      int(0)
+    }
+  }
+  ["http\Client\Curl\Request"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(6)
+      ["free"]=>
+      int(0)
+    }
+  }
+}
+array(2) {
+  ["http\Client\Curl"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(1)
+      ["free"]=>
+      int(1)
+    }
+  }
+  ["http\Client\Curl\Request"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(3)
+      ["free"]=>
+      int(3)
+    }
+  }
+}
+array(2) {
+  ["http\Client\Curl"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(1)
+      ["free"]=>
+      int(0)
+    }
+  }
+  ["http\Client\Curl\Request"]=>
+  array(1) {
+    ["php.net:80"]=>
+    array(2) {
+      ["used"]=>
+      int(3)
+      ["free"]=>
+      int(0)
+    }
+  }
+}
+Done
+--TEST--
+raphf test
+--SKIPIF--
+<?php
+if (!extension_loaded("raphf")) {
+       die("skip need ext/raphf");
+}
+if (!defined("RAPHF_TEST")) {
+       die("skip need RAPHF_TEST defined (-DPHP_RAPHF_TEST=1)");
+}
+?>
+--INI--
+raphf.persistent_handle.limit=0
+--FILE--
+<?php
+
+function dumper($id) {
+       return function() use ($id) {
+               echo "### back '$id':\n";
+               for ($i=0; $i<func_num_args(); ++$i) {
+                       echo "#### arg $i: ";
+                       var_dump(func_get_arg($i));
+               }
+               /* relay arguments back */
+               return func_get_args();
+       };
+}
+
+echo "## call provide:\n";
+var_dump(raphf\provide("test",dumper("ctor"),dumper("copy"),dumper("dtor"),"data value",dumper("data_dtor")));
+
+echo "## call concede:\n";
+var_dump($rf = raphf\concede("test","1"));
+
+echo "## call handle_ctor:\n";
+var_dump($h = raphf\handle_ctor($rf, 1));
+
+echo "## call handle_copy:\n";
+var_dump($h2 = raphf\handle_copy($rf, $h));
+var_dump(raphf\stat_persistent_handles());
+
+echo "## call handle_dtor:\n";
+var_dump(raphf\handle_dtor($rf, $h));
+var_dump(raphf\stat_persistent_handles());
+
+echo "## call handle_dtor:\n";
+var_dump(raphf\handle_dtor($rf, $h2));
+var_dump(raphf\stat_persistent_handles());
+
+echo "## cleanup:\n";
+var_dump(raphf\dispute($rf), $rf);
+var_dump(raphf\conceal("test"));
+var_dump(raphf\stat_persistent_handles());
+
+?>
+--EXPECTF--
+## call provide:
+bool(true)
+## call concede:
+resource(4) of type (raphf_user)
+## call handle_ctor:
+### back 'ctor':
+#### arg 0: string(10) "data value"
+#### arg 1: int(1)
+array(2) {
+  [0]=>
+  string(10) "data value"
+  [1]=>
+  int(1)
+}
+## call handle_copy:
+### back 'copy':
+#### arg 0: string(10) "data value"
+#### arg 1: array(2) {
+  [0]=>
+  string(10) "data value"
+  [1]=>
+  int(1)
+}
+array(2) {
+  [0]=>
+  string(10) "data value"
+  [1]=>
+  array(2) {
+    [0]=>
+    string(10) "data value"
+    [1]=>
+    int(1)
+  }
+}
+object(stdClass)#%d (1) {
+  ["test"]=>
+  array(1) {
+    [1]=>
+    array(2) {
+      ["used"]=>
+      int(2)
+      ["free"]=>
+      int(0)
+    }
+  }
+}
+## call handle_dtor:
+### back 'dtor':
+#### arg 0: string(10) "data value"
+#### arg 1: array(2) {
+  [0]=>
+  string(10) "data value"
+  [1]=>
+  int(1)
+}
+NULL
+object(stdClass)#%d (1) {
+  ["test"]=>
+  array(1) {
+    [1]=>
+    array(2) {
+      ["used"]=>
+      int(1)
+      ["free"]=>
+      int(0)
+    }
+  }
+}
+## call handle_dtor:
+### back 'dtor':
+#### arg 0: string(10) "data value"
+#### arg 1: array(2) {
+  [0]=>
+  string(10) "data value"
+  [1]=>
+  array(2) {
+    [0]=>
+    string(10) "data value"
+    [1]=>
+    int(1)
+  }
+}
+NULL
+object(stdClass)#%d (1) {
+  ["test"]=>
+  array(1) {
+    [1]=>
+    array(2) {
+      ["used"]=>
+      int(0)
+      ["free"]=>
+      int(0)
+    }
+  }
+}
+## cleanup:
+bool(true)
+resource(4) of type (Unknown)
+### back 'data_dtor':
+#### arg 0: string(10) "data value"
+bool(true)
+bool(false)
+\9f      \99e)6e!?J\8cÌ\97w±t,øc\13\ 2\0\0\0GBMB
\ No newline at end of file