Fix CodeStyle for https://github.com/joomla/joomla-cms/pull/5445

@alikon This PR should fix all major CS issues with your PR here: https://github.com/joomla/joomla-cms/pull/5445

What this PR also do is
- default to disabled if not set
```php
-	if ($this->params->get('log-executed-sql', 1))
+	if ($this->params->get('log-executed-sql', '0'))
```
- add a description and use a `protected function`

```php
-	function write2file()
+
+	/**
+	* Write query to the log file
+	*
+	* @return void
+	*
+	* @since 3.4
+	*/
+	protected function write2file()
```

- use `w+` instead of `wt` for fopen statment
```php
- $fp = @fopen($file, 'wt');
+	$fp = @fopen($file, 'w+');
```

Please review and comment / merge this PR so we can move this forward.