Completed
Pull Request — develop (#1687)
by
unknown
16:12
created
trustedlogin/psr/log/Psr/Log/LoggerAwareTrait.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@  discard block
 block discarded – undo
11 11
 /**
12 12
  * Basic Implementation of LoggerAwareInterface.
13 13
  */
14
-trait LoggerAwareTrait
15
-{
14
+trait LoggerAwareTrait {
16 15
     /**
17 16
      * The logger instance.
18 17
      *
@@ -25,8 +24,7 @@  discard block
 block discarded – undo
25 24
      *
26 25
      * @param LoggerInterface $logger
27 26
      */
28
-    public function setLogger(LoggerInterface $logger)
29
-    {
27
+    public function setLogger(LoggerInterface $logger) {
30 28
         $this->logger = $logger;
31 29
     }
32 30
 }
Please login to merge, or discard this patch.
trustedlogin/psr/log/Psr/Log/LoggerAwareInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@
 block discarded – undo
11 11
 /**
12 12
  * Describes a logger-aware instance.
13 13
  */
14
-interface LoggerAwareInterface
15
-{
14
+interface LoggerAwareInterface {
16 15
     /**
17 16
      * Sets a logger instance on the object.
18 17
      *
Please login to merge, or discard this patch.
trustedlogin/psr/log/Psr/Log/LogLevel.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@
 block discarded – undo
11 11
 /**
12 12
  * Describes log levels.
13 13
  */
14
-class LogLevel
15
-{
14
+class LogLevel {
16 15
     const EMERGENCY = 'emergency';
17 16
     const ALERT     = 'alert';
18 17
     const CRITICAL  = 'critical';
Please login to merge, or discard this patch.
trustedlogin/psr/log/Psr/Log/NullLogger.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
  * is a good way to avoid littering your code with `if ($this->logger) { }`
17 17
  * blocks.
18 18
  */
19
-class NullLogger extends AbstractLogger
20
-{
19
+class NullLogger extends AbstractLogger {
21 20
     /**
22 21
      * Logs with an arbitrary level.
23 22
      *
@@ -29,8 +28,7 @@  discard block
 block discarded – undo
29 28
      *
30 29
      * @throws \GravityView\Psr\Log\InvalidArgumentException
31 30
      */
32
-    public function log($level, $message, array $context = array())
33
-    {
31
+    public function log($level, $message, array $context = array()) {
34 32
         // noop
35 33
     }
36 34
 }
Please login to merge, or discard this patch.
trustedlogin/psr/log/Psr/Log/LoggerTrait.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
  * reduce boilerplate code that a simple Logger that does the same thing with
17 17
  * messages regardless of the error level has to implement.
18 18
  */
19
-trait LoggerTrait
20
-{
19
+trait LoggerTrait {
21 20
     /**
22 21
      * System is unusable.
23 22
      *
@@ -26,8 +25,7 @@  discard block
 block discarded – undo
26 25
      *
27 26
      * @return void
28 27
      */
29
-    public function emergency($message, array $context = array())
30
-    {
28
+    public function emergency($message, array $context = array()) {
31 29
         $this->log(LogLevel::EMERGENCY, $message, $context);
32 30
     }
33 31
 
@@ -42,8 +40,7 @@  discard block
 block discarded – undo
42 40
      *
43 41
      * @return void
44 42
      */
45
-    public function alert($message, array $context = array())
46
-    {
43
+    public function alert($message, array $context = array()) {
47 44
         $this->log(LogLevel::ALERT, $message, $context);
48 45
     }
49 46
 
@@ -57,8 +54,7 @@  discard block
 block discarded – undo
57 54
      *
58 55
      * @return void
59 56
      */
60
-    public function critical($message, array $context = array())
61
-    {
57
+    public function critical($message, array $context = array()) {
62 58
         $this->log(LogLevel::CRITICAL, $message, $context);
63 59
     }
64 60
 
@@ -71,8 +67,7 @@  discard block
 block discarded – undo
71 67
      *
72 68
      * @return void
73 69
      */
74
-    public function error($message, array $context = array())
75
-    {
70
+    public function error($message, array $context = array()) {
76 71
         $this->log(LogLevel::ERROR, $message, $context);
77 72
     }
78 73
 
@@ -87,8 +82,7 @@  discard block
 block discarded – undo
87 82
      *
88 83
      * @return void
89 84
      */
90
-    public function warning($message, array $context = array())
91
-    {
85
+    public function warning($message, array $context = array()) {
92 86
         $this->log(LogLevel::WARNING, $message, $context);
93 87
     }
94 88
 
@@ -100,8 +94,7 @@  discard block
 block discarded – undo
100 94
      *
101 95
      * @return void
102 96
      */
103
-    public function notice($message, array $context = array())
104
-    {
97
+    public function notice($message, array $context = array()) {
105 98
         $this->log(LogLevel::NOTICE, $message, $context);
106 99
     }
107 100
 
@@ -115,8 +108,7 @@  discard block
 block discarded – undo
115 108
      *
116 109
      * @return void
117 110
      */
118
-    public function info($message, array $context = array())
119
-    {
111
+    public function info($message, array $context = array()) {
120 112
         $this->log(LogLevel::INFO, $message, $context);
121 113
     }
122 114
 
@@ -128,8 +120,7 @@  discard block
 block discarded – undo
128 120
      *
129 121
      * @return void
130 122
      */
131
-    public function debug($message, array $context = array())
132
-    {
123
+    public function debug($message, array $context = array()) {
133 124
         $this->log(LogLevel::DEBUG, $message, $context);
134 125
     }
135 126
 
Please login to merge, or discard this patch.
trustedlogin/psr/log/Psr/Log/Test/TestLogger.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -60,8 +60,7 @@  discard block
 block discarded – undo
60 60
  * @method bool hasInfoThatPasses($message)
61 61
  * @method bool hasDebugThatPasses($message)
62 62
  */
63
-class TestLogger extends AbstractLogger
64
-{
63
+class TestLogger extends AbstractLogger {
65 64
     /**
66 65
      * @var array
67 66
      */
@@ -72,8 +71,7 @@  discard block
 block discarded – undo
72 71
     /**
73 72
      * @inheritdoc
74 73
      */
75
-    public function log($level, $message, array $context = [])
76
-    {
74
+    public function log($level, $message, array $context = []) {
77 75
         $record = [
78 76
             'level' => $level,
79 77
             'message' => $message,
@@ -84,13 +82,11 @@  discard block
 block discarded – undo
84 82
         $this->records[] = $record;
85 83
     }
86 84
 
87
-    public function hasRecords($level)
88
-    {
85
+    public function hasRecords($level) {
89 86
         return isset($this->recordsByLevel[$level]);
90 87
     }
91 88
 
92
-    public function hasRecord($record, $level)
93
-    {
89
+    public function hasRecord($record, $level) {
94 90
         if (is_string($record)) {
95 91
             $record = ['message' => $record];
96 92
         }
@@ -105,22 +101,19 @@  discard block
 block discarded – undo
105 101
         }, $level);
106 102
     }
107 103
 
108
-    public function hasRecordThatContains($message, $level)
109
-    {
104
+    public function hasRecordThatContains($message, $level) {
110 105
         return $this->hasRecordThatPasses(function ($rec) use ($message) {
111 106
             return strpos($rec['message'], $message) !== false;
112 107
         }, $level);
113 108
     }
114 109
 
115
-    public function hasRecordThatMatches($regex, $level)
116
-    {
110
+    public function hasRecordThatMatches($regex, $level) {
117 111
         return $this->hasRecordThatPasses(function ($rec) use ($regex) {
118 112
             return preg_match($regex, $rec['message']) > 0;
119 113
         }, $level);
120 114
     }
121 115
 
122
-    public function hasRecordThatPasses(callable $predicate, $level)
123
-    {
116
+    public function hasRecordThatPasses(callable $predicate, $level) {
124 117
         if (!isset($this->recordsByLevel[$level])) {
125 118
             return false;
126 119
         }
@@ -132,8 +125,7 @@  discard block
 block discarded – undo
132 125
         return false;
133 126
     }
134 127
 
135
-    public function __call($method, $args)
136
-    {
128
+    public function __call($method, $args) {
137 129
         if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
138 130
             $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
139 131
             $level = strtolower($matches[2]);
@@ -145,8 +137,7 @@  discard block
 block discarded – undo
145 137
         throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
146 138
     }
147 139
 
148
-    public function reset()
149
-    {
140
+    public function reset() {
150 141
         $this->records = [];
151 142
         $this->recordsByLevel = [];
152 143
     }
Please login to merge, or discard this patch.
trustedlogin/psr/log/Psr/Log/Test/LoggerInterfaceTest.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@  discard block
 block discarded – undo
18 18
  * Implementors can extend the class and implement abstract methods to run this
19 19
  * as part of their test suite.
20 20
  */
21
-abstract class LoggerInterfaceTest extends TestCase
22
-{
21
+abstract class LoggerInterfaceTest extends TestCase {
23 22
     /**
24 23
      * @return LoggerInterface
25 24
      */
@@ -36,16 +35,14 @@  discard block
 block discarded – undo
36 35
      */
37 36
     abstract public function getLogs();
38 37
 
39
-    public function testImplements()
40
-    {
38
+    public function testImplements() {
41 39
         $this->assertInstanceOf('GravityView\Psr\Log\LoggerInterface', $this->getLogger());
42 40
     }
43 41
 
44 42
     /**
45 43
      * @dataProvider provideLevelsAndMessages
46 44
      */
47
-    public function testLogsAtAllLevels($level, $message)
48
-    {
45
+    public function testLogsAtAllLevels($level, $message) {
49 46
         $logger = $this->getLogger();
50 47
         $logger->{$level}($message, array('user' => 'Bob'));
51 48
         $logger->log($level, $message, array('user' => 'Bob'));
@@ -57,8 +54,7 @@  discard block
 block discarded – undo
57 54
         $this->assertEquals($expected, $this->getLogs());
58 55
     }
59 56
 
60
-    public function provideLevelsAndMessages()
61
-    {
57
+    public function provideLevelsAndMessages() {
62 58
         return array(
63 59
             LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
64 60
             LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
@@ -74,14 +70,12 @@  discard block
 block discarded – undo
74 70
     /**
75 71
      * @expectedException \GravityView\Psr\Log\InvalidArgumentException
76 72
      */
77
-    public function testThrowsOnInvalidLevel()
78
-    {
73
+    public function testThrowsOnInvalidLevel() {
79 74
         $logger = $this->getLogger();
80 75
         $logger->log('invalid level', 'Foo');
81 76
     }
82 77
 
83
-    public function testContextReplacement()
84
-    {
78
+    public function testContextReplacement() {
85 79
         $logger = $this->getLogger();
86 80
         $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
87 81
 
@@ -89,8 +83,7 @@  discard block
 block discarded – undo
89 83
         $this->assertEquals($expected, $this->getLogs());
90 84
     }
91 85
 
92
-    public function testObjectCastToString()
93
-    {
86
+    public function testObjectCastToString() {
94 87
         if (method_exists($this, 'createPartialMock')) {
95 88
             $dummy = $this->createPartialMock('GravityView\GravityView\Psr\Log\Test\DummyTest', array('__toString'));
96 89
         } else {
@@ -106,8 +99,7 @@  discard block
 block discarded – undo
106 99
         $this->assertEquals($expected, $this->getLogs());
107 100
     }
108 101
 
109
-    public function testContextCanContainAnything()
110
-    {
102
+    public function testContextCanContainAnything() {
111 103
         $closed = fopen('php://memory', 'r');
112 104
         fclose($closed);
113 105
 
@@ -129,8 +121,7 @@  discard block
 block discarded – undo
129 121
         $this->assertEquals($expected, $this->getLogs());
130 122
     }
131 123
 
132
-    public function testContextExceptionKeyCanBeExceptionOrOtherValues()
133
-    {
124
+    public function testContextExceptionKeyCanBeExceptionOrOtherValues() {
134 125
         $logger = $this->getLogger();
135 126
         $logger->warning('Random message', array('exception' => 'oops'));
136 127
         $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
Please login to merge, or discard this patch.
trustedlogin/psr/log/Psr/Log/Test/DummyTest.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,10 +15,8 @@
 block discarded – undo
15 15
  *
16 16
  * @internal
17 17
  */
18
-class DummyTest
19
-{
20
-    public function __toString()
21
-    {
18
+class DummyTest {
19
+    public function __toString() {
22 20
         return 'DummyTest';
23 21
     }
24 22
 }
Please login to merge, or discard this patch.
trustedlogin/psr/log/Psr/Log/LoggerInterface.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@
 block discarded – undo
23 23
  * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
24 24
  * for the full interface specification.
25 25
  */
26
-interface LoggerInterface
27
-{
26
+interface LoggerInterface {
28 27
     /**
29 28
      * System is unusable.
30 29
      *
Please login to merge, or discard this patch.