Пример #1
0
 /**
  * Open a PHAR archive. If it does not exist, attempt to create it.
  *
  * @param  string  $filename    Filename (see original documentation).
  * @param  int     $flags       Flags (see original documentation).
  * @param  string  $alias       Alias (see original documentation).
  * @return void
  */
 function __construct($filename, $flags = null, $alias = null)
 {
     if (null !== $alias) {
         parent::__construct($filename, $flags, $alias);
     } elseif (null !== $flags) {
         parent::__construct($filename, $flags);
     } else {
         parent::__construct($filename);
     }
     $this->setSignatureAlgorithm(static::SHA1);
     $this->setMetadata(['author' => 'fruux GmbH (https://fruux.com/)', 'license' => 'Modified BSD License (http://sabre.io/license/)', 'copyright' => 'Copyright (C) 2015 fruux GmbH (https://fruux.com/)', 'datetime' => date('c')]);
 }
Пример #2
0
<?php

require_once 'files/phar_oo_test.inc';
$phar = new Phar($fname);
var_dump($phar->getVersion());
var_dump(count($phar));
class MyPhar extends Phar
{
    function __construct()
    {
    }
}
try {
    $phar = new MyPhar();
    var_dump($phar->getVersion());
} catch (LogicException $e) {
    var_dump($e->getMessage());
}
try {
    $phar = new Phar('test.phar');
    $phar->__construct('oops');
} catch (LogicException $e) {
    var_dump($e->getMessage());
}
?>
===DONE===
<?php 
unlink(dirname(__FILE__) . '/files/phar_oo_001.phar.php');
__halt_compiler();
?>
Пример #3
0
Файл: build.php Проект: fjg/sacy
 function __construct($fname, $flags)
 {
     parent::__construct($fname, $flags);
     $this->hash = null;
 }