1 | <?php |
||
22 | class File implements ConnectorInterface |
||
23 | { |
||
24 | /** |
||
25 | * @var resource The file pointer to send data to. |
||
26 | */ |
||
27 | protected $resource = false; |
||
28 | |||
29 | /** |
||
30 | * Construct new connector, given a filename |
||
31 | * If created a binary file must be granted the necessary |
||
32 | * permissions to create and write the system file |
||
33 | * |
||
34 | * @param string $filename |
||
35 | */ |
||
36 | public function __construct($filename = null) |
||
50 | |||
51 | /** |
||
52 | * Destruct conection closing the file |
||
53 | */ |
||
54 | public function __destruct() |
||
60 | |||
61 | /** |
||
62 | * Close file pointer |
||
63 | */ |
||
64 | public function close() |
||
71 | |||
72 | /** |
||
73 | * Write data to the file |
||
74 | * |
||
75 | * @param string $data |
||
76 | */ |
||
77 | public function write($data = '') |
||
83 | /** |
||
84 | * Read some bytes from file |
||
85 | * |
||
86 | * @param int $len |
||
87 | * @return string |
||
88 | */ |
||
89 | public function read($len = null) |
||
101 | } |
||
102 |
If you suppress an error, we recommend checking for the error condition explicitly: