Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| UserCommand | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| run | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\FtpServer\Commands; |
| 3 | |
| 4 | use Apie\Core\Context\ApieContext; |
| 5 | use Apie\FtpServer\FtpConstants; |
| 6 | use React\Socket\ConnectionInterface; |
| 7 | |
| 8 | class UserCommand implements CommandInterface |
| 9 | { |
| 10 | public function run(ApieContext $apieContext, string $arg = ''): ApieContext |
| 11 | { |
| 12 | $conn = $apieContext->getContext(ConnectionInterface::class); |
| 13 | if ($arg) { |
| 14 | $conn->write("331 Username OK, need password\r\n"); |
| 15 | return $apieContext |
| 16 | ->withContext(FtpConstants::USERNAME, trim($arg)); |
| 17 | } else { |
| 18 | $conn->write("530 Login incorrect.\r\n"); |
| 19 | } |
| 20 | |
| 21 | return $apieContext; |
| 22 | } |
| 23 | } |