当前位置: 首页>>代码示例>>PHP>>正文


PHP Phar::setMetadata方法代码示例

本文整理汇总了PHP中Phar::setMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP Phar::setMetadata方法的具体用法?PHP Phar::setMetadata怎么用?PHP Phar::setMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phar的用法示例。


在下文中一共展示了Phar::setMetadata方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addFile

 /**
  * save a file inside this package
  * @param string relative path within the package
  * @param string|resource file contents or open file handle
  */
 function addFile($path, $fileOrStream)
 {
     if (!$this->_started) {
         // save package.xml name
         $this->phar->setMetadata($path);
         $this->_started = true;
     }
     $this->phar[$path] = $fileOrStream;
 }
开发者ID:peopleplan,项目名称:Pyrus,代码行数:14,代码来源:Phar.php

示例2: makePlugin

 /**
  * Makes a .phar packaged PocketMine plugin from a source directory.
  *
  * @param $sourcePath
  * @param $pharOutputLocation
  * @param $options
  * @return bool
  * @throws \Exception
  */
 public static function makePlugin($sourcePath, $pharOutputLocation, $options)
 {
     /* Removes Leading '/' */
     $sourcePath = rtrim(str_replace("\\", "/", realpath($sourcePath)), "/") . "/";
     $description = self::getPluginDescription($sourcePath . "/plugin.yml");
     if ($options & self::MAKEPLUGIN_REAL_OUTPUT_PATH) {
         $pharPath = $pharOutputLocation;
     } else {
         $pharPath = $pharOutputLocation . DIRECTORY_SEPARATOR . $description->getName() . "_v" . $description->getVersion() . ".phar";
     }
     if (file_exists($pharPath)) {
         throw new \Exception("Phar path already exists");
     }
     $phar = new \Phar($pharPath);
     $phar->setMetadata(["name" => $description->getName(), "version" => $description->getVersion(), "main" => $description->getMain(), "api" => $description->getCompatibleApis(), "depend" => $description->getDepend(), "description" => $description->getDescription(), "authors" => $description->getAuthors(), "website" => $description->getWebsite(), "creationDate" => time()]);
     $phar->setStub('<?php echo "PocketMine-MP plugin ' . $description->getName() . ' v' . $description->getVersion() . '\\nThis file has been generated using DevTools v' . self::getVersion() . ' at ' . date("r") . '\\n----------------\\n";if(extension_loaded("phar")){$phar = new \\Phar(__FILE__);foreach($phar->getMetadata() as $key => $value){echo ucfirst($key).": ".(is_array($value) ? implode(", ", $value):$value)."\\n";}} __HALT_COMPILER();');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($sourcePath)) as $file) {
         $path = ltrim(str_replace(["\\", $sourcePath], ["/", ""], $file), "/");
         if ($path[0] === "." or strpos($path, "/.") !== false) {
             continue;
         }
         $phar->addFile($file, $path);
     }
     if ($options * self::MAKEPLUGIN_COMPRESS) {
         $phar->compressFiles(\Phar::GZ);
     }
     $phar->stopBuffering();
     return true;
 }
开发者ID:sekjun9878,项目名称:makeplugin,代码行数:40,代码来源:MakePlugin.php

示例3: execute

 public function execute(CommandSender $sender, $commandLabel, array $args)
 {
     if (!$this->testPermission($sender)) {
         return false;
     }
     if (count($args) === 0) {
         $sender->sendMessage(TextFormat::RED . "Usage: " . $this->usageMessage);
         return true;
     }
     $pluginName = trim(implode(" ", $args));
     if ($pluginName === "" or !($plugin = Server::getInstance()->getPluginManager()->getPlugin($pluginName)) instanceof Plugin) {
         $sender->sendMessage(TextFormat::RED . "プラグインが存在しません");
         return true;
     }
     $description = $plugin->getDescription();
     if (!$plugin->getPluginLoader() instanceof FolderPluginLoader) {
         $sender->sendMessage(TextFormat::RED . "プラグイン " . $description->getName() . "はフォルダではありません");
         return true;
     }
     $pharPath = Server::getInstance()->getPluginPath() . DIRECTORY_SEPARATOR . "PocketMine-MO" . DIRECTORY_SEPARATOR . $description->getName() . "_v" . $description->getVersion() . ".phar";
     if (file_exists($pharPath)) {
         $sender->sendMessage("pharファイルが既に存在しているため、上書きします");
         @unlink($pharPath);
     }
     $phar = new \Phar($pharPath);
     $phar->setMetadata(["name" => $description->getName(), "version" => $description->getVersion(), "main" => $description->getMain(), "api" => $description->getCompatibleApis(), "geniapi" => $description->getCompatibleGeniApis(), "depend" => $description->getDepend(), "description" => $description->getDescription(), "authors" => $description->getAuthors(), "website" => $description->getWebsite(), "creator" => "PocketMine-MO MakePluginCommand", "creationDate" => time()]);
     if ($description->getName() === "DevTools") {
         $phar->setStub('<?php require("phar://". __FILE__ ."/src/DevTools/ConsoleScript.php"); __HALT_COMPILER();');
     } else {
         $phar->setStub('<?php echo "PocketMine-MP/ plugin ' . $description->getName() . ' v' . $description->getVersion() . '\\nThis file has been generated using PocketMine-MO by Meshida at ' . date("r") . '\\n----------------\\n";if(extension_loaded("phar")){$phar = new \\Phar(__FILE__);foreach($phar->getMetadata() as $key => $value){echo ucfirst($key).": ".(is_array($value) ? implode(", ", $value):$value)."\\n";}} __HALT_COMPILER();');
     }
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $reflection = new \ReflectionClass("pocketmine\\plugin\\PluginBase");
     $file = $reflection->getProperty("file");
     $file->setAccessible(true);
     $filePath = rtrim(str_replace("\\", "/", $file->getValue($plugin)), "/") . "/";
     $phar->startBuffering();
     foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($filePath)) as $file) {
         $path = ltrim(str_replace(["\\", $filePath], ["/", ""], $file), "/");
         if ($path[0] === "." or strpos($path, "/.") !== false) {
             continue;
         }
         $phar->addFile($file, $path);
         $sender->sendMessage($path . "を追加しています...");
     }
     foreach ($phar as $file => $finfo) {
         /** @var \PharFileInfo $finfo */
         if ($finfo->getSize() > 1024 * 512) {
             $finfo->compress(\Phar::GZ);
         }
     }
     if (!isset($args[1]) or isset($args[1]) and $args[1] != "nogz") {
         $phar->compressFiles(\Phar::GZ);
     }
     $phar->stopBuffering();
     $sender->sendMessage("pharプラグイン " . $description->getName() . " v" . $description->getVersion() . " は" . $pharPath . "上に生成されました");
     return true;
 }
开发者ID:AnonymousProjects,项目名称:PocketMine-MP-Original,代码行数:58,代码来源:MakePluginCommand.php

示例4: makeServerCommand

 private function makeServerCommand(CommandSender $sender, Command $command, $label, array $args)
 {
     $server = Server::getInstance();
     $pharPath = \pocketmine\DATA . $server->getName() . "_translate.phar";
     if (file_exists($pharPath)) {
         $sender->sendMessage($server->getName() . "_translate.phar" . $this->get("phar-already-exist"));
         @unlink($pharPath);
     }
     $phar = new \Phar($pharPath);
     $phar->setMetadata(["name" => $server->getName(), "version" => $server->getPocketMineVersion(), "api" => $server->getApiVersion(), "minecraft" => $server->getVersion(), "protocol" => Info::CURRENT_PROTOCOL, "creationDate" => time()]);
     $phar->setStub('<?php define("pocketmine\\\\PATH", "phar://". __FILE__ ."/"); require_once("phar://". __FILE__ ."/src/pocketmine/PocketMine.php");  __HALT_COMPILER();');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $filePath = substr(\pocketmine\PATH, 0, 7) === "phar://" ? \pocketmine\PATH : realpath(\pocketmine\PATH) . "/";
     $filePath = rtrim(str_replace("\\", "/", $filePath), "/") . "/";
     foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($filePath . "src")) as $file) {
         $path = ltrim(str_replace(array("\\", $filePath), array("/", ""), $file), "/");
         if ($path[0] === "." or strpos($path, "/.") !== false or substr($path, 0, 4) !== "src/") {
             continue;
         }
         echo "추가 중... " . $file->getFilename() . "\n";
         foreach ($this->messages["translation"][$args[0]] as $index => $phpfile) {
             if ($file->getFilename() == $index) {
                 $translate = file_get_contents($file);
                 // TODO
                 foreach ($this->messages["translation"][$args[0]][$file->getFilename()] as $index => $text) {
                     $translate = str_replace($index, $text, $translate);
                     echo "변경완료 [{$index}] [{$text}]\n";
                 }
                 if (!file_exists(\pocketmine\DATA . "extract/" . explode($file->getFilename(), $path)[0])) {
                     mkdir(\pocketmine\DATA . "extract/" . explode($file->getFilename(), $path)[0], 0777, true);
                 }
                 echo "폴더생성 " . \pocketmine\DATA . "extract/" . explode($file->getFilename(), $path)[0] . "\n";
                 file_put_contents(\pocketmine\DATA . "extract/" . $path, $translate);
                 break;
             }
         }
         if (file_exists(\pocketmine\DATA . "extract/" . $path)) {
             $phar->addFile(\pocketmine\DATA . "extract/" . $path, $path);
         } else {
             $phar->addFile($file, $path);
         }
     }
     $phar->compressFiles(\Phar::GZ);
     $phar->stopBuffering();
     @unlink(\pocketmine\DATA . "extract/");
     $sender->sendMessage($server->getName() . "_translate.phar" . $this->get("phar-translate-complete") . $pharPath);
     return true;
 }
开发者ID:EmreTr1,项目名称:rtr,代码行数:49,代码来源:Babel.php

示例5: execute

 public function execute(CommandSender $sender, $commandLabel, array $args)
 {
     if (!$this->testPermission($sender)) {
         return false;
     }
     $server = $sender->getServer();
     $pharPath = Server::getInstance()->getPluginPath() . DIRECTORY_SEPARATOR . "PocketMine-MO" . DIRECTORY_SEPARATOR . $server->getName() . "_" . $server->getPocketMineVersion() . ".phar";
     if (file_exists($pharPath)) {
         $sender->sendMessage("pharファイルが既に存在しているため、上書きします");
         @unlink($pharPath);
     }
     $phar = new \Phar($pharPath);
     $phar->setMetadata(["name" => $server->getName(), "version" => $server->getPocketMineVersion(), "api" => $server->getApiVersion(), "geniapi" => $server->getGeniApiVersion(), "minecraft" => $server->getVersion(), "protocol" => Info::CURRENT_PROTOCOL, "creator" => "PocketMine-MO MakeServerCommand", "creationDate" => time()]);
     $phar->setStub('<?php define("pocketmine\\\\PATH", "phar://". __FILE__ ."/"); require_once("phar://". __FILE__ ."/src/pocketmine/PocketMine.php");  __HALT_COMPILER();');
     $phar->setSignatureAlgorithm(\Phar::SHA1);
     $phar->startBuffering();
     $filePath = substr(\pocketmine\PATH, 0, 7) === "phar://" ? \pocketmine\PATH : realpath(\pocketmine\PATH) . "/";
     $filePath = rtrim(str_replace("\\", "/", $filePath), "/") . "/";
     foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($filePath . "src")) as $file) {
         $path = ltrim(str_replace(["\\", $filePath], ["/", ""], $file), "/");
         if ($path[0] === "." or strpos($path, "/.") !== false or substr($path, 0, 4) !== "src/") {
             continue;
         }
         $phar->addFile($file, $path);
         $sender->sendMessage($path . "を追加しています...");
     }
     foreach ($phar as $file => $finfo) {
         /** @var \PharFileInfo $finfo */
         if ($finfo->getSize() > 1024 * 512) {
             $finfo->compress(\Phar::GZ);
         }
     }
     if (!isset($args[0]) or isset($args[0]) and $args[0] != "nogz") {
         $phar->compressFiles(\Phar::GZ);
     }
     $phar->stopBuffering();
     $sender->sendMessage($server->getName() . " " . $server->getPocketMineVersion() . "のpharファイルが" . $pharPath . "に生成されました");
     return true;
 }
开发者ID:AnonymousProjects,项目名称:PocketMine-MP-Original,代码行数:39,代码来源:MakeServerCommand.php

示例6: RecursiveIteratorIterator

 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
LICENSE;
$file = 'psx-' . VERSION . '.phar';
$dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(PATH), RecursiveIteratorIterator::SELF_FIRST);
$phar = new Phar($file, 0, $file);
$phar->setMetadata($license);
foreach ($dir as $file) {
    $path = (string) $file;
    $name = substr($path, 12);
    // remove psx/library/ from path
    if ($file->isFile()) {
        $phar->addFromString($name, php_strip_whitespace($path));
    } else {
        if ($file->isDir() && $file->getFilename() != '.' && $file->getFilename() != '..') {
            $phar->addEmptyDir($name);
        }
    }
    echo 'A ' . $name . "\n";
}
开发者ID:seytar,项目名称:psx,代码行数:31,代码来源:generate-phar.php

示例7: buildPhar

 /**
  * Build and configure Phar object.
  *
  * @return Phar
  */
 private function buildPhar()
 {
     $phar = new Phar($this->destinationFile);
     if (!empty($this->stubPath)) {
         $phar->setStub(file_get_contents($this->stubPath));
     } else {
         if (!empty($this->cliStubFile)) {
             $cliStubFile = $this->cliStubFile->getPathWithoutBase($this->baseDirectory);
         } else {
             $cliStubFile = null;
         }
         if (!empty($this->webStubFile)) {
             $webStubFile = $this->webStubFile->getPathWithoutBase($this->baseDirectory);
         } else {
             $webStubFile = null;
         }
         $phar->setDefaultStub($cliStubFile, $webStubFile);
     }
     if ($this->metadata === null) {
         $this->createMetaData();
     }
     if ($metadata = $this->metadata->toArray()) {
         $phar->setMetadata($metadata);
     }
     if (!empty($this->alias)) {
         $phar->setAlias($this->alias);
     }
     return $phar;
 }
开发者ID:tammyd,项目名称:phing,代码行数:34,代码来源:PharPackageTask.php

示例8: microtime

header("Content-Type: text/plain");
$input = json_decode(file_get_contents("php://input"), true);
if (getallheaders()["X-GitHub-Event"] === "push") {
    $startTime = microtime(true);
    /*      $archives = $input["repository"]["archive_url"];
            $url = str_replace(["{archive_format}", "{/ref}"], ["zipball", ""], $archives);
            $rawData = getURL($url);
            $zipPath = tempnam("", "zip");
            file_put_contents($zipPath, $rawData);
            $zip = new ZipArchive;
            $zip->open($zipPath);*/
    $path = "/var/www/html/releases/ImagicalMine.phar";
    @unlink($path);
    $phar = new Phar($path);
    $phar->setMetadata(["name" => "ImagicalMine", "version" => "#" . substr($input["after"], 0, 7), "api" => "1.13.0", "minecraft" => "0.13.0", "protocol" => 38, "creationDate" => time()]);
    $phar->setStub('<?php define("pocketmine\\\\PATH", "phar://". __FILE__ ."/"); require_once("phar://". __FILE__ ."/src/pocketmine/PocketMine.php");  __HALT_COMPILER();');
    $phar->setSignatureAlgorithm(\Phar::SHA1);
    $phar->startBuffering();
    /*$cnt = 1;
      for($i = 0; $i < $zip->numFiles; $i++){
              $name = $zip->getNameIndex($i);
              if(strpos($name, "src/") === 27 and substr($name, -1) !== "/"){
                      $phar->addFromString($name = substr($name, 27), $buffer = $zip->getFromIndex($i));
                      echo "[" . (++$cnt) . "] Adding " . round(strlen($buffer) / 1024, 2) . " KB to /$name", PHP_EOL;
              }
      }*/
    chdir("/ImagicalMine");
    echo `git pull --no-edit --recurse-submodules`;
    //$phar->buildFromDirectory("/ImagicalMine");
    foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator("/ImagicalMine/src")) as $file) {
开发者ID:PocketServers,项目名称:ImagicalMine,代码行数:30,代码来源:JenkinsTest.php

示例9: buildPhar

 /**
  * Build and configure Phar object.
  *
  * @return Phar
  */
 private function buildPhar()
 {
     $phar = new Phar($this->destinationFile);
     $phar->setSignatureAlgorithm($this->signatureAlgorithm);
     if (isset($this->stubPath)) {
         $phar->setStub(file_get_contents($this->stubPath));
     } else {
         $phar->setDefaultStub($this->cliStubFile->getPathWithoutBase($this->baseDirectory), $this->webStubFile->getPathWithoutBase($this->baseDirectory));
     }
     if ($metadata = $this->metadata->toArray()) {
         $phar->setMetadata($metadata);
     }
     if (!empty($this->alias)) {
         $phar->setAlias($this->alias);
     }
     return $phar;
 }
开发者ID:altesien,项目名称:FinalProject,代码行数:22,代码来源:PharPackageTask.php

示例10: dirname

<?php

$fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.tar.php';
$pname = 'phar://' . $fname;
$fname2 = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.tar.php';
$pname2 = 'phar://' . $fname2;
$phar = new Phar($fname);
$phar->setMetadata('hi there');
$phar['a'] = 'hi';
$phar['a']->setMetadata('a meta');
$phar['b'] = 'hi2';
$phar['c'] = 'hi3';
$phar['b']->chmod(0444);
$phar->setStub("<?php ok __HALT_COMPILER();");
$phar->setAlias("hime");
unset($phar);
copy($fname, $fname2);
Phar::unlinkArchive($fname);
var_dump(file_exists($fname), file_exists($pname . '/a'));
$phar = new Phar($fname2);
var_dump($phar['a']->getContent(), $phar['b']->getContent(), $phar['c']->getContent());
var_dump((string) decoct(fileperms($pname2 . '/b')));
var_dump($phar->getStub());
var_dump($phar->getAlias());
var_dump($phar->getMetadata());
var_dump($phar['a']->getMetadata());
?>
===DONE===
<?php 
unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.2.phar.tar.php');
开发者ID:badlamer,项目名称:hhvm,代码行数:30,代码来源:allU.php

示例11: foreach

                // normalize newlines to \n
                $whitespace = preg_replace('{(?:\\r\\n|\\r|\\n)}', "\n", $whitespace);
                // trim leading spaces
                $whitespace = preg_replace('{\\n +}', "\n", $whitespace);
                $output .= $whitespace;
            } else {
                $output .= $token[1];
            }
        }
    }
    return $output;
};
$pharObj = new \Phar($phar, 0);
$pharObj->setSignatureAlgorithm(\Phar::SHA1);
$pharObj->addFromString('version', $version);
$pharObj->setMetadata(array('version' => $version));
$pharObj->startBuffering();
foreach ($finders as $finder) {
    /** @var $file \SplFileInfo */
    foreach ($finder as $file) {
        if (pathinfo($file->getPathname(), PATHINFO_EXTENSION) === 'php') {
            $source = file_get_contents($file->getPathname());
            $source = $stripWhitespace($source);
            $pharObj->addFromString($file->getPathname(), $source);
            echo "* " . $file->getPathname() . "\n";
        } else {
            $pharObj->addFile($file->getPathname());
            echo "  " . $file->getPathname() . "\n";
        }
    }
}
开发者ID:sickhye,项目名称:php-db-migrate,代码行数:31,代码来源:compile.php

示例12: catch

}
$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";
}
ini_set('phar.readonly', 0);
$a->setMetadata(1, 2);
ini_set('phar.readonly', 1);
try {
    $a->delMetadata();
} catch (Exception $e) {
    echo $e->getMessage() . "\n";
}
?>
===DONE===
开发者ID:zaky-92,项目名称:php-1,代码行数:30,代码来源:ext_phar_tests_badparameters.php

示例13: buildPhar

 /**
  * Build the Phar
  *
  * @param string $workspace
  * @param array $args
  * @return bool
  */
 protected function buildPhar(string $workspace, array $args = []) : bool
 {
     $this->setupFiles($workspace, $args);
     // We don't need this to be random:
     $this->pharname = 'airship-' . \date('YmdHis') . '.phar';
     $phar = new \Phar(AIRSHIP_LOCAL_CONFIG . DIRECTORY_SEPARATOR . $this->pharname, \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::KEY_AS_FILENAME, $this->pharAlias);
     $phar->buildFromDirectory($workspace);
     $metaData = $this->getRawMetadata();
     $metaData['commit'] = $this->getGitCommitHash();
     $phar->setMetadata($metaData);
     echo 'Built at: ', AIRSHIP_LOCAL_CONFIG . DIRECTORY_SEPARATOR . $this->pharname, "\n";
     echo 'Git commit for this build: ', $metaData['commit'], "\n";
     return $this->cleanupWorkspace($workspace);
 }
开发者ID:paragonie,项目名称:airship,代码行数:21,代码来源:Assemble.php

示例14: buildPhar

 /**
  * Build and configure Phar object.
  *
  * @return Phar
  */
 private function buildPhar()
 {
     $phar = new Phar($this->destinationFile);
     if ($this->signatureAlgorithm == Phar::OPENSSL) {
         // Load up the contents of the key
         $keyContents = file_get_contents($this->key);
         // Attempt to load the given key as a PKCS#12 Cert Store first.
         if (openssl_pkcs12_read($keyContents, $certs, $this->keyPassword)) {
             $private = openssl_pkey_get_private($certs['pkey']);
         } else {
             // Fall back to a regular PEM-encoded private key.
             // Setup an OpenSSL resource using the private key
             // and tell the Phar to sign it using that key.
             $private = openssl_pkey_get_private($keyContents, $this->keyPassword);
         }
         $phar->setSignatureAlgorithm(Phar::OPENSSL, $private);
         // Get the details so we can get the public key and write that out
         // alongside the phar.
         $details = openssl_pkey_get_details($private);
         file_put_contents($this->destinationFile . '.pubkey', $details['key']);
     } else {
         $phar->setSignatureAlgorithm($this->signatureAlgorithm);
     }
     if (!empty($this->stubPath)) {
         $phar->setStub(file_get_contents($this->stubPath));
     } else {
         if (!empty($this->cliStubFile)) {
             $cliStubFile = $this->cliStubFile->getPathWithoutBase($this->baseDirectory);
         } else {
             $cliStubFile = null;
         }
         if (!empty($this->webStubFile)) {
             $webStubFile = $this->webStubFile->getPathWithoutBase($this->baseDirectory);
         } else {
             $webStubFile = null;
         }
         $phar->setDefaultStub($cliStubFile, $webStubFile);
     }
     if ($this->metadata === null) {
         $this->createMetaData();
     }
     if ($metadata = $this->metadata->toArray()) {
         $phar->setMetadata($metadata);
     }
     if (!empty($this->alias)) {
         $phar->setAlias($this->alias);
     }
     return $phar;
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:54,代码来源:PharPackageTask.php

示例15: buildGadget

 /**
  * Build a Gadget
  *
  * @param string $path
  * @param array $manifest
  */
 protected function buildGadget(string $path, array $manifest = [])
 {
     // Step One -- Let's build our .phar file
     $pharName = $manifest['supplier'] . '.' . $manifest['name'] . '.phar';
     try {
         if (\file_exists($path . '/dist/' . $pharName)) {
             \unlink($path . '/dist/' . $pharName);
             \clearstatcache();
         }
         if (\file_exists($path . '/dist/' . $pharName . '.ed25519.sig')) {
             \unlink($path . '/dist/' . $pharName . '.ed25519.sig');
             \clearstatcache();
         }
         $phar = new \Phar($path . '/dist/' . $pharName, \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::KEY_AS_FILENAME, $pharName);
     } catch (\UnexpectedValueException $e) {
         echo 'Could not open .phar', "\n";
         exit(255);
         // Return an error flag
     }
     $phar->buildFromDirectory($path);
     $phar->setStub($phar->createDefaultStub('autoload.php', 'autoload.php'));
     $phar->setMetadata($manifest);
     echo 'Gadget built.', "\n", $path . '/dist/' . $pharName, "\n", 'Don\'t forget to sign it!', "\n";
     exit(0);
     // Return a success flag
 }
开发者ID:paragonie,项目名称:airship-barge,代码行数:32,代码来源:Build.php


注:本文中的Phar::setMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。