1<?php 2 3/** 4 * Hoa 5 * 6 * 7 * @license 8 * 9 * New BSD License 10 * 11 * Copyright © 2007-2017, Hoa community. All rights reserved. 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions are met: 15 * * Redistributions of source code must retain the above copyright 16 * notice, this list of conditions and the following disclaimer. 17 * * Redistributions in binary form must reproduce the above copyright 18 * notice, this list of conditions and the following disclaimer in the 19 * documentation and/or other materials provided with the distribution. 20 * * Neither the name of the Hoa nor the names of its contributors may be 21 * used to endorse or promote products derived from this software without 22 * specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE 28 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 * POSSIBILITY OF SUCH DAMAGE. 35 */ 36 37namespace Hoa\Stream\Wrapper\IWrapper; 38 39/** 40 * Interface \Hoa\Stream\Wrapper\IWrapper\File. 41 * 42 * Interface for “file stream wrapper” class. 43 * 44 * @copyright Copyright © 2007-2017 Hoa community 45 * @license New BSD License 46 */ 47interface File 48{ 49 /** 50 * Close directory handle. 51 * This method is called in to closedir(). 52 * Any resources which were locked, or allocated, during opening and use of 53 * the directory stream should be released. 54 * 55 * @return bool 56 */ 57 public function dir_closedir(); 58 59 /** 60 * Open directory handle. 61 * This method is called in response to opendir(). 62 * 63 * @param string $path Specifies the URL that was passed to opendir(). 64 * @param int $options Whether or not to enforce safe_mode (0x04). 65 * @return bool 66 */ 67 public function dir_opendir($path, $options); 68 69 /** 70 * Read entry from directory handle. 71 * This method is called in response to readdir(). 72 * 73 * @return mixed 74 */ 75 public function dir_readdir(); 76 77 /** 78 * Rewind directory handle. 79 * This method is called in response to rewinddir(). 80 * Should reset the output generated by self::dir_readdir, i.e. the next 81 * call to self::dir_readdir should return the first entry in the location 82 * returned by self::dir_opendir. 83 * 84 * @return bool 85 */ 86 public function dir_rewinddir(); 87 88 /** 89 * Create a directory. 90 * This method is called in response to mkdir(). 91 * 92 * @param string $path Directory which should be created. 93 * @param int $mode The value passed to mkdir(). 94 * @param int $options A bitwise mask of values. 95 * @return bool 96 */ 97 public function mkdir($path, $mode, $options); 98 99 /** 100 * Rename a file or directory. 101 * This method is called in response to rename(). 102 * Should attempt to rename $from to $to. 103 * 104 * @param string $from The URL to current file. 105 * @param string $to The URL which $from should be renamed to. 106 * @return bool 107 */ 108 public function rename($from, $to); 109 110 /** 111 * Remove a directory. 112 * This method is called in response to rmdir(). 113 * 114 * @param string $path The directory URL which should be removed. 115 * @param int $options A bitwise mask of values. 116 * @return bool 117 */ 118 public function rmdir($path, $options); 119 120 /** 121 * Delete a file. 122 * This method is called in response to unlink(). 123 * 124 * @param string $path The file URL which should be deleted. 125 * @return bool 126 */ 127 public function unlink($path); 128 129 /** 130 * Retrieve information about a file. 131 * This method is called in response to all stat() related functions. 132 * 133 * @param string $path The file URL which should be retrieve 134 * information about. 135 * @param int $flags Holds additional flags set by the streams API. 136 * It can hold one or more of the following 137 * values OR'd together. 138 * STREAM_URL_STAT_LINK: for resource with the 139 * ability to link to other resource (such as an 140 * HTTP location: forward, or a filesystem 141 * symlink). This flag specified that only 142 * information about the link itself should be 143 * returned, not the resource pointed to by the 144 * link. This flag is set in response to calls to 145 * lstat(), is_link(), or filetype(). 146 * STREAM_URL_STAT_QUIET: if this flag is set, 147 * our wrapper should not raise any errors. If 148 * this flag is not set, we are responsible for 149 * reporting errors using the trigger_error() 150 * function during stating of the path. 151 * @return array 152 */ 153 public function url_stat($path, $flags); 154} 155