| 1 | <?php |
||
| 5 | class Pipe |
||
| 6 | { |
||
| 7 | private $name; |
||
| 8 | private $pipe; |
||
| 9 | private $size; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @param string $name |
||
| 13 | * @param int $size |
||
| 14 | * |
||
| 15 | * @return void |
||
|
|
|||
| 16 | */ |
||
| 17 | public function __construct($name, $size = 8) |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Create the file if needed |
||
| 25 | * |
||
| 26 | * @return Pipe |
||
| 27 | */ |
||
| 28 | public function create(){ |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Open the file with the given mode |
||
| 44 | * |
||
| 45 | * @param string $mode |
||
| 46 | * |
||
| 47 | * @return resource |
||
| 48 | */ |
||
| 49 | public function open($mode) |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Write the content into the file |
||
| 61 | * |
||
| 62 | * |
||
| 63 | * @param string $string |
||
| 64 | * @return Pipe |
||
| 65 | */ |
||
| 66 | public function write($string){ |
||
| 76 | |||
| 77 | /** |
||
| 78 | * Wait for file content. Return the content |
||
| 79 | * |
||
| 80 | * @return string |
||
| 81 | */ |
||
| 82 | public function read(){ |
||
| 88 | } |
||
| 89 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.