SplFileInfo.hx 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 `SplFileInfo` class offers a high-level object-oriented interface to information for an individual file.
  26. @see https://www.php.net/manual/en/class.splfileinfo.php
  27. **/
  28. @:native("SplFileInfo")
  29. extern class SplFileInfo {
  30. function new(filename: String);
  31. function getATime(): EitherType<Int, Bool>;
  32. function getBasename(suffix: String = ""): String;
  33. function getCTime(): EitherType<Int, Bool>;
  34. function getExtension(): String;
  35. function getFileInfo(?className: String): SplFileInfo;
  36. function getFilename(): String;
  37. function getGroup(): EitherType<Int, Bool>;
  38. function getInode(): EitherType<Int, Bool>;
  39. function getLinkTarget(): EitherType<String, Bool>;
  40. function getMTime(): EitherType<Int, Bool>;
  41. function getOwner(): EitherType<Int, Bool>;
  42. function getPath(): String;
  43. function getPathInfo(?className: String): Null<SplFileInfo>;
  44. function getPathname(): String;
  45. function getPerms(): EitherType<Int, Bool>;
  46. function getRealPath(): EitherType<String, Bool>;
  47. function getSize(): EitherType<Int, Bool>;
  48. function getType(): EitherType<SplFileInfoType, Bool>;
  49. function isDir(): Bool;
  50. function isExecutable(): Bool;
  51. function isFile(): Bool;
  52. function isLink(): Bool;
  53. function isReadable(): Bool;
  54. function isWritable(): Bool;
  55. function openFile(mode: String = "r", useIncludePath: Bool = false, ?context: Resource): SplFileObject;
  56. function setFileClass(?className: String): Void;
  57. function setInfoClass(?className: String): Void;
  58. }
  59. enum abstract SplFileInfoType(String) to String {
  60. var Block = "block";
  61. var Char = "char";
  62. var Dir = "dir";
  63. var Fifo = "fifo";
  64. var File = "file";
  65. var Link = "link";
  66. var Socket = "socket";
  67. var Unknown = "unknown";
  68. }