Completed
Push — master ( 5a2fc4...3e9e40 )
by smiley
03:02
created
src/LogOptions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,6 +23,6 @@
 block discarded – undo
23 23
  * @property string $logfileName
24 24
  * @property string $logfileExt
25 25
  */
26
-class LogOptions extends SettingsContainerAbstract{
26
+class LogOptions extends SettingsContainerAbstract {
27 27
 	use LogOptionsTrait;
28 28
 }
Please login to merge, or discard this patch.
src/Output/FileLog.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use chillerlan\Logger\LogException;
16 16
 use chillerlan\Settings\SettingsContainerInterface;
17 17
 
18
-class FileLog extends LogOutputAbstract{
18
+class FileLog extends LogOutputAbstract {
19 19
 
20 20
 	/**
21 21
 	 * @var bool|resource
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @throws \chillerlan\Logger\LogException
31 31
 	 */
32
-	public function __construct(SettingsContainerInterface $options = null){
32
+	public function __construct(SettingsContainerInterface $options = null) {
33 33
 		parent::__construct($options);
34 34
 
35
-		if(!is_writable($this->options->logfileDir)){
35
+		if (!is_writable($this->options->logfileDir)) {
36 36
 			throw new LogException('log file directory inaccessible');
37 37
 		}
38 38
 
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 	/**
45 45
 	 * @inheritdoc
46 46
 	 */
47
-	public function __destruct(){
47
+	public function __destruct() {
48 48
 		$this->close();
49 49
 
50
-		if(gettype($this->fh) === 'resource'){
50
+		if (gettype($this->fh) === 'resource') {
51 51
 			fclose($this->fh);
52 52
 		}
53 53
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	/**
56 56
 	 * @inheritdoc
57 57
 	 */
58
-	protected function __log(string $level, string $message, array $context = null){
58
+	protected function __log(string $level, string $message, array $context = null) {
59 59
 		fwrite($this->fh, $this->message($level, $message, $context));
60 60
 	}
61 61
 
Please login to merge, or discard this patch.
src/Output/EmailLog.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 use PHPMailer\PHPMailer\PHPMailer;
17 17
 
18 18
 
19
-class EmailLog extends LogOutputAbstract{
19
+class EmailLog extends LogOutputAbstract {
20 20
 
21 21
 	protected $mailer;
22 22
 
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 	 * @param \chillerlan\Settings\SettingsContainerInterface|null $options
28 28
 	 * @param \PHPMailer\PHPMailer\PHPMailer     $mailer
29 29
 	 */
30
-	public function __construct(SettingsContainerInterface $options, PHPMailer $mailer){
30
+	public function __construct(SettingsContainerInterface $options, PHPMailer $mailer) {
31 31
 		$this->options = $options;
32 32
 		$this->mailer  = $mailer;
33 33
 	}
34 34
 
35
-	protected function __log(string $level, string $message, array $context = null){
35
+	protected function __log(string $level, string $message, array $context = null) {
36 36
 		// TODO: Implement log() method.
37 37
 	}
38 38
 
Please login to merge, or discard this patch.
src/Output/LogOutputAbstract.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  *
20 20
  */
21
-abstract class LogOutputAbstract implements LogOutputInterface{
21
+abstract class LogOutputAbstract implements LogOutputInterface {
22 22
 
23 23
 	/**
24 24
 	 * @var \chillerlan\Logger\LogOptions
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @param \chillerlan\Settings\SettingsContainerInterface|null $options
32 32
 	 */
33
-	public function __construct(SettingsContainerInterface $options = null){
33
+	public function __construct(SettingsContainerInterface $options = null) {
34 34
 		$this->options = $options ?? new LogOptions;
35 35
 	}
36 36
 
37 37
 	/**
38 38
 	 * @inheritdoc
39 39
 	 */
40
-	public function __destruct(){
40
+	public function __destruct() {
41 41
 		$this->close();
42 42
 	}
43 43
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	/**
61 61
 	 * @inheritdoc
62 62
 	 */
63
-	public function log(string $level, string $message, array $context = []){ // @todo: loglevel bitmask
64
-		if((array_key_exists($level, $this::LEVELS) && $this::LEVELS[$level] >= $this::LEVELS[$this->options->minLogLevel]) || (!array_key_exists($level, $this::LEVELS) && !empty($level))){
63
+	public function log(string $level, string $message, array $context = []) { // @todo: loglevel bitmask
64
+		if ((array_key_exists($level, $this::LEVELS) && $this::LEVELS[$level] >= $this::LEVELS[$this->options->minLogLevel]) || (!array_key_exists($level, $this::LEVELS) && !empty($level))) {
65 65
 			$this->__log($level, $message, $context);
66 66
 		}
67 67
 	}
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return string
75 75
 	 */
76
-	protected function message(string $level, string $message, array $context = null){
76
+	protected function message(string $level, string $message, array $context = null) {
77 77
 		return sprintf($this->options->consoleFormat, date($this->options->consoleDateFormat), $level, $message).PHP_EOL;
78 78
 	}
79 79
 
Please login to merge, or discard this patch.
src/Output/DatabaseLog.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use chillerlan\Database\Database;
16 16
 use chillerlan\Settings\SettingsContainerInterface;
17 17
 
18
-class DatabaseLog extends LogOutputAbstract{
18
+class DatabaseLog extends LogOutputAbstract {
19 19
 
20 20
 	/**
21 21
 	 * @var \chillerlan\Database\Database
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param \chillerlan\Settings\SettingsContainerInterface|null $options
30 30
 	 * @param \chillerlan\Database\Database    $db
31 31
 	 */
32
-	public function __construct(SettingsContainerInterface $options, Database $db){
32
+	public function __construct(SettingsContainerInterface $options, Database $db) {
33 33
 		$this->options = $options;
34 34
 		$this->db      = $db;
35 35
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	/**
40 40
 	 * @inheritdoc
41 41
 	 */
42
-	protected function __log(string $level, string $message, array $context = []){
42
+	protected function __log(string $level, string $message, array $context = []) {
43 43
 
44 44
 		// TODO: $context, tests
45 45
 		$this->db->insert
Please login to merge, or discard this patch.