[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * ReadBytes trait 5 * 6 * PHP version 5 7 * 8 * @author Jim Wigginton <terrafrost@php.net> 9 * @copyright 2015 Jim Wigginton 10 * @license http://www.opensource.org/licenses/mit-license.html MIT License 11 * @link http://phpseclib.sourceforge.net 12 */ 13 14 namespace phpseclib3\System\SSH\Common\Traits; 15 16 /** 17 * ReadBytes trait 18 * 19 * @author Jim Wigginton <terrafrost@php.net> 20 */ 21 trait ReadBytes 22 { 23 /** 24 * Read data 25 * 26 * @param int $length 27 * @throws \RuntimeException on connection errors 28 */ 29 public function readBytes($length) 30 { 31 $temp = fread($this->fsock, $length); 32 if (strlen($temp) != $length) { 33 throw new \RuntimeException("Expected $length bytes; got " . strlen($temp)); 34 } 35 return $temp; 36 } 37 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body