Skip to content

Commit d756cde

Browse files
committed
Remove writeRequest from output
1 parent b8567a6 commit d756cde

File tree

3 files changed

+2
-51
lines changed

3 files changed

+2
-51
lines changed

src/Output/OutputInterface.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
namespace PhpSchool\PhpWorkshop\Output;
44

5-
use PhpSchool\CliMenu\Terminal\TerminalInterface;
65
use Psr\Http\Message\RequestInterface;
7-
use Zend\Diactoros\Request;
86

97
/**
108
* Interface StdOutput
@@ -61,11 +59,4 @@ public function lineBreak();
6159
* @param string $title
6260
*/
6361
public function writeTitle($title);
64-
65-
/**
66-
* Write a PSR-7 request.
67-
*
68-
* @param RequestInterface $request
69-
*/
70-
public function writeRequest(RequestInterface $request);
7162
}

src/Output/StdOutput.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -106,44 +106,4 @@ public function lineBreak()
106106
{
107107
echo $this->color->__invoke(str_repeat('', $this->terminal->getWidth()))->yellow();
108108
}
109-
110-
/**
111-
* Write a PSR-7 request.
112-
*
113-
* @param RequestInterface $request
114-
*/
115-
public function writeRequest(RequestInterface $request)
116-
{
117-
echo sprintf("URL: %s\n", $request->getUri());
118-
echo sprintf("METHOD: %s\n", $request->getMethod());
119-
120-
if ($request->getHeaders()) {
121-
echo 'HEADERS:';
122-
}
123-
124-
$indent = false;
125-
foreach ($request->getHeaders() as $name => $values) {
126-
if ($indent) {
127-
echo str_repeat(' ', 9);
128-
}
129-
130-
echo sprintf(" %s: %s\n", $name, implode(', ', $values));
131-
$indent = true;
132-
}
133-
134-
if ($body = (string) $request->getBody()) {
135-
echo "\nBODY:";
136-
137-
switch ($request->getHeaderLine('Content-Type')) {
138-
case 'application/json':
139-
echo json_encode(json_decode($body, true), JSON_PRETTY_PRINT);
140-
break;
141-
default:
142-
echo $body;
143-
break;
144-
}
145-
146-
$this->emptyLine();
147-
}
148-
}
149109
}

test/Output/StdOutputTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testPrintError()
4848

4949
public function testWrite()
5050
{
51-
$message = "There are people who actually like programming. ";
51+
$message = 'There are people who actually like programming. ';
5252
$message .= "I don't understand why they like programming.";
5353

5454
$this->expectOutputString($message);
@@ -57,7 +57,7 @@ public function testWrite()
5757

5858
public function testWriteLine()
5959
{
60-
$message = "Talk is cheap. Show me the code.";
60+
$message = 'Talk is cheap. Show me the code.';
6161
$this->expectOutputString($message . "\n");
6262
$this->output->writeLine($message);
6363
}

0 commit comments

Comments
 (0)