2
0

Phar.hx 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (C)2005-2021 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. package php;
  23. import haxe.extern.EitherType;
  24. /**
  25. The `Phar` class provides a high-level interface to accessing and creating PHAR archives.
  26. @see https://www.php.net/manual/en/class.phar.php
  27. **/
  28. @:native("Phar")
  29. extern class Phar extends RecursiveDirectoryIterator implements Countable implements php.ArrayAccess<String, PharFileInfo> {
  30. @:phpClassConst static final BZ2: Int;
  31. @:phpClassConst static final COMPRESSED: Int;
  32. @:phpClassConst static final GZ: Int;
  33. @:phpClassConst static final MD5: Int;
  34. @:phpClassConst static final NONE: Int;
  35. @:phpClassConst static final OPENSSL: Int;
  36. @:phpClassConst static final PHAR: Int;
  37. @:phpClassConst static final PHP: Int;
  38. @:phpClassConst static final PHPS: Int;
  39. @:phpClassConst static final SHA1: Int;
  40. @:phpClassConst static final SHA256: Int;
  41. @:phpClassConst static final SHA512: Int;
  42. @:phpClassConst static final TAR: Int;
  43. @:phpClassConst static final ZIP: Int;
  44. final static function apiVersion(): String;
  45. final static function canCompress(type: Int = 0): Bool;
  46. final static function canWrite(): Bool;
  47. final static function createDefaultStub(?index: String, ?webIndex: String): String;
  48. final static function getSupportedCompression(): NativeIndexedArray<String>;
  49. final static function getSupportedSignatures(): NativeIndexedArray<String>;
  50. final static function isValidPharFilename(filename: String, executable: Bool = true): Bool;
  51. final static function loadPhar(filename: String, ?alias: String): Bool;
  52. final static function mapPhar(?alias: String, dataoffset: Int = 0): Bool;
  53. final static function mount(pharpath: String, externalpath: String): Void;
  54. final static function mungServer(munglist: NativeIndexedArray<String>): Void;
  55. final static function running(retphar: Bool = true): String;
  56. final static function unlinkArchive(archive: String): Bool;
  57. final static function webPhar(?alias: String, index: String = "index.php", ?f404: String, ?mimetypes: NativeAssocArray<String>, ?callable: String -> EitherType<String, Bool>): Void;
  58. function new(fname: String, ?flags: Int, ?alias: String);
  59. function addEmptyDir(dirname: String): Void;
  60. function addFile(file: String, ?localname: String): Void;
  61. function addFromString(localname: String, contents: String): Void;
  62. function buildFromDirectory(base_dir: String, ?regex: String): NativeAssocArray<String>;
  63. function buildFromIterator(iter: EitherType<NativeIterator<String, String>, NativeIterator<Int, SplFileInfo>>, ?base_directory: String): NativeAssocArray<String>;
  64. function compress(compression: Int, ?extension: String): Phar;
  65. function compressFiles(compression: Int): Void;
  66. function convertToData(?format: Int, ?compression: Int, ?extension: String): PharData;
  67. function convertToExecutable(?format: Int, ?compression: Int, ?extension: String): Phar;
  68. function copy(oldfile: String, newfile: String): Bool;
  69. function count(): Int;
  70. function decompress(?extension: String): PharData;
  71. function decompressFiles(): Void;
  72. function delete(entry: String): Bool;
  73. function delMetadata(): Bool;
  74. function extractTo(pathto: String, ?files: EitherType<String, NativeIndexedArray<String>>, overwrite: Bool = false): Bool;
  75. function getAlias(): String;
  76. function getMetadata(): Dynamic;
  77. function getModified(): Bool;
  78. function getPath(): String;
  79. function getSignature(): NativeAssocArray<String>;
  80. function getStub(): String;
  81. function getVersion(): String;
  82. function hasMetadata(): Bool;
  83. function isBuffering(): Bool;
  84. function isCompressed(): EitherType<Int, Bool>;
  85. function isFileFormat(format: Int): Bool;
  86. function isWritable(): Bool;
  87. function offsetExists(offset: String): Bool;
  88. function offsetGet(offset: String): PharFileInfo;
  89. function offsetSet(offset: String, value: Dynamic): Void;
  90. function offsetUnset(offset: String): Void;
  91. function setAlias(alias: String): Bool;
  92. function setDefaultStub(?index: String, ?webindex: String): Bool;
  93. function setMetadata(metadata: Any): Void;
  94. function setSignatureAlgorithm(sigtype: Int, ?privatekey: String): Void;
  95. function setStub(stub: String, len: Int = -1): Bool;
  96. function startBuffering(): Void;
  97. function stopBuffering(): Void;
  98. }