Completed
Push — master ( 334b0e...85a967 )
by Martin
09:50 queued 04:53
created
src/Formatter/FormatterInterface.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,5 +12,5 @@
 block discarded – undo
12 12
  */
13 13
 interface FormatterInterface
14 14
 {
15
-    public function format(Record $record);
15
+		public function format(Record $record);
16 16
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,6 @@
 block discarded – undo
10 10
  * @package Yep\WorkflowLogger\Formatter
11 11
  * @author  Martin Zeman (Zemistr) <[email protected]>
12 12
  */
13
-interface FormatterInterface
14
-{
13
+interface FormatterInterface {
15 14
     public function format(Record $record);
16 15
 }
Please login to merge, or discard this patch.
src/Formatter/StandardFormatter.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -13,45 +13,45 @@
 block discarded – undo
13 13
  */
14 14
 class StandardFormatter implements FormatterInterface
15 15
 {
16
-    const FORMAT = "[%datetime%] %level%: %message%\n%contextPlaceholder%";
17
-    const CONTEXT_FORMAT = "Context:\n%context%\n";
18
-    const DATETIME_FORMAT = 'Y-m-d H:i:s.u';
19
-
20
-    /**
21
-     * @var DumperInterface
22
-     */
23
-    protected $dumper;
24
-
25
-    public function __construct(DumperInterface $dumper)
26
-    {
27
-        $this->dumper = $dumper;
28
-    }
29
-
30
-    public function format(Record $record)
31
-    {
32
-        $contextString = '';
33
-
34
-        if ($context = $record->getContext()) {
35
-            $contextString = strtr(
36
-              self::CONTEXT_FORMAT,
37
-              [
38
-                '%context%' => $this->dumper->dump($context),
39
-              ]
40
-            );
41
-        }
42
-
43
-        $string = strtr(
44
-          self::FORMAT,
45
-          [
46
-            '%datetime%' => $record->getDatetime()->format(
47
-              static::DATETIME_FORMAT
48
-            ),
49
-            '%level%' => $record->getLevel(),
50
-            '%message%' => $record->getMessage(),
51
-            '%contextPlaceholder%' => $contextString,
52
-          ]
53
-        );
54
-
55
-        return $string;
56
-    }
16
+		const FORMAT = "[%datetime%] %level%: %message%\n%contextPlaceholder%";
17
+		const CONTEXT_FORMAT = "Context:\n%context%\n";
18
+		const DATETIME_FORMAT = 'Y-m-d H:i:s.u';
19
+
20
+		/**
21
+		 * @var DumperInterface
22
+		 */
23
+		protected $dumper;
24
+
25
+		public function __construct(DumperInterface $dumper)
26
+		{
27
+				$this->dumper = $dumper;
28
+		}
29
+
30
+		public function format(Record $record)
31
+		{
32
+				$contextString = '';
33
+
34
+				if ($context = $record->getContext()) {
35
+						$contextString = strtr(
36
+							self::CONTEXT_FORMAT,
37
+							[
38
+								'%context%' => $this->dumper->dump($context),
39
+							]
40
+						);
41
+				}
42
+
43
+				$string = strtr(
44
+					self::FORMAT,
45
+					[
46
+						'%datetime%' => $record->getDatetime()->format(
47
+							static::DATETIME_FORMAT
48
+						),
49
+						'%level%' => $record->getLevel(),
50
+						'%message%' => $record->getMessage(),
51
+						'%contextPlaceholder%' => $contextString,
52
+					]
53
+				);
54
+
55
+				return $string;
56
+		}
57 57
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@  discard block
 block discarded – undo
11 11
  * @package Yep\WorkflowLogger\Formatter
12 12
  * @author  Martin Zeman (Zemistr) <[email protected]>
13 13
  */
14
-class StandardFormatter implements FormatterInterface
15
-{
14
+class StandardFormatter implements FormatterInterface {
16 15
     const FORMAT = "[%datetime%] %level%: %message%\n%contextPlaceholder%";
17 16
     const CONTEXT_FORMAT = "Context:\n%context%\n";
18 17
     const DATETIME_FORMAT = 'Y-m-d H:i:s.u';
@@ -22,13 +21,11 @@  discard block
 block discarded – undo
22 21
      */
23 22
     protected $dumper;
24 23
 
25
-    public function __construct(DumperInterface $dumper)
26
-    {
24
+    public function __construct(DumperInterface $dumper) {
27 25
         $this->dumper = $dumper;
28 26
     }
29 27
 
30
-    public function format(Record $record)
31
-    {
28
+    public function format(Record $record) {
32 29
         $contextString = '';
33 30
 
34 31
         if ($context = $record->getContext()) {
Please login to merge, or discard this patch.
src/LoggerInterface.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@
 block discarded – undo
10 10
  */
11 11
 interface LoggerInterface extends \Psr\Log\LoggerInterface
12 12
 {
13
-    /**
14
-     * @param string $name
15
-     * @return Workflow
16
-     */
17
-    public function workflow($name);
13
+		/**
14
+		 * @param string $name
15
+		 * @return Workflow
16
+		 */
17
+		public function workflow($name);
18 18
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
  * @package Yep\WorkflowLogger
9 9
  * @author  Martin Zeman (Zemistr) <[email protected]>
10 10
  */
11
-interface LoggerInterface extends \Psr\Log\LoggerInterface
12
-{
11
+interface LoggerInterface extends \Psr\Log\LoggerInterface {
13 12
     /**
14 13
      * @param string $name
15 14
      * @return Workflow
Please login to merge, or discard this patch.
src/Record.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -10,75 +10,75 @@
 block discarded – undo
10 10
  */
11 11
 class Record
12 12
 {
13
-    /**
14
-     * @var array
15
-     */
16
-    protected $context;
13
+		/**
14
+		 * @var array
15
+		 */
16
+		protected $context;
17 17
 
18
-    /**
19
-     * @var \DateTime
20
-     */
21
-    protected $datetime;
18
+		/**
19
+		 * @var \DateTime
20
+		 */
21
+		protected $datetime;
22 22
 
23
-    /**
24
-     * @var string
25
-     */
26
-    protected $level;
23
+		/**
24
+		 * @var string
25
+		 */
26
+		protected $level;
27 27
 
28
-    /**
29
-     * @var string
30
-     */
31
-    protected $message;
28
+		/**
29
+		 * @var string
30
+		 */
31
+		protected $message;
32 32
 
33
-    /**
34
-     * Record constructor.
35
-     *
36
-     * @param \DateTime $datetime
37
-     * @param string    $message
38
-     * @param string    $level
39
-     * @param array     $context
40
-     */
41
-    public function __construct(
42
-      \DateTime $datetime,
43
-      $message,
44
-      $level,
45
-      array $context
46
-    ) {
47
-        $this->datetime = $datetime;
48
-        $this->message = (string)$message;
49
-        $this->level = (string)$level;
50
-        $this->context = $context;
51
-    }
33
+		/**
34
+		 * Record constructor.
35
+		 *
36
+		 * @param \DateTime $datetime
37
+		 * @param string    $message
38
+		 * @param string    $level
39
+		 * @param array     $context
40
+		 */
41
+		public function __construct(
42
+			\DateTime $datetime,
43
+			$message,
44
+			$level,
45
+			array $context
46
+		) {
47
+				$this->datetime = $datetime;
48
+				$this->message = (string)$message;
49
+				$this->level = (string)$level;
50
+				$this->context = $context;
51
+		}
52 52
 
53
-    /**
54
-     * @return \DateTime
55
-     */
56
-    public function getDatetime()
57
-    {
58
-        return $this->datetime;
59
-    }
53
+		/**
54
+		 * @return \DateTime
55
+		 */
56
+		public function getDatetime()
57
+		{
58
+				return $this->datetime;
59
+		}
60 60
 
61
-    /**
62
-     * @return string
63
-     */
64
-    public function getMessage()
65
-    {
66
-        return $this->message;
67
-    }
61
+		/**
62
+		 * @return string
63
+		 */
64
+		public function getMessage()
65
+		{
66
+				return $this->message;
67
+		}
68 68
 
69
-    /**
70
-     * @return string
71
-     */
72
-    public function getLevel()
73
-    {
74
-        return $this->level;
75
-    }
69
+		/**
70
+		 * @return string
71
+		 */
72
+		public function getLevel()
73
+		{
74
+				return $this->level;
75
+		}
76 76
 
77
-    /**
78
-     * @return array
79
-     */
80
-    public function getContext()
81
-    {
82
-        return $this->context;
83
-    }
77
+		/**
78
+		 * @return array
79
+		 */
80
+		public function getContext()
81
+		{
82
+				return $this->context;
83
+		}
84 84
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@  discard block
 block discarded – undo
8 8
  * @package Yep\WorkflowLogger
9 9
  * @author  Martin Zeman (Zemistr) <[email protected]>
10 10
  */
11
-class Record
12
-{
11
+class Record {
13 12
     /**
14 13
      * @var array
15 14
      */
@@ -53,32 +52,28 @@  discard block
 block discarded – undo
53 52
     /**
54 53
      * @return \DateTime
55 54
      */
56
-    public function getDatetime()
57
-    {
55
+    public function getDatetime() {
58 56
         return $this->datetime;
59 57
     }
60 58
 
61 59
     /**
62 60
      * @return string
63 61
      */
64
-    public function getMessage()
65
-    {
62
+    public function getMessage() {
66 63
         return $this->message;
67 64
     }
68 65
 
69 66
     /**
70 67
      * @return string
71 68
      */
72
-    public function getLevel()
73
-    {
69
+    public function getLevel() {
74 70
         return $this->level;
75 71
     }
76 72
 
77 73
     /**
78 74
      * @return array
79 75
      */
80
-    public function getContext()
81
-    {
76
+    public function getContext() {
82 77
         return $this->context;
83 78
     }
84 79
 }
Please login to merge, or discard this patch.
src/ContextDumper/DumperInterface.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
10 10
  */
11 11
 interface DumperInterface
12 12
 {
13
-    public function dump(array $context);
13
+		public function dump(array $context);
14 14
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,6 @@
 block discarded – undo
8 8
  * @package Yep\WorkflowLogger\ContextDumper
9 9
  * @author  Martin Zeman (Zemistr) <[email protected]>
10 10
  */
11
-interface DumperInterface
12
-{
11
+interface DumperInterface {
13 12
     public function dump(array $context);
14 13
 }
Please login to merge, or discard this patch.
src/ContextDumper/SymfonyVarDumper.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,24 +13,24 @@
 block discarded – undo
13 13
  */
14 14
 class SymfonyVarDumper implements DumperInterface
15 15
 {
16
-    /**
17
-     * @var VarCloner
18
-     */
19
-    protected $cloner;
16
+		/**
17
+		 * @var VarCloner
18
+		 */
19
+		protected $cloner;
20 20
 
21
-    /**
22
-     * @var CliDumper
23
-     */
24
-    protected $dumper;
21
+		/**
22
+		 * @var CliDumper
23
+		 */
24
+		protected $dumper;
25 25
 
26
-    public function __construct($flags = CliDumper::DUMP_LIGHT_ARRAY)
27
-    {
28
-        $this->cloner = new VarCloner();
29
-        $this->dumper = new CliDumper(null, null, $flags);
30
-    }
26
+		public function __construct($flags = CliDumper::DUMP_LIGHT_ARRAY)
27
+		{
28
+				$this->cloner = new VarCloner();
29
+				$this->dumper = new CliDumper(null, null, $flags);
30
+		}
31 31
 
32
-    public function dump(array $context)
33
-    {
34
-        return $this->dumper->dump($this->cloner->cloneVar($context), true);
35
-    }
32
+		public function dump(array $context)
33
+		{
34
+				return $this->dumper->dump($this->cloner->cloneVar($context), true);
35
+		}
36 36
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@  discard block
 block discarded – undo
11 11
  * @package Yep\WorkflowLogger\ContextDumper
12 12
  * @author  Martin Zeman (Zemistr) <[email protected]>
13 13
  */
14
-class SymfonyVarDumper implements DumperInterface
15
-{
14
+class SymfonyVarDumper implements DumperInterface {
16 15
     /**
17 16
      * @var VarCloner
18 17
      */
@@ -23,14 +22,12 @@  discard block
 block discarded – undo
23 22
      */
24 23
     protected $dumper;
25 24
 
26
-    public function __construct($flags = CliDumper::DUMP_LIGHT_ARRAY)
27
-    {
25
+    public function __construct($flags = CliDumper::DUMP_LIGHT_ARRAY) {
28 26
         $this->cloner = new VarCloner();
29 27
         $this->dumper = new CliDumper(null, null, $flags);
30 28
     }
31 29
 
32
-    public function dump(array $context)
33
-    {
30
+    public function dump(array $context) {
34 31
         return $this->dumper->dump($this->cloner->cloneVar($context), true);
35 32
     }
36 33
 }
Please login to merge, or discard this patch.
src/ContextDumper/PrintRDumper.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
  */
11 11
 class PrintRDumper implements DumperInterface
12 12
 {
13
-    public function dump(array $context)
14
-    {
15
-        return print_r($context, true);
16
-    }
13
+		public function dump(array $context)
14
+		{
15
+				return print_r($context, true);
16
+		}
17 17
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,10 +8,8 @@
 block discarded – undo
8 8
  * @package Yep\WorkflowLogger\ContextDumper
9 9
  * @author  Martin Zeman (Zemistr) <[email protected]>
10 10
  */
11
-class PrintRDumper implements DumperInterface
12
-{
13
-    public function dump(array $context)
14
-    {
11
+class PrintRDumper implements DumperInterface {
12
+    public function dump(array $context) {
15 13
         return print_r($context, true);
16 14
     }
17 15
 }
Please login to merge, or discard this patch.
src/ContextDumper/TracyDumper.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -12,19 +12,19 @@
 block discarded – undo
12 12
  */
13 13
 class TracyDumper implements DumperInterface
14 14
 {
15
-    /**
16
-     * @var array
17
-     */
18
-    protected $options;
15
+		/**
16
+		 * @var array
17
+		 */
18
+		protected $options;
19 19
 
20
-    public function __construct(
21
-      array $options = [Dumper::DEPTH => 8, Dumper::TRUNCATE => 512]
22
-    ) {
23
-        $this->options = $options;
24
-    }
20
+		public function __construct(
21
+			array $options = [Dumper::DEPTH => 8, Dumper::TRUNCATE => 512]
22
+		) {
23
+				$this->options = $options;
24
+		}
25 25
 
26
-    public function dump(array $context)
27
-    {
28
-        return Dumper::toText($context, $this->options);
29
-    }
26
+		public function dump(array $context)
27
+		{
28
+				return Dumper::toText($context, $this->options);
29
+		}
30 30
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@  discard block
 block discarded – undo
10 10
  * @package Yep\WorkflowLogger\ContextDumper
11 11
  * @author  Martin Zeman (Zemistr) <[email protected]>
12 12
  */
13
-class TracyDumper implements DumperInterface
14
-{
13
+class TracyDumper implements DumperInterface {
15 14
     /**
16 15
      * @var array
17 16
      */
@@ -23,8 +22,7 @@  discard block
 block discarded – undo
23 22
         $this->options = $options;
24 23
     }
25 24
 
26
-    public function dump(array $context)
27
-    {
25
+    public function dump(array $context) {
28 26
         return Dumper::toText($context, $this->options);
29 27
     }
30 28
 }
Please login to merge, or discard this patch.
src/Logger.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -12,70 +12,70 @@
 block discarded – undo
12 12
  */
13 13
 class Logger extends \Monolog\Logger implements LoggerInterface
14 14
 {
15
-    /**
16
-     * Detailed workflow debug information
17
-     */
18
-    const WORKFLOW = 111;
15
+		/**
16
+		 * Detailed workflow debug information
17
+		 */
18
+		const WORKFLOW = 111;
19 19
 
20
-    /**
21
-     * @var FormatterInterface
22
-     */
23
-    protected $workflowFormatter;
20
+		/**
21
+		 * @var FormatterInterface
22
+		 */
23
+		protected $workflowFormatter;
24 24
 
25
-    /**
26
-     * Logging levels from syslog protocol defined in RFC 5424
27
-     *
28
-     * @var array $levels Logging levels
29
-     */
30
-    protected static $levels = [
31
-      self::WORKFLOW => 'WORKFLOW',
32
-    ];
25
+		/**
26
+		 * Logging levels from syslog protocol defined in RFC 5424
27
+		 *
28
+		 * @var array $levels Logging levels
29
+		 */
30
+		protected static $levels = [
31
+			self::WORKFLOW => 'WORKFLOW',
32
+		];
33 33
 
34
-    /**
35
-     * Logger constructor.
36
-     *
37
-     * @param string             $name
38
-     * @param FormatterInterface $formatter
39
-     * @param array              $handlers
40
-     * @param array              $processors
41
-     */
42
-    public function __construct(
43
-      $name,
44
-      FormatterInterface $formatter,
45
-      $handlers = [],
46
-      $processors = []
47
-    ) {
48
-        parent::__construct($name, $handlers, $processors);
49
-        self::$levels += parent::$levels;
50
-        $this->workflowFormatter = $formatter;
51
-    }
34
+		/**
35
+		 * Logger constructor.
36
+		 *
37
+		 * @param string             $name
38
+		 * @param FormatterInterface $formatter
39
+		 * @param array              $handlers
40
+		 * @param array              $processors
41
+		 */
42
+		public function __construct(
43
+			$name,
44
+			FormatterInterface $formatter,
45
+			$handlers = [],
46
+			$processors = []
47
+		) {
48
+				parent::__construct($name, $handlers, $processors);
49
+				self::$levels += parent::$levels;
50
+				$this->workflowFormatter = $formatter;
51
+		}
52 52
 
53
-    /**
54
-     * @return \DateTimeZone
55
-     */
56
-    protected function timezoneFactory()
57
-    {
58
-        if (static::$timezone) {
59
-            return static::$timezone;
60
-        }
53
+		/**
54
+		 * @return \DateTimeZone
55
+		 */
56
+		protected function timezoneFactory()
57
+		{
58
+				if (static::$timezone) {
59
+						return static::$timezone;
60
+				}
61 61
 
62
-        $timezone = date_default_timezone_get() ?: 'UTC';
62
+				$timezone = date_default_timezone_get() ?: 'UTC';
63 63
 
64
-        return static::$timezone = new \DateTimeZone($timezone);
65
-    }
64
+				return static::$timezone = new \DateTimeZone($timezone);
65
+		}
66 66
 
67
-    /**
68
-     * @param string $name
69
-     * @return Workflow
70
-     */
71
-    public function workflow($name)
72
-    {
73
-        return new Workflow(
74
-          $this,
75
-          $this->workflowFormatter,
76
-          $this->timezoneFactory(),
77
-          $name,
78
-          static::WORKFLOW
79
-        );
80
-    }
67
+		/**
68
+		 * @param string $name
69
+		 * @return Workflow
70
+		 */
71
+		public function workflow($name)
72
+		{
73
+				return new Workflow(
74
+					$this,
75
+					$this->workflowFormatter,
76
+					$this->timezoneFactory(),
77
+					$name,
78
+					static::WORKFLOW
79
+				);
80
+		}
81 81
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@  discard block
 block discarded – undo
10 10
  * @package Yep\WorkflowLogger
11 11
  * @author  Martin Zeman (Zemistr) <[email protected]>
12 12
  */
13
-class Logger extends \Monolog\Logger implements LoggerInterface
14
-{
13
+class Logger extends \Monolog\Logger implements LoggerInterface {
15 14
     /**
16 15
      * Detailed workflow debug information
17 16
      */
@@ -53,8 +52,7 @@  discard block
 block discarded – undo
53 52
     /**
54 53
      * @return \DateTimeZone
55 54
      */
56
-    protected function timezoneFactory()
57
-    {
55
+    protected function timezoneFactory() {
58 56
         if (static::$timezone) {
59 57
             return static::$timezone;
60 58
         }
@@ -68,8 +66,7 @@  discard block
 block discarded – undo
68 66
      * @param string $name
69 67
      * @return Workflow
70 68
      */
71
-    public function workflow($name)
72
-    {
69
+    public function workflow($name) {
73 70
         return new Workflow(
74 71
           $this,
75 72
           $this->workflowFormatter,
Please login to merge, or discard this patch.