*
* @param $bytes Amount of bytes to read or whole line (only text files)
* @return $data Data read from file
+ * @throws OutOfBoundsException If the position is not seekable
* @throws NullPointerException If the file pointer instance is not set by setFileObject()
- * @throws InvalidResourceException If there is no object being set
+ * @throws LogicException If $fileObject is not an object
*/
public function read (int $bytes = 0) {
// Some sanity checks
if ($bytes < 0) {
// Cannot be below zero
- throw new InvalidArgumentException(sprintf('bytes=%d is not valid', $bytes));
+ throw new OutOfBoundsException(sprintf('bytes=%d is not valid', $bytes));
} elseif (is_null($this->getFileObject())) {
// Pointer not initialized
throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);