NullAdapter.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. namespace League\Flysystem\Adapter;
  3. use League\Flysystem\Adapter\Polyfill\StreamedCopyTrait;
  4. use League\Flysystem\Adapter\Polyfill\StreamedTrait;
  5. use League\Flysystem\Config;
  6. class NullAdapter extends AbstractAdapter
  7. {
  8. use StreamedTrait;
  9. use StreamedCopyTrait;
  10. /**
  11. * Check whether a file is present.
  12. *
  13. * @param string $path
  14. *
  15. * @return bool
  16. */
  17. public function has($path)
  18. {
  19. return false;
  20. }
  21. /**
  22. * @inheritdoc
  23. */
  24. public function write($path, $contents, Config $config)
  25. {
  26. $type = 'file';
  27. $result = compact('contents', 'type', 'path');
  28. if ($visibility = $config->get('visibility')) {
  29. $result['visibility'] = $visibility;
  30. }
  31. return $result;
  32. }
  33. /**
  34. * @inheritdoc
  35. */
  36. public function update($path, $contents, Config $config)
  37. {
  38. return false;
  39. }
  40. /**
  41. * @inheritdoc
  42. */
  43. public function read($path)
  44. {
  45. return false;
  46. }
  47. /**
  48. * @inheritdoc
  49. */
  50. public function rename($path, $newpath)
  51. {
  52. return false;
  53. }
  54. /**
  55. * @inheritdoc
  56. */
  57. public function delete($path)
  58. {
  59. return false;
  60. }
  61. /**
  62. * @inheritdoc
  63. */
  64. public function listContents($directory = '', $recursive = false)
  65. {
  66. return [];
  67. }
  68. /**
  69. * @inheritdoc
  70. */
  71. public function getMetadata($path)
  72. {
  73. return false;
  74. }
  75. /**
  76. * @inheritdoc
  77. */
  78. public function getSize($path)
  79. {
  80. return false;
  81. }
  82. /**
  83. * @inheritdoc
  84. */
  85. public function getMimetype($path)
  86. {
  87. return false;
  88. }
  89. /**
  90. * @inheritdoc
  91. */
  92. public function getTimestamp($path)
  93. {
  94. return false;
  95. }
  96. /**
  97. * @inheritdoc
  98. */
  99. public function getVisibility($path)
  100. {
  101. return false;
  102. }
  103. /**
  104. * @inheritdoc
  105. */
  106. public function setVisibility($path, $visibility)
  107. {
  108. return compact('visibility');
  109. }
  110. /**
  111. * @inheritdoc
  112. */
  113. public function createDir($dirname, Config $config)
  114. {
  115. return ['path' => $dirname, 'type' => 'dir'];
  116. }
  117. /**
  118. * @inheritdoc
  119. */
  120. public function deleteDir($dirname)
  121. {
  122. return false;
  123. }
  124. }