@@ -7,20 +7,20 @@ |
||
7 | 7 | */ |
8 | 8 | trait LoggerAwareTrait |
9 | 9 | { |
10 | - /** |
|
11 | - * The logger instance. |
|
12 | - * |
|
13 | - * @var LoggerInterface|null |
|
14 | - */ |
|
15 | - protected $logger; |
|
10 | + /** |
|
11 | + * The logger instance. |
|
12 | + * |
|
13 | + * @var LoggerInterface|null |
|
14 | + */ |
|
15 | + protected $logger; |
|
16 | 16 | |
17 | - /** |
|
18 | - * Sets a logger. |
|
19 | - * |
|
20 | - * @param LoggerInterface $logger |
|
21 | - */ |
|
22 | - public function setLogger(LoggerInterface $logger) |
|
23 | - { |
|
24 | - $this->logger = $logger; |
|
25 | - } |
|
17 | + /** |
|
18 | + * Sets a logger. |
|
19 | + * |
|
20 | + * @param LoggerInterface $logger |
|
21 | + */ |
|
22 | + public function setLogger(LoggerInterface $logger) |
|
23 | + { |
|
24 | + $this->logger = $logger; |
|
25 | + } |
|
26 | 26 | } |
@@ -5,8 +5,7 @@ |
||
5 | 5 | /** |
6 | 6 | * Basic Implementation of LoggerAwareInterface. |
7 | 7 | */ |
8 | -trait LoggerAwareTrait |
|
9 | -{ |
|
8 | +trait LoggerAwareTrait { |
|
10 | 9 | /** |
11 | 10 | * The logger instance. |
12 | 11 | * |
@@ -56,92 +56,92 @@ |
||
56 | 56 | */ |
57 | 57 | class TestLogger extends AbstractLogger |
58 | 58 | { |
59 | - /** |
|
60 | - * @var array |
|
61 | - */ |
|
62 | - public $records = []; |
|
59 | + /** |
|
60 | + * @var array |
|
61 | + */ |
|
62 | + public $records = []; |
|
63 | 63 | |
64 | - public $recordsByLevel = []; |
|
64 | + public $recordsByLevel = []; |
|
65 | 65 | |
66 | - /** |
|
67 | - * @inheritdoc |
|
68 | - */ |
|
69 | - public function log($level, $message, array $context = []) |
|
70 | - { |
|
71 | - $record = [ |
|
72 | - 'level' => $level, |
|
73 | - 'message' => $message, |
|
74 | - 'context' => $context, |
|
75 | - ]; |
|
66 | + /** |
|
67 | + * @inheritdoc |
|
68 | + */ |
|
69 | + public function log($level, $message, array $context = []) |
|
70 | + { |
|
71 | + $record = [ |
|
72 | + 'level' => $level, |
|
73 | + 'message' => $message, |
|
74 | + 'context' => $context, |
|
75 | + ]; |
|
76 | 76 | |
77 | - $this->recordsByLevel[$record['level']][] = $record; |
|
78 | - $this->records[] = $record; |
|
79 | - } |
|
77 | + $this->recordsByLevel[$record['level']][] = $record; |
|
78 | + $this->records[] = $record; |
|
79 | + } |
|
80 | 80 | |
81 | - public function hasRecords($level) |
|
82 | - { |
|
83 | - return isset($this->recordsByLevel[$level]); |
|
84 | - } |
|
81 | + public function hasRecords($level) |
|
82 | + { |
|
83 | + return isset($this->recordsByLevel[$level]); |
|
84 | + } |
|
85 | 85 | |
86 | - public function hasRecord($record, $level) |
|
87 | - { |
|
88 | - if (is_string($record)) { |
|
89 | - $record = ['message' => $record]; |
|
90 | - } |
|
91 | - return $this->hasRecordThatPasses(function ($rec) use ($record) { |
|
92 | - if ($rec['message'] !== $record['message']) { |
|
93 | - return false; |
|
94 | - } |
|
95 | - if (isset($record['context']) && $rec['context'] !== $record['context']) { |
|
96 | - return false; |
|
97 | - } |
|
98 | - return true; |
|
99 | - }, $level); |
|
100 | - } |
|
86 | + public function hasRecord($record, $level) |
|
87 | + { |
|
88 | + if (is_string($record)) { |
|
89 | + $record = ['message' => $record]; |
|
90 | + } |
|
91 | + return $this->hasRecordThatPasses(function ($rec) use ($record) { |
|
92 | + if ($rec['message'] !== $record['message']) { |
|
93 | + return false; |
|
94 | + } |
|
95 | + if (isset($record['context']) && $rec['context'] !== $record['context']) { |
|
96 | + return false; |
|
97 | + } |
|
98 | + return true; |
|
99 | + }, $level); |
|
100 | + } |
|
101 | 101 | |
102 | - public function hasRecordThatContains($message, $level) |
|
103 | - { |
|
104 | - return $this->hasRecordThatPasses(function ($rec) use ($message) { |
|
105 | - return strpos($rec['message'], $message) !== false; |
|
106 | - }, $level); |
|
107 | - } |
|
102 | + public function hasRecordThatContains($message, $level) |
|
103 | + { |
|
104 | + return $this->hasRecordThatPasses(function ($rec) use ($message) { |
|
105 | + return strpos($rec['message'], $message) !== false; |
|
106 | + }, $level); |
|
107 | + } |
|
108 | 108 | |
109 | - public function hasRecordThatMatches($regex, $level) |
|
110 | - { |
|
111 | - return $this->hasRecordThatPasses(function ($rec) use ($regex) { |
|
112 | - return preg_match($regex, $rec['message']) > 0; |
|
113 | - }, $level); |
|
114 | - } |
|
109 | + public function hasRecordThatMatches($regex, $level) |
|
110 | + { |
|
111 | + return $this->hasRecordThatPasses(function ($rec) use ($regex) { |
|
112 | + return preg_match($regex, $rec['message']) > 0; |
|
113 | + }, $level); |
|
114 | + } |
|
115 | 115 | |
116 | - public function hasRecordThatPasses(callable $predicate, $level) |
|
117 | - { |
|
118 | - if (!isset($this->recordsByLevel[$level])) { |
|
119 | - return false; |
|
120 | - } |
|
121 | - foreach ($this->recordsByLevel[$level] as $i => $rec) { |
|
122 | - if (call_user_func($predicate, $rec, $i)) { |
|
123 | - return true; |
|
124 | - } |
|
125 | - } |
|
126 | - return false; |
|
127 | - } |
|
116 | + public function hasRecordThatPasses(callable $predicate, $level) |
|
117 | + { |
|
118 | + if (!isset($this->recordsByLevel[$level])) { |
|
119 | + return false; |
|
120 | + } |
|
121 | + foreach ($this->recordsByLevel[$level] as $i => $rec) { |
|
122 | + if (call_user_func($predicate, $rec, $i)) { |
|
123 | + return true; |
|
124 | + } |
|
125 | + } |
|
126 | + return false; |
|
127 | + } |
|
128 | 128 | |
129 | - public function __call($method, $args) |
|
130 | - { |
|
131 | - if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { |
|
132 | - $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; |
|
133 | - $level = strtolower($matches[2]); |
|
134 | - if (method_exists($this, $genericMethod)) { |
|
135 | - $args[] = $level; |
|
136 | - return call_user_func_array([$this, $genericMethod], $args); |
|
137 | - } |
|
138 | - } |
|
139 | - throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); |
|
140 | - } |
|
129 | + public function __call($method, $args) |
|
130 | + { |
|
131 | + if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { |
|
132 | + $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; |
|
133 | + $level = strtolower($matches[2]); |
|
134 | + if (method_exists($this, $genericMethod)) { |
|
135 | + $args[] = $level; |
|
136 | + return call_user_func_array([$this, $genericMethod], $args); |
|
137 | + } |
|
138 | + } |
|
139 | + throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); |
|
140 | + } |
|
141 | 141 | |
142 | - public function reset() |
|
143 | - { |
|
144 | - $this->records = []; |
|
145 | - $this->recordsByLevel = []; |
|
146 | - } |
|
142 | + public function reset() |
|
143 | + { |
|
144 | + $this->records = []; |
|
145 | + $this->recordsByLevel = []; |
|
146 | + } |
|
147 | 147 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | if (is_string($record)) { |
89 | 89 | $record = ['message' => $record]; |
90 | 90 | } |
91 | - return $this->hasRecordThatPasses(function ($rec) use ($record) { |
|
91 | + return $this->hasRecordThatPasses(function($rec) use ($record) { |
|
92 | 92 | if ($rec['message'] !== $record['message']) { |
93 | 93 | return false; |
94 | 94 | } |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | |
102 | 102 | public function hasRecordThatContains($message, $level) |
103 | 103 | { |
104 | - return $this->hasRecordThatPasses(function ($rec) use ($message) { |
|
104 | + return $this->hasRecordThatPasses(function($rec) use ($message) { |
|
105 | 105 | return strpos($rec['message'], $message) !== false; |
106 | 106 | }, $level); |
107 | 107 | } |
108 | 108 | |
109 | 109 | public function hasRecordThatMatches($regex, $level) |
110 | 110 | { |
111 | - return $this->hasRecordThatPasses(function ($rec) use ($regex) { |
|
111 | + return $this->hasRecordThatPasses(function($rec) use ($regex) { |
|
112 | 112 | return preg_match($regex, $rec['message']) > 0; |
113 | 113 | }, $level); |
114 | 114 | } |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | public function __call($method, $args) |
130 | 130 | { |
131 | 131 | if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { |
132 | - $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; |
|
132 | + $genericMethod = $matches[1].('Records' !== $matches[3] ? 'Record' : '').$matches[3]; |
|
133 | 133 | $level = strtolower($matches[2]); |
134 | 134 | if (method_exists($this, $genericMethod)) { |
135 | 135 | $args[] = $level; |
136 | 136 | return call_user_func_array([$this, $genericMethod], $args); |
137 | 137 | } |
138 | 138 | } |
139 | - throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); |
|
139 | + throw new \BadMethodCallException('Call to undefined method '.get_class($this).'::'.$method.'()'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | public function reset() |
@@ -54,8 +54,7 @@ |
||
54 | 54 | * @method bool hasInfoThatPasses($message) |
55 | 55 | * @method bool hasDebugThatPasses($message) |
56 | 56 | */ |
57 | -class TestLogger extends AbstractLogger |
|
58 | -{ |
|
57 | +class TestLogger extends AbstractLogger { |
|
59 | 58 | /** |
60 | 59 | * @var array |
61 | 60 | */ |
@@ -14,125 +14,125 @@ |
||
14 | 14 | */ |
15 | 15 | abstract class LoggerInterfaceTest extends TestCase |
16 | 16 | { |
17 | - /** |
|
18 | - * @return LoggerInterface |
|
19 | - */ |
|
20 | - abstract public function getLogger(); |
|
21 | - |
|
22 | - /** |
|
23 | - * This must return the log messages in order. |
|
24 | - * |
|
25 | - * The simple formatting of the messages is: "<LOG LEVEL> <MESSAGE>". |
|
26 | - * |
|
27 | - * Example ->error('Foo') would yield "error Foo". |
|
28 | - * |
|
29 | - * @return string[] |
|
30 | - */ |
|
31 | - abstract public function getLogs(); |
|
32 | - |
|
33 | - public function testImplements() |
|
34 | - { |
|
35 | - $this->assertInstanceOf('OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\LoggerInterface', $this->getLogger()); |
|
36 | - } |
|
37 | - |
|
38 | - /** |
|
39 | - * @dataProvider provideLevelsAndMessages |
|
40 | - */ |
|
41 | - public function testLogsAtAllLevels($level, $message) |
|
42 | - { |
|
43 | - $logger = $this->getLogger(); |
|
44 | - $logger->{$level}($message, array('user' => 'Bob')); |
|
45 | - $logger->log($level, $message, array('user' => 'Bob')); |
|
46 | - |
|
47 | - $expected = array( |
|
48 | - $level.' message of level '.$level.' with context: Bob', |
|
49 | - $level.' message of level '.$level.' with context: Bob', |
|
50 | - ); |
|
51 | - $this->assertEquals($expected, $this->getLogs()); |
|
52 | - } |
|
53 | - |
|
54 | - public function provideLevelsAndMessages() |
|
55 | - { |
|
56 | - return array( |
|
57 | - LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), |
|
58 | - LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), |
|
59 | - LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), |
|
60 | - LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), |
|
61 | - LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), |
|
62 | - LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), |
|
63 | - LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), |
|
64 | - LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), |
|
65 | - ); |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * @expectedException \OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\InvalidArgumentException |
|
70 | - */ |
|
71 | - public function testThrowsOnInvalidLevel() |
|
72 | - { |
|
73 | - $logger = $this->getLogger(); |
|
74 | - $logger->log('invalid level', 'Foo'); |
|
75 | - } |
|
76 | - |
|
77 | - public function testContextReplacement() |
|
78 | - { |
|
79 | - $logger = $this->getLogger(); |
|
80 | - $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); |
|
81 | - |
|
82 | - $expected = array('info {Message {nothing} Bob Bar a}'); |
|
83 | - $this->assertEquals($expected, $this->getLogs()); |
|
84 | - } |
|
85 | - |
|
86 | - public function testObjectCastToString() |
|
87 | - { |
|
88 | - if (method_exists($this, 'createPartialMock')) { |
|
89 | - $dummy = $this->createPartialMock('OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\Test\DummyTest', array('__toString')); |
|
90 | - } else { |
|
91 | - $dummy = $this->getMock('OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\Test\DummyTest', array('__toString')); |
|
92 | - } |
|
93 | - $dummy->expects($this->once()) |
|
94 | - ->method('__toString') |
|
95 | - ->will($this->returnValue('DUMMY')); |
|
96 | - |
|
97 | - $this->getLogger()->warning($dummy); |
|
98 | - |
|
99 | - $expected = array('warning DUMMY'); |
|
100 | - $this->assertEquals($expected, $this->getLogs()); |
|
101 | - } |
|
102 | - |
|
103 | - public function testContextCanContainAnything() |
|
104 | - { |
|
105 | - $closed = fopen('php://memory', 'r'); |
|
106 | - fclose($closed); |
|
107 | - |
|
108 | - $context = array( |
|
109 | - 'bool' => true, |
|
110 | - 'null' => null, |
|
111 | - 'string' => 'Foo', |
|
112 | - 'int' => 0, |
|
113 | - 'float' => 0.5, |
|
114 | - 'nested' => array('with object' => new DummyTest), |
|
115 | - 'object' => new \DateTime, |
|
116 | - 'resource' => fopen('php://memory', 'r'), |
|
117 | - 'closed' => $closed, |
|
118 | - ); |
|
119 | - |
|
120 | - $this->getLogger()->warning('Crazy context data', $context); |
|
121 | - |
|
122 | - $expected = array('warning Crazy context data'); |
|
123 | - $this->assertEquals($expected, $this->getLogs()); |
|
124 | - } |
|
125 | - |
|
126 | - public function testContextExceptionKeyCanBeExceptionOrOtherValues() |
|
127 | - { |
|
128 | - $logger = $this->getLogger(); |
|
129 | - $logger->warning('Random message', array('exception' => 'oops')); |
|
130 | - $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); |
|
131 | - |
|
132 | - $expected = array( |
|
133 | - 'warning Random message', |
|
134 | - 'critical Uncaught Exception!' |
|
135 | - ); |
|
136 | - $this->assertEquals($expected, $this->getLogs()); |
|
137 | - } |
|
17 | + /** |
|
18 | + * @return LoggerInterface |
|
19 | + */ |
|
20 | + abstract public function getLogger(); |
|
21 | + |
|
22 | + /** |
|
23 | + * This must return the log messages in order. |
|
24 | + * |
|
25 | + * The simple formatting of the messages is: "<LOG LEVEL> <MESSAGE>". |
|
26 | + * |
|
27 | + * Example ->error('Foo') would yield "error Foo". |
|
28 | + * |
|
29 | + * @return string[] |
|
30 | + */ |
|
31 | + abstract public function getLogs(); |
|
32 | + |
|
33 | + public function testImplements() |
|
34 | + { |
|
35 | + $this->assertInstanceOf('OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\LoggerInterface', $this->getLogger()); |
|
36 | + } |
|
37 | + |
|
38 | + /** |
|
39 | + * @dataProvider provideLevelsAndMessages |
|
40 | + */ |
|
41 | + public function testLogsAtAllLevels($level, $message) |
|
42 | + { |
|
43 | + $logger = $this->getLogger(); |
|
44 | + $logger->{$level}($message, array('user' => 'Bob')); |
|
45 | + $logger->log($level, $message, array('user' => 'Bob')); |
|
46 | + |
|
47 | + $expected = array( |
|
48 | + $level.' message of level '.$level.' with context: Bob', |
|
49 | + $level.' message of level '.$level.' with context: Bob', |
|
50 | + ); |
|
51 | + $this->assertEquals($expected, $this->getLogs()); |
|
52 | + } |
|
53 | + |
|
54 | + public function provideLevelsAndMessages() |
|
55 | + { |
|
56 | + return array( |
|
57 | + LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'), |
|
58 | + LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'), |
|
59 | + LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'), |
|
60 | + LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'), |
|
61 | + LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'), |
|
62 | + LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'), |
|
63 | + LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'), |
|
64 | + LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'), |
|
65 | + ); |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * @expectedException \OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\InvalidArgumentException |
|
70 | + */ |
|
71 | + public function testThrowsOnInvalidLevel() |
|
72 | + { |
|
73 | + $logger = $this->getLogger(); |
|
74 | + $logger->log('invalid level', 'Foo'); |
|
75 | + } |
|
76 | + |
|
77 | + public function testContextReplacement() |
|
78 | + { |
|
79 | + $logger = $this->getLogger(); |
|
80 | + $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar')); |
|
81 | + |
|
82 | + $expected = array('info {Message {nothing} Bob Bar a}'); |
|
83 | + $this->assertEquals($expected, $this->getLogs()); |
|
84 | + } |
|
85 | + |
|
86 | + public function testObjectCastToString() |
|
87 | + { |
|
88 | + if (method_exists($this, 'createPartialMock')) { |
|
89 | + $dummy = $this->createPartialMock('OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\Test\DummyTest', array('__toString')); |
|
90 | + } else { |
|
91 | + $dummy = $this->getMock('OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\Test\DummyTest', array('__toString')); |
|
92 | + } |
|
93 | + $dummy->expects($this->once()) |
|
94 | + ->method('__toString') |
|
95 | + ->will($this->returnValue('DUMMY')); |
|
96 | + |
|
97 | + $this->getLogger()->warning($dummy); |
|
98 | + |
|
99 | + $expected = array('warning DUMMY'); |
|
100 | + $this->assertEquals($expected, $this->getLogs()); |
|
101 | + } |
|
102 | + |
|
103 | + public function testContextCanContainAnything() |
|
104 | + { |
|
105 | + $closed = fopen('php://memory', 'r'); |
|
106 | + fclose($closed); |
|
107 | + |
|
108 | + $context = array( |
|
109 | + 'bool' => true, |
|
110 | + 'null' => null, |
|
111 | + 'string' => 'Foo', |
|
112 | + 'int' => 0, |
|
113 | + 'float' => 0.5, |
|
114 | + 'nested' => array('with object' => new DummyTest), |
|
115 | + 'object' => new \DateTime, |
|
116 | + 'resource' => fopen('php://memory', 'r'), |
|
117 | + 'closed' => $closed, |
|
118 | + ); |
|
119 | + |
|
120 | + $this->getLogger()->warning('Crazy context data', $context); |
|
121 | + |
|
122 | + $expected = array('warning Crazy context data'); |
|
123 | + $this->assertEquals($expected, $this->getLogs()); |
|
124 | + } |
|
125 | + |
|
126 | + public function testContextExceptionKeyCanBeExceptionOrOtherValues() |
|
127 | + { |
|
128 | + $logger = $this->getLogger(); |
|
129 | + $logger->warning('Random message', array('exception' => 'oops')); |
|
130 | + $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail'))); |
|
131 | + |
|
132 | + $expected = array( |
|
133 | + 'warning Random message', |
|
134 | + 'critical Uncaught Exception!' |
|
135 | + ); |
|
136 | + $this->assertEquals($expected, $this->getLogs()); |
|
137 | + } |
|
138 | 138 | } |
@@ -12,8 +12,7 @@ |
||
12 | 12 | * Implementors can extend the class and implement abstract methods to run this |
13 | 13 | * as part of their test suite. |
14 | 14 | */ |
15 | -abstract class LoggerInterfaceTest extends TestCase |
|
16 | -{ |
|
15 | +abstract class LoggerInterfaceTest extends TestCase { |
|
17 | 16 | /** |
18 | 17 | * @return LoggerInterface |
19 | 18 | */ |
@@ -11,8 +11,8 @@ |
||
11 | 11 | */ |
12 | 12 | class DummyTest |
13 | 13 | { |
14 | - public function __toString() |
|
15 | - { |
|
16 | - return 'DummyTest'; |
|
17 | - } |
|
14 | + public function __toString() |
|
15 | + { |
|
16 | + return 'DummyTest'; |
|
17 | + } |
|
18 | 18 | } |
@@ -9,8 +9,7 @@ |
||
9 | 9 | * |
10 | 10 | * @internal |
11 | 11 | */ |
12 | -class DummyTest |
|
13 | -{ |
|
12 | +class DummyTest { |
|
14 | 13 | public function __toString() |
15 | 14 | { |
16 | 15 | return 'DummyTest'; |
@@ -12,19 +12,19 @@ |
||
12 | 12 | */ |
13 | 13 | class NullLogger extends AbstractLogger |
14 | 14 | { |
15 | - /** |
|
16 | - * Logs with an arbitrary level. |
|
17 | - * |
|
18 | - * @param mixed $level |
|
19 | - * @param string $message |
|
20 | - * @param array $context |
|
21 | - * |
|
22 | - * @return void |
|
23 | - * |
|
24 | - * @throws \OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\InvalidArgumentException |
|
25 | - */ |
|
26 | - public function log($level, $message, array $context = array()) |
|
27 | - { |
|
28 | - // noop |
|
29 | - } |
|
15 | + /** |
|
16 | + * Logs with an arbitrary level. |
|
17 | + * |
|
18 | + * @param mixed $level |
|
19 | + * @param string $message |
|
20 | + * @param array $context |
|
21 | + * |
|
22 | + * @return void |
|
23 | + * |
|
24 | + * @throws \OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Log\InvalidArgumentException |
|
25 | + */ |
|
26 | + public function log($level, $message, array $context = array()) |
|
27 | + { |
|
28 | + // noop |
|
29 | + } |
|
30 | 30 | } |
@@ -10,8 +10,7 @@ |
||
10 | 10 | * is a good way to avoid littering your code with `if ($this->logger) { }` |
11 | 11 | * blocks. |
12 | 12 | */ |
13 | -class NullLogger extends AbstractLogger |
|
14 | -{ |
|
13 | +class NullLogger extends AbstractLogger { |
|
15 | 14 | /** |
16 | 15 | * Logs with an arbitrary level. |
17 | 16 | * |
@@ -7,12 +7,12 @@ |
||
7 | 7 | */ |
8 | 8 | interface LoggerAwareInterface |
9 | 9 | { |
10 | - /** |
|
11 | - * Sets a logger instance on the object. |
|
12 | - * |
|
13 | - * @param LoggerInterface $logger |
|
14 | - * |
|
15 | - * @return void |
|
16 | - */ |
|
17 | - public function setLogger(LoggerInterface $logger); |
|
10 | + /** |
|
11 | + * Sets a logger instance on the object. |
|
12 | + * |
|
13 | + * @param LoggerInterface $logger |
|
14 | + * |
|
15 | + * @return void |
|
16 | + */ |
|
17 | + public function setLogger(LoggerInterface $logger); |
|
18 | 18 | } |
@@ -5,8 +5,7 @@ |
||
5 | 5 | /** |
6 | 6 | * Describes a logger-aware instance. |
7 | 7 | */ |
8 | -interface LoggerAwareInterface |
|
9 | -{ |
|
8 | +interface LoggerAwareInterface { |
|
10 | 9 | /** |
11 | 10 | * Sets a logger instance on the object. |
12 | 11 | * |
@@ -24,301 +24,301 @@ |
||
24 | 24 | */ |
25 | 25 | interface UriInterface |
26 | 26 | { |
27 | - /** |
|
28 | - * Retrieve the scheme component of the URI. |
|
29 | - * |
|
30 | - * If no scheme is present, this method MUST return an empty string. |
|
31 | - * |
|
32 | - * The value returned MUST be normalized to lowercase, per RFC 3986 |
|
33 | - * Section 3.1. |
|
34 | - * |
|
35 | - * The trailing ":" character is not part of the scheme and MUST NOT be |
|
36 | - * added. |
|
37 | - * |
|
38 | - * @see https://tools.ietf.org/html/rfc3986#section-3.1 |
|
39 | - * @return string The URI scheme. |
|
40 | - */ |
|
41 | - public function getScheme(): string; |
|
27 | + /** |
|
28 | + * Retrieve the scheme component of the URI. |
|
29 | + * |
|
30 | + * If no scheme is present, this method MUST return an empty string. |
|
31 | + * |
|
32 | + * The value returned MUST be normalized to lowercase, per RFC 3986 |
|
33 | + * Section 3.1. |
|
34 | + * |
|
35 | + * The trailing ":" character is not part of the scheme and MUST NOT be |
|
36 | + * added. |
|
37 | + * |
|
38 | + * @see https://tools.ietf.org/html/rfc3986#section-3.1 |
|
39 | + * @return string The URI scheme. |
|
40 | + */ |
|
41 | + public function getScheme(): string; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Retrieve the authority component of the URI. |
|
45 | - * |
|
46 | - * If no authority information is present, this method MUST return an empty |
|
47 | - * string. |
|
48 | - * |
|
49 | - * The authority syntax of the URI is: |
|
50 | - * |
|
51 | - * <pre> |
|
52 | - * [user-info@]host[:port] |
|
53 | - * </pre> |
|
54 | - * |
|
55 | - * If the port component is not set or is the standard port for the current |
|
56 | - * scheme, it SHOULD NOT be included. |
|
57 | - * |
|
58 | - * @see https://tools.ietf.org/html/rfc3986#section-3.2 |
|
59 | - * @return string The URI authority, in "[user-info@]host[:port]" format. |
|
60 | - */ |
|
61 | - public function getAuthority(): string; |
|
43 | + /** |
|
44 | + * Retrieve the authority component of the URI. |
|
45 | + * |
|
46 | + * If no authority information is present, this method MUST return an empty |
|
47 | + * string. |
|
48 | + * |
|
49 | + * The authority syntax of the URI is: |
|
50 | + * |
|
51 | + * <pre> |
|
52 | + * [user-info@]host[:port] |
|
53 | + * </pre> |
|
54 | + * |
|
55 | + * If the port component is not set or is the standard port for the current |
|
56 | + * scheme, it SHOULD NOT be included. |
|
57 | + * |
|
58 | + * @see https://tools.ietf.org/html/rfc3986#section-3.2 |
|
59 | + * @return string The URI authority, in "[user-info@]host[:port]" format. |
|
60 | + */ |
|
61 | + public function getAuthority(): string; |
|
62 | 62 | |
63 | - /** |
|
64 | - * Retrieve the user information component of the URI. |
|
65 | - * |
|
66 | - * If no user information is present, this method MUST return an empty |
|
67 | - * string. |
|
68 | - * |
|
69 | - * If a user is present in the URI, this will return that value; |
|
70 | - * additionally, if the password is also present, it will be appended to the |
|
71 | - * user value, with a colon (":") separating the values. |
|
72 | - * |
|
73 | - * The trailing "@" character is not part of the user information and MUST |
|
74 | - * NOT be added. |
|
75 | - * |
|
76 | - * @return string The URI user information, in "username[:password]" format. |
|
77 | - */ |
|
78 | - public function getUserInfo(): string; |
|
63 | + /** |
|
64 | + * Retrieve the user information component of the URI. |
|
65 | + * |
|
66 | + * If no user information is present, this method MUST return an empty |
|
67 | + * string. |
|
68 | + * |
|
69 | + * If a user is present in the URI, this will return that value; |
|
70 | + * additionally, if the password is also present, it will be appended to the |
|
71 | + * user value, with a colon (":") separating the values. |
|
72 | + * |
|
73 | + * The trailing "@" character is not part of the user information and MUST |
|
74 | + * NOT be added. |
|
75 | + * |
|
76 | + * @return string The URI user information, in "username[:password]" format. |
|
77 | + */ |
|
78 | + public function getUserInfo(): string; |
|
79 | 79 | |
80 | - /** |
|
81 | - * Retrieve the host component of the URI. |
|
82 | - * |
|
83 | - * If no host is present, this method MUST return an empty string. |
|
84 | - * |
|
85 | - * The value returned MUST be normalized to lowercase, per RFC 3986 |
|
86 | - * Section 3.2.2. |
|
87 | - * |
|
88 | - * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 |
|
89 | - * @return string The URI host. |
|
90 | - */ |
|
91 | - public function getHost(): string; |
|
80 | + /** |
|
81 | + * Retrieve the host component of the URI. |
|
82 | + * |
|
83 | + * If no host is present, this method MUST return an empty string. |
|
84 | + * |
|
85 | + * The value returned MUST be normalized to lowercase, per RFC 3986 |
|
86 | + * Section 3.2.2. |
|
87 | + * |
|
88 | + * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 |
|
89 | + * @return string The URI host. |
|
90 | + */ |
|
91 | + public function getHost(): string; |
|
92 | 92 | |
93 | - /** |
|
94 | - * Retrieve the port component of the URI. |
|
95 | - * |
|
96 | - * If a port is present, and it is non-standard for the current scheme, |
|
97 | - * this method MUST return it as an integer. If the port is the standard port |
|
98 | - * used with the current scheme, this method SHOULD return null. |
|
99 | - * |
|
100 | - * If no port is present, and no scheme is present, this method MUST return |
|
101 | - * a null value. |
|
102 | - * |
|
103 | - * If no port is present, but a scheme is present, this method MAY return |
|
104 | - * the standard port for that scheme, but SHOULD return null. |
|
105 | - * |
|
106 | - * @return null|int The URI port. |
|
107 | - */ |
|
108 | - public function getPort(): ?int; |
|
93 | + /** |
|
94 | + * Retrieve the port component of the URI. |
|
95 | + * |
|
96 | + * If a port is present, and it is non-standard for the current scheme, |
|
97 | + * this method MUST return it as an integer. If the port is the standard port |
|
98 | + * used with the current scheme, this method SHOULD return null. |
|
99 | + * |
|
100 | + * If no port is present, and no scheme is present, this method MUST return |
|
101 | + * a null value. |
|
102 | + * |
|
103 | + * If no port is present, but a scheme is present, this method MAY return |
|
104 | + * the standard port for that scheme, but SHOULD return null. |
|
105 | + * |
|
106 | + * @return null|int The URI port. |
|
107 | + */ |
|
108 | + public function getPort(): ?int; |
|
109 | 109 | |
110 | - /** |
|
111 | - * Retrieve the path component of the URI. |
|
112 | - * |
|
113 | - * The path can either be empty or absolute (starting with a slash) or |
|
114 | - * rootless (not starting with a slash). Implementations MUST support all |
|
115 | - * three syntaxes. |
|
116 | - * |
|
117 | - * Normally, the empty path "" and absolute path "/" are considered equal as |
|
118 | - * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically |
|
119 | - * do this normalization because in contexts with a trimmed base path, e.g. |
|
120 | - * the front controller, this difference becomes significant. It's the task |
|
121 | - * of the user to handle both "" and "/". |
|
122 | - * |
|
123 | - * The value returned MUST be percent-encoded, but MUST NOT double-encode |
|
124 | - * any characters. To determine what characters to encode, please refer to |
|
125 | - * RFC 3986, Sections 2 and 3.3. |
|
126 | - * |
|
127 | - * As an example, if the value should include a slash ("/") not intended as |
|
128 | - * delimiter between path segments, that value MUST be passed in encoded |
|
129 | - * form (e.g., "%2F") to the instance. |
|
130 | - * |
|
131 | - * @see https://tools.ietf.org/html/rfc3986#section-2 |
|
132 | - * @see https://tools.ietf.org/html/rfc3986#section-3.3 |
|
133 | - * @return string The URI path. |
|
134 | - */ |
|
135 | - public function getPath(): string; |
|
110 | + /** |
|
111 | + * Retrieve the path component of the URI. |
|
112 | + * |
|
113 | + * The path can either be empty or absolute (starting with a slash) or |
|
114 | + * rootless (not starting with a slash). Implementations MUST support all |
|
115 | + * three syntaxes. |
|
116 | + * |
|
117 | + * Normally, the empty path "" and absolute path "/" are considered equal as |
|
118 | + * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically |
|
119 | + * do this normalization because in contexts with a trimmed base path, e.g. |
|
120 | + * the front controller, this difference becomes significant. It's the task |
|
121 | + * of the user to handle both "" and "/". |
|
122 | + * |
|
123 | + * The value returned MUST be percent-encoded, but MUST NOT double-encode |
|
124 | + * any characters. To determine what characters to encode, please refer to |
|
125 | + * RFC 3986, Sections 2 and 3.3. |
|
126 | + * |
|
127 | + * As an example, if the value should include a slash ("/") not intended as |
|
128 | + * delimiter between path segments, that value MUST be passed in encoded |
|
129 | + * form (e.g., "%2F") to the instance. |
|
130 | + * |
|
131 | + * @see https://tools.ietf.org/html/rfc3986#section-2 |
|
132 | + * @see https://tools.ietf.org/html/rfc3986#section-3.3 |
|
133 | + * @return string The URI path. |
|
134 | + */ |
|
135 | + public function getPath(): string; |
|
136 | 136 | |
137 | - /** |
|
138 | - * Retrieve the query string of the URI. |
|
139 | - * |
|
140 | - * If no query string is present, this method MUST return an empty string. |
|
141 | - * |
|
142 | - * The leading "?" character is not part of the query and MUST NOT be |
|
143 | - * added. |
|
144 | - * |
|
145 | - * The value returned MUST be percent-encoded, but MUST NOT double-encode |
|
146 | - * any characters. To determine what characters to encode, please refer to |
|
147 | - * RFC 3986, Sections 2 and 3.4. |
|
148 | - * |
|
149 | - * As an example, if a value in a key/value pair of the query string should |
|
150 | - * include an ampersand ("&") not intended as a delimiter between values, |
|
151 | - * that value MUST be passed in encoded form (e.g., "%26") to the instance. |
|
152 | - * |
|
153 | - * @see https://tools.ietf.org/html/rfc3986#section-2 |
|
154 | - * @see https://tools.ietf.org/html/rfc3986#section-3.4 |
|
155 | - * @return string The URI query string. |
|
156 | - */ |
|
157 | - public function getQuery(): string; |
|
137 | + /** |
|
138 | + * Retrieve the query string of the URI. |
|
139 | + * |
|
140 | + * If no query string is present, this method MUST return an empty string. |
|
141 | + * |
|
142 | + * The leading "?" character is not part of the query and MUST NOT be |
|
143 | + * added. |
|
144 | + * |
|
145 | + * The value returned MUST be percent-encoded, but MUST NOT double-encode |
|
146 | + * any characters. To determine what characters to encode, please refer to |
|
147 | + * RFC 3986, Sections 2 and 3.4. |
|
148 | + * |
|
149 | + * As an example, if a value in a key/value pair of the query string should |
|
150 | + * include an ampersand ("&") not intended as a delimiter between values, |
|
151 | + * that value MUST be passed in encoded form (e.g., "%26") to the instance. |
|
152 | + * |
|
153 | + * @see https://tools.ietf.org/html/rfc3986#section-2 |
|
154 | + * @see https://tools.ietf.org/html/rfc3986#section-3.4 |
|
155 | + * @return string The URI query string. |
|
156 | + */ |
|
157 | + public function getQuery(): string; |
|
158 | 158 | |
159 | - /** |
|
160 | - * Retrieve the fragment component of the URI. |
|
161 | - * |
|
162 | - * If no fragment is present, this method MUST return an empty string. |
|
163 | - * |
|
164 | - * The leading "#" character is not part of the fragment and MUST NOT be |
|
165 | - * added. |
|
166 | - * |
|
167 | - * The value returned MUST be percent-encoded, but MUST NOT double-encode |
|
168 | - * any characters. To determine what characters to encode, please refer to |
|
169 | - * RFC 3986, Sections 2 and 3.5. |
|
170 | - * |
|
171 | - * @see https://tools.ietf.org/html/rfc3986#section-2 |
|
172 | - * @see https://tools.ietf.org/html/rfc3986#section-3.5 |
|
173 | - * @return string The URI fragment. |
|
174 | - */ |
|
175 | - public function getFragment(): string; |
|
159 | + /** |
|
160 | + * Retrieve the fragment component of the URI. |
|
161 | + * |
|
162 | + * If no fragment is present, this method MUST return an empty string. |
|
163 | + * |
|
164 | + * The leading "#" character is not part of the fragment and MUST NOT be |
|
165 | + * added. |
|
166 | + * |
|
167 | + * The value returned MUST be percent-encoded, but MUST NOT double-encode |
|
168 | + * any characters. To determine what characters to encode, please refer to |
|
169 | + * RFC 3986, Sections 2 and 3.5. |
|
170 | + * |
|
171 | + * @see https://tools.ietf.org/html/rfc3986#section-2 |
|
172 | + * @see https://tools.ietf.org/html/rfc3986#section-3.5 |
|
173 | + * @return string The URI fragment. |
|
174 | + */ |
|
175 | + public function getFragment(): string; |
|
176 | 176 | |
177 | - /** |
|
178 | - * Return an instance with the specified scheme. |
|
179 | - * |
|
180 | - * This method MUST retain the state of the current instance, and return |
|
181 | - * an instance that contains the specified scheme. |
|
182 | - * |
|
183 | - * Implementations MUST support the schemes "http" and "https" case |
|
184 | - * insensitively, and MAY accommodate other schemes if required. |
|
185 | - * |
|
186 | - * An empty scheme is equivalent to removing the scheme. |
|
187 | - * |
|
188 | - * @param string $scheme The scheme to use with the new instance. |
|
189 | - * @return static A new instance with the specified scheme. |
|
190 | - * @throws \InvalidArgumentException for invalid or unsupported schemes. |
|
191 | - */ |
|
192 | - public function withScheme(string $scheme): UriInterface; |
|
177 | + /** |
|
178 | + * Return an instance with the specified scheme. |
|
179 | + * |
|
180 | + * This method MUST retain the state of the current instance, and return |
|
181 | + * an instance that contains the specified scheme. |
|
182 | + * |
|
183 | + * Implementations MUST support the schemes "http" and "https" case |
|
184 | + * insensitively, and MAY accommodate other schemes if required. |
|
185 | + * |
|
186 | + * An empty scheme is equivalent to removing the scheme. |
|
187 | + * |
|
188 | + * @param string $scheme The scheme to use with the new instance. |
|
189 | + * @return static A new instance with the specified scheme. |
|
190 | + * @throws \InvalidArgumentException for invalid or unsupported schemes. |
|
191 | + */ |
|
192 | + public function withScheme(string $scheme): UriInterface; |
|
193 | 193 | |
194 | - /** |
|
195 | - * Return an instance with the specified user information. |
|
196 | - * |
|
197 | - * This method MUST retain the state of the current instance, and return |
|
198 | - * an instance that contains the specified user information. |
|
199 | - * |
|
200 | - * Password is optional, but the user information MUST include the |
|
201 | - * user; an empty string for the user is equivalent to removing user |
|
202 | - * information. |
|
203 | - * |
|
204 | - * @param string $user The user name to use for authority. |
|
205 | - * @param null|string $password The password associated with $user. |
|
206 | - * @return static A new instance with the specified user information. |
|
207 | - */ |
|
208 | - public function withUserInfo(string $user, ?string $password = null): UriInterface; |
|
194 | + /** |
|
195 | + * Return an instance with the specified user information. |
|
196 | + * |
|
197 | + * This method MUST retain the state of the current instance, and return |
|
198 | + * an instance that contains the specified user information. |
|
199 | + * |
|
200 | + * Password is optional, but the user information MUST include the |
|
201 | + * user; an empty string for the user is equivalent to removing user |
|
202 | + * information. |
|
203 | + * |
|
204 | + * @param string $user The user name to use for authority. |
|
205 | + * @param null|string $password The password associated with $user. |
|
206 | + * @return static A new instance with the specified user information. |
|
207 | + */ |
|
208 | + public function withUserInfo(string $user, ?string $password = null): UriInterface; |
|
209 | 209 | |
210 | - /** |
|
211 | - * Return an instance with the specified host. |
|
212 | - * |
|
213 | - * This method MUST retain the state of the current instance, and return |
|
214 | - * an instance that contains the specified host. |
|
215 | - * |
|
216 | - * An empty host value is equivalent to removing the host. |
|
217 | - * |
|
218 | - * @param string $host The hostname to use with the new instance. |
|
219 | - * @return static A new instance with the specified host. |
|
220 | - * @throws \InvalidArgumentException for invalid hostnames. |
|
221 | - */ |
|
222 | - public function withHost(string $host): UriInterface; |
|
210 | + /** |
|
211 | + * Return an instance with the specified host. |
|
212 | + * |
|
213 | + * This method MUST retain the state of the current instance, and return |
|
214 | + * an instance that contains the specified host. |
|
215 | + * |
|
216 | + * An empty host value is equivalent to removing the host. |
|
217 | + * |
|
218 | + * @param string $host The hostname to use with the new instance. |
|
219 | + * @return static A new instance with the specified host. |
|
220 | + * @throws \InvalidArgumentException for invalid hostnames. |
|
221 | + */ |
|
222 | + public function withHost(string $host): UriInterface; |
|
223 | 223 | |
224 | - /** |
|
225 | - * Return an instance with the specified port. |
|
226 | - * |
|
227 | - * This method MUST retain the state of the current instance, and return |
|
228 | - * an instance that contains the specified port. |
|
229 | - * |
|
230 | - * Implementations MUST raise an exception for ports outside the |
|
231 | - * established TCP and UDP port ranges. |
|
232 | - * |
|
233 | - * A null value provided for the port is equivalent to removing the port |
|
234 | - * information. |
|
235 | - * |
|
236 | - * @param null|int $port The port to use with the new instance; a null value |
|
237 | - * removes the port information. |
|
238 | - * @return static A new instance with the specified port. |
|
239 | - * @throws \InvalidArgumentException for invalid ports. |
|
240 | - */ |
|
241 | - public function withPort(?int $port): UriInterface; |
|
224 | + /** |
|
225 | + * Return an instance with the specified port. |
|
226 | + * |
|
227 | + * This method MUST retain the state of the current instance, and return |
|
228 | + * an instance that contains the specified port. |
|
229 | + * |
|
230 | + * Implementations MUST raise an exception for ports outside the |
|
231 | + * established TCP and UDP port ranges. |
|
232 | + * |
|
233 | + * A null value provided for the port is equivalent to removing the port |
|
234 | + * information. |
|
235 | + * |
|
236 | + * @param null|int $port The port to use with the new instance; a null value |
|
237 | + * removes the port information. |
|
238 | + * @return static A new instance with the specified port. |
|
239 | + * @throws \InvalidArgumentException for invalid ports. |
|
240 | + */ |
|
241 | + public function withPort(?int $port): UriInterface; |
|
242 | 242 | |
243 | - /** |
|
244 | - * Return an instance with the specified path. |
|
245 | - * |
|
246 | - * This method MUST retain the state of the current instance, and return |
|
247 | - * an instance that contains the specified path. |
|
248 | - * |
|
249 | - * The path can either be empty or absolute (starting with a slash) or |
|
250 | - * rootless (not starting with a slash). Implementations MUST support all |
|
251 | - * three syntaxes. |
|
252 | - * |
|
253 | - * If the path is intended to be domain-relative rather than path relative then |
|
254 | - * it must begin with a slash ("/"). Paths not starting with a slash ("/") |
|
255 | - * are assumed to be relative to some base path known to the application or |
|
256 | - * consumer. |
|
257 | - * |
|
258 | - * Users can provide both encoded and decoded path characters. |
|
259 | - * Implementations ensure the correct encoding as outlined in getPath(). |
|
260 | - * |
|
261 | - * @param string $path The path to use with the new instance. |
|
262 | - * @return static A new instance with the specified path. |
|
263 | - * @throws \InvalidArgumentException for invalid paths. |
|
264 | - */ |
|
265 | - public function withPath(string $path): UriInterface; |
|
243 | + /** |
|
244 | + * Return an instance with the specified path. |
|
245 | + * |
|
246 | + * This method MUST retain the state of the current instance, and return |
|
247 | + * an instance that contains the specified path. |
|
248 | + * |
|
249 | + * The path can either be empty or absolute (starting with a slash) or |
|
250 | + * rootless (not starting with a slash). Implementations MUST support all |
|
251 | + * three syntaxes. |
|
252 | + * |
|
253 | + * If the path is intended to be domain-relative rather than path relative then |
|
254 | + * it must begin with a slash ("/"). Paths not starting with a slash ("/") |
|
255 | + * are assumed to be relative to some base path known to the application or |
|
256 | + * consumer. |
|
257 | + * |
|
258 | + * Users can provide both encoded and decoded path characters. |
|
259 | + * Implementations ensure the correct encoding as outlined in getPath(). |
|
260 | + * |
|
261 | + * @param string $path The path to use with the new instance. |
|
262 | + * @return static A new instance with the specified path. |
|
263 | + * @throws \InvalidArgumentException for invalid paths. |
|
264 | + */ |
|
265 | + public function withPath(string $path): UriInterface; |
|
266 | 266 | |
267 | - /** |
|
268 | - * Return an instance with the specified query string. |
|
269 | - * |
|
270 | - * This method MUST retain the state of the current instance, and return |
|
271 | - * an instance that contains the specified query string. |
|
272 | - * |
|
273 | - * Users can provide both encoded and decoded query characters. |
|
274 | - * Implementations ensure the correct encoding as outlined in getQuery(). |
|
275 | - * |
|
276 | - * An empty query string value is equivalent to removing the query string. |
|
277 | - * |
|
278 | - * @param string $query The query string to use with the new instance. |
|
279 | - * @return static A new instance with the specified query string. |
|
280 | - * @throws \InvalidArgumentException for invalid query strings. |
|
281 | - */ |
|
282 | - public function withQuery(string $query): UriInterface; |
|
267 | + /** |
|
268 | + * Return an instance with the specified query string. |
|
269 | + * |
|
270 | + * This method MUST retain the state of the current instance, and return |
|
271 | + * an instance that contains the specified query string. |
|
272 | + * |
|
273 | + * Users can provide both encoded and decoded query characters. |
|
274 | + * Implementations ensure the correct encoding as outlined in getQuery(). |
|
275 | + * |
|
276 | + * An empty query string value is equivalent to removing the query string. |
|
277 | + * |
|
278 | + * @param string $query The query string to use with the new instance. |
|
279 | + * @return static A new instance with the specified query string. |
|
280 | + * @throws \InvalidArgumentException for invalid query strings. |
|
281 | + */ |
|
282 | + public function withQuery(string $query): UriInterface; |
|
283 | 283 | |
284 | - /** |
|
285 | - * Return an instance with the specified URI fragment. |
|
286 | - * |
|
287 | - * This method MUST retain the state of the current instance, and return |
|
288 | - * an instance that contains the specified URI fragment. |
|
289 | - * |
|
290 | - * Users can provide both encoded and decoded fragment characters. |
|
291 | - * Implementations ensure the correct encoding as outlined in getFragment(). |
|
292 | - * |
|
293 | - * An empty fragment value is equivalent to removing the fragment. |
|
294 | - * |
|
295 | - * @param string $fragment The fragment to use with the new instance. |
|
296 | - * @return static A new instance with the specified fragment. |
|
297 | - */ |
|
298 | - public function withFragment(string $fragment): UriInterface; |
|
284 | + /** |
|
285 | + * Return an instance with the specified URI fragment. |
|
286 | + * |
|
287 | + * This method MUST retain the state of the current instance, and return |
|
288 | + * an instance that contains the specified URI fragment. |
|
289 | + * |
|
290 | + * Users can provide both encoded and decoded fragment characters. |
|
291 | + * Implementations ensure the correct encoding as outlined in getFragment(). |
|
292 | + * |
|
293 | + * An empty fragment value is equivalent to removing the fragment. |
|
294 | + * |
|
295 | + * @param string $fragment The fragment to use with the new instance. |
|
296 | + * @return static A new instance with the specified fragment. |
|
297 | + */ |
|
298 | + public function withFragment(string $fragment): UriInterface; |
|
299 | 299 | |
300 | - /** |
|
301 | - * Return the string representation as a URI reference. |
|
302 | - * |
|
303 | - * Depending on which components of the URI are present, the resulting |
|
304 | - * string is either a full URI or relative reference according to RFC 3986, |
|
305 | - * Section 4.1. The method concatenates the various components of the URI, |
|
306 | - * using the appropriate delimiters: |
|
307 | - * |
|
308 | - * - If a scheme is present, it MUST be suffixed by ":". |
|
309 | - * - If an authority is present, it MUST be prefixed by "//". |
|
310 | - * - The path can be concatenated without delimiters. But there are two |
|
311 | - * cases where the path has to be adjusted to make the URI reference |
|
312 | - * valid as PHP does not allow to throw an exception in __toString(): |
|
313 | - * - If the path is rootless and an authority is present, the path MUST |
|
314 | - * be prefixed by "/". |
|
315 | - * - If the path is starting with more than one "/" and no authority is |
|
316 | - * present, the starting slashes MUST be reduced to one. |
|
317 | - * - If a query is present, it MUST be prefixed by "?". |
|
318 | - * - If a fragment is present, it MUST be prefixed by "#". |
|
319 | - * |
|
320 | - * @see http://tools.ietf.org/html/rfc3986#section-4.1 |
|
321 | - * @return string |
|
322 | - */ |
|
323 | - public function __toString(): string; |
|
300 | + /** |
|
301 | + * Return the string representation as a URI reference. |
|
302 | + * |
|
303 | + * Depending on which components of the URI are present, the resulting |
|
304 | + * string is either a full URI or relative reference according to RFC 3986, |
|
305 | + * Section 4.1. The method concatenates the various components of the URI, |
|
306 | + * using the appropriate delimiters: |
|
307 | + * |
|
308 | + * - If a scheme is present, it MUST be suffixed by ":". |
|
309 | + * - If an authority is present, it MUST be prefixed by "//". |
|
310 | + * - The path can be concatenated without delimiters. But there are two |
|
311 | + * cases where the path has to be adjusted to make the URI reference |
|
312 | + * valid as PHP does not allow to throw an exception in __toString(): |
|
313 | + * - If the path is rootless and an authority is present, the path MUST |
|
314 | + * be prefixed by "/". |
|
315 | + * - If the path is starting with more than one "/" and no authority is |
|
316 | + * present, the starting slashes MUST be reduced to one. |
|
317 | + * - If a query is present, it MUST be prefixed by "?". |
|
318 | + * - If a fragment is present, it MUST be prefixed by "#". |
|
319 | + * |
|
320 | + * @see http://tools.ietf.org/html/rfc3986#section-4.1 |
|
321 | + * @return string |
|
322 | + */ |
|
323 | + public function __toString(): string; |
|
324 | 324 | } |
@@ -22,8 +22,7 @@ |
||
22 | 22 | * |
23 | 23 | * @link http://tools.ietf.org/html/rfc3986 (the URI specification) |
24 | 24 | */ |
25 | -interface UriInterface |
|
26 | -{ |
|
25 | +interface UriInterface { |
|
27 | 26 | /** |
28 | 27 | * Retrieve the scheme component of the URI. |
29 | 28 | * |
@@ -4,42 +4,42 @@ |
||
4 | 4 | |
5 | 5 | interface StreamFactoryInterface |
6 | 6 | { |
7 | - /** |
|
8 | - * Create a new stream from a string. |
|
9 | - * |
|
10 | - * The stream SHOULD be created with a temporary resource. |
|
11 | - * |
|
12 | - * @param string $content String content with which to populate the stream. |
|
13 | - * |
|
14 | - * @return StreamInterface |
|
15 | - */ |
|
16 | - public function createStream(string $content = ''): StreamInterface; |
|
7 | + /** |
|
8 | + * Create a new stream from a string. |
|
9 | + * |
|
10 | + * The stream SHOULD be created with a temporary resource. |
|
11 | + * |
|
12 | + * @param string $content String content with which to populate the stream. |
|
13 | + * |
|
14 | + * @return StreamInterface |
|
15 | + */ |
|
16 | + public function createStream(string $content = ''): StreamInterface; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Create a stream from an existing file. |
|
20 | - * |
|
21 | - * The file MUST be opened using the given mode, which may be any mode |
|
22 | - * supported by the `fopen` function. |
|
23 | - * |
|
24 | - * The `$filename` MAY be any string supported by `fopen()`. |
|
25 | - * |
|
26 | - * @param string $filename Filename or stream URI to use as basis of stream. |
|
27 | - * @param string $mode Mode with which to open the underlying filename/stream. |
|
28 | - * |
|
29 | - * @return StreamInterface |
|
30 | - * @throws \RuntimeException If the file cannot be opened. |
|
31 | - * @throws \InvalidArgumentException If the mode is invalid. |
|
32 | - */ |
|
33 | - public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface; |
|
18 | + /** |
|
19 | + * Create a stream from an existing file. |
|
20 | + * |
|
21 | + * The file MUST be opened using the given mode, which may be any mode |
|
22 | + * supported by the `fopen` function. |
|
23 | + * |
|
24 | + * The `$filename` MAY be any string supported by `fopen()`. |
|
25 | + * |
|
26 | + * @param string $filename Filename or stream URI to use as basis of stream. |
|
27 | + * @param string $mode Mode with which to open the underlying filename/stream. |
|
28 | + * |
|
29 | + * @return StreamInterface |
|
30 | + * @throws \RuntimeException If the file cannot be opened. |
|
31 | + * @throws \InvalidArgumentException If the mode is invalid. |
|
32 | + */ |
|
33 | + public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Create a new stream from an existing resource. |
|
37 | - * |
|
38 | - * The stream MUST be readable and may be writable. |
|
39 | - * |
|
40 | - * @param resource $resource PHP resource to use as basis of stream. |
|
41 | - * |
|
42 | - * @return StreamInterface |
|
43 | - */ |
|
44 | - public function createStreamFromResource($resource): StreamInterface; |
|
35 | + /** |
|
36 | + * Create a new stream from an existing resource. |
|
37 | + * |
|
38 | + * The stream MUST be readable and may be writable. |
|
39 | + * |
|
40 | + * @param resource $resource PHP resource to use as basis of stream. |
|
41 | + * |
|
42 | + * @return StreamInterface |
|
43 | + */ |
|
44 | + public function createStreamFromResource($resource): StreamInterface; |
|
45 | 45 | } |
@@ -2,8 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message; |
4 | 4 | |
5 | -interface StreamFactoryInterface |
|
6 | -{ |
|
5 | +interface StreamFactoryInterface { |
|
7 | 6 | /** |
8 | 7 | * Create a new stream from a string. |
9 | 8 | * |
@@ -4,31 +4,31 @@ |
||
4 | 4 | |
5 | 5 | interface UploadedFileFactoryInterface |
6 | 6 | { |
7 | - /** |
|
8 | - * Create a new uploaded file. |
|
9 | - * |
|
10 | - * If a size is not provided it will be determined by checking the size of |
|
11 | - * the file. |
|
12 | - * |
|
13 | - * @see http://php.net/manual/features.file-upload.post-method.php |
|
14 | - * @see http://php.net/manual/features.file-upload.errors.php |
|
15 | - * |
|
16 | - * @param StreamInterface $stream Underlying stream representing the |
|
17 | - * uploaded file content. |
|
18 | - * @param int $size in bytes |
|
19 | - * @param int $error PHP file upload error |
|
20 | - * @param string $clientFilename Filename as provided by the client, if any. |
|
21 | - * @param string $clientMediaType Media type as provided by the client, if any. |
|
22 | - * |
|
23 | - * @return UploadedFileInterface |
|
24 | - * |
|
25 | - * @throws \InvalidArgumentException If the file resource is not readable. |
|
26 | - */ |
|
27 | - public function createUploadedFile( |
|
28 | - StreamInterface $stream, |
|
29 | - int $size = null, |
|
30 | - int $error = \UPLOAD_ERR_OK, |
|
31 | - string $clientFilename = null, |
|
32 | - string $clientMediaType = null |
|
33 | - ): UploadedFileInterface; |
|
7 | + /** |
|
8 | + * Create a new uploaded file. |
|
9 | + * |
|
10 | + * If a size is not provided it will be determined by checking the size of |
|
11 | + * the file. |
|
12 | + * |
|
13 | + * @see http://php.net/manual/features.file-upload.post-method.php |
|
14 | + * @see http://php.net/manual/features.file-upload.errors.php |
|
15 | + * |
|
16 | + * @param StreamInterface $stream Underlying stream representing the |
|
17 | + * uploaded file content. |
|
18 | + * @param int $size in bytes |
|
19 | + * @param int $error PHP file upload error |
|
20 | + * @param string $clientFilename Filename as provided by the client, if any. |
|
21 | + * @param string $clientMediaType Media type as provided by the client, if any. |
|
22 | + * |
|
23 | + * @return UploadedFileInterface |
|
24 | + * |
|
25 | + * @throws \InvalidArgumentException If the file resource is not readable. |
|
26 | + */ |
|
27 | + public function createUploadedFile( |
|
28 | + StreamInterface $stream, |
|
29 | + int $size = null, |
|
30 | + int $error = \UPLOAD_ERR_OK, |
|
31 | + string $clientFilename = null, |
|
32 | + string $clientMediaType = null |
|
33 | + ): UploadedFileInterface; |
|
34 | 34 | } |
@@ -2,8 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace OCA\FullTextSearch_Elasticsearch\Vendor\Psr\Http\Message; |
4 | 4 | |
5 | -interface UploadedFileFactoryInterface |
|
6 | -{ |
|
5 | +interface UploadedFileFactoryInterface { |
|
7 | 6 | /** |
8 | 7 | * Create a new uploaded file. |
9 | 8 | * |