1 | <?php |
||
18 | class MongoGridFSFile { |
||
1 ignored issue
–
show
|
|||
19 | /** |
||
20 | * @link http://php.net/manual/en/class.mongogridfsfile.php#mongogridfsfile.props.file |
||
21 | * @var array |
||
22 | */ |
||
23 | public $file; |
||
24 | |||
25 | /** |
||
26 | * @link http://php.net/manual/en/class.mongogridfsfile.php#mongogridfsfile.props.gridfs |
||
27 | * @var $gridfs |
||
28 | */ |
||
29 | protected $gridfs; |
||
30 | |||
31 | /** |
||
32 | * @link http://php.net/manual/en/mongogridfsfile.construct.php |
||
33 | * @param MongoGridFS $gridfs The parent MongoGridFS instance |
||
34 | * @param array $file A file from the database |
||
35 | * @return MongoGridFSFile Returns a new MongoGridFSFile |
||
36 | */ |
||
37 | public function __construct(MongoGridFS $gridfs, array $file) |
||
42 | |||
43 | /** |
||
44 | * Returns this file's filename |
||
45 | * @link http://php.net/manual/en/mongogridfsfile.getfilename.php |
||
46 | * @return string Returns the filename |
||
47 | */ |
||
48 | public function getFilename() |
||
55 | |||
56 | |||
57 | /** |
||
58 | * Returns this file's size |
||
59 | * @link http://php.net/manual/en/mongogridfsfile.getsize.php |
||
60 | * @return int Returns this file's size |
||
61 | */ |
||
62 | public function getSize() |
||
66 | |||
67 | /** |
||
68 | * Writes this file to the filesystem |
||
69 | * @link http://php.net/manual/en/mongogridfsfile.write.php |
||
70 | * @param string $filename The location to which to write the file (path+filename+extension). If none is given, the stored filename will be used. |
||
71 | * @return int Returns the number of bytes written |
||
72 | */ |
||
73 | public function write($filename = null) |
||
87 | |||
88 | |||
89 | /** |
||
90 | * This will load the file into memory. If the file is bigger than your memory, this will cause problems! |
||
91 | * @link http://php.net/manual/en/mongogridfsfile.getbytes.php |
||
92 | * @return string Returns a string of the bytes in the file |
||
93 | */ |
||
94 | public function getBytes() |
||
103 | |||
104 | /** |
||
105 | * This method returns a stream resource that can be used to read the stored file with all file functions in PHP. |
||
106 | * 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. |
||
107 | * At most two GridFSFile chunks will be loaded in memory. |
||
108 | * |
||
109 | * @link http://php.net/manual/en/mongogridfsfile.getresource.php |
||
110 | * @return resource Returns a resource that can be used to read the file with |
||
111 | */ |
||
112 | public function getResource() |
||
119 | |||
120 | private function getChunks() |
||
128 | |||
129 | private function writeFromRessource($handle) |
||
142 | } |
||
143 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.