MongoGridFSFile.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /*
  3. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. */
  15. class MongoGridFSFile {
  16. /**
  17. * @link http://php.net/manual/en/class.mongogridfsfile.php#mongogridfsfile.props.file
  18. * @var $file
  19. */
  20. public $file;
  21. /**
  22. * @link http://php.net/manual/en/class.mongogridfsfile.php#mongogridfsfile.props.gridfs
  23. * @var $gridfs
  24. */
  25. protected $gridfs;
  26. /**
  27. * @link http://php.net/manual/en/mongogridfsfile.construct.php
  28. * @param MongoGridFS $gridfs The parent MongoGridFS instance
  29. * @param array $file A file from the database
  30. * @return MongoGridFSFile Returns a new MongoGridFSFile
  31. */
  32. public function __construct($gridfs, array $file) {}
  33. /**
  34. * Returns this file's filename
  35. * @link http://php.net/manual/en/mongogridfsfile.getfilename.php
  36. * @return string Returns the filename
  37. */
  38. public function getFilename() {}
  39. /**
  40. * Returns this file's size
  41. * @link http://php.net/manual/en/mongogridfsfile.getsize.php
  42. * @return int Returns this file's size
  43. */
  44. public function getSize() {}
  45. /**
  46. * Writes this file to the filesystem
  47. * @link http://php.net/manual/en/mongogridfsfile.write.php
  48. * @param string $filename The location to which to write the file (path+filename+extension). If none is given, the stored filename will be used.
  49. * @return int Returns the number of bytes written
  50. */
  51. public function write($filename = null) {}
  52. /**
  53. * This will load the file into memory. If the file is bigger than your memory, this will cause problems!
  54. * @link http://php.net/manual/en/mongogridfsfile.getbytes.php
  55. * @return string Returns a string of the bytes in the file
  56. */
  57. public function getBytes() {}
  58. /**
  59. * This method returns a stream resource that can be used to read the stored file with all file functions in PHP.
  60. * The contents of the file are pulled out of MongoDB on the fly, so that the whole file does not have to be loaded into memory first.
  61. * At most two GridFSFile chunks will be loaded in memory.
  62. *
  63. * @link http://php.net/manual/en/mongogridfsfile.getresource.php
  64. * @return resource Returns a resource that can be used to read the file with
  65. */
  66. public function getResource() {}
  67. }