src/File.php
public function write($handle, string $data, $length = null) : int
    {
        $bytesWritten = is_int($length) ? fwrite($handle, $data, $length) : fwrite($handle, $data);

        if (false === $bytesWritten) {
            throw new FileException('Cannot write to a file.');
        }

        return $bytesWritten;
    }
public function write($handle, string $data, $length = null) : int
    {
        $bytesWritten = is_int($length) ? fwrite($handle, $data, $length) : fwrite($handle, $data);

        if (false === $bytesWritten) {
            throw new FileException('Cannot write to a file.');
        }

        return $bytesWritten;
    }
public function write ( $ handle , string $ data , $ length = null ) : int { $ bytesWritten = is_int ( $ length ) ? fwrite ( $ handle , $ data , $ length ) : fwrite ( $ handle , $ data ) ; if ( false === $ bytesWritten ) { throw new FileException ( 'Cannot write to a file.' ) ; } return $ bytesWritten ; }
Write data to file.

@param Resource $handle
@param string   $data
@param int|null $length

@throws FileException

@return int
Write data to file .