$a->compressFiles(array()); try { $a->decompressFiles(); } catch (Exception $e) { echo $e->getMessage() . "\n"; } $a->copy(array()); try { $a->copy('a', 'b'); } catch (Exception $e) { echo $e->getMessage() . "\n"; } $a->offsetExists(array()); $a->offsetGet(array()); ini_set('phar.readonly', 0); $a->offsetSet(array()); ini_set('phar.readonly', 1); $b->offsetUnset(array()); try { $a->offsetUnset('a'); } catch (Exception $e) { echo $e->getMessage() . "\n"; } $a->addEmptyDir(array()); $a->addFile(array()); $a->addFromString(array()); try { $a->setMetadata('a'); } catch (Exception $e) { echo $e->getMessage() . "\n"; }
function offsetSet($k, $v) { $this->addFileToHash($v); parent::offsetSet($k, $v); }
$phar->setDefaultStub(); $phar->setAlias('susan'); $phar['a.txt'] = "first file\n"; $phar['b.txt'] = "second file\n"; try { $phar->offsetGet('.phar/stub.php'); } catch (Exception $e) { echo $e->getMessage() . "\n"; } try { $phar->offsetGet('.phar/alias.txt'); } catch (Exception $e) { echo $e->getMessage() . "\n"; } try { $phar->offsetSet('.phar/stub.php', '<?php __HALT_COMPILER(); ?>'); } catch (Exception $e) { echo $e->getMessage() . "\n"; } var_dump(strlen($phar->getStub())); try { $phar->offsetUnset('.phar/stub.php'); } catch (Exception $e) { echo $e->getMessage() . "\n"; } var_dump(strlen($phar->getStub())); try { $phar->offsetSet('.phar/alias.txt', 'dolly'); } catch (Exception $e) { echo $e->getMessage() . "\n"; }