Webmozart\Console\Handler\Help\HelpAsciiDocHandler::handle PHP Метод

handle() публичный Метод

public handle ( Args $args, IO $io )
$args Webmozart\Console\Api\Args\Args
$io Webmozart\Console\Api\IO\IO
    public function handle(Args $args, IO $io)
    {
        if ($this->processLauncher->isSupported()) {
            if (!$this->lessBinary) {
                $this->lessBinary = $this->executableFinder->find('less');
            }
            if ($this->lessBinary) {
                return $this->processLauncher->launchProcess(escapeshellcmd($this->lessBinary) . ' %path%', array('path' => $this->path), false);
            }
        }
        $io->write(file_get_contents($this->path));
        return 0;
    }

Usage Example

Пример #1
0
 public function testHandleWithCustomLessBinary()
 {
     $this->processLauncher->expects($this->once())->method('isSupported')->will($this->returnValue(true));
     $this->executableFinder->expects($this->never())->method('find');
     $this->processLauncher->expects($this->once())->method('launchProcess')->with('my-less %path%', array('path' => $this->path), false)->will($this->returnValue(123));
     $this->handler->setLessBinary('my-less');
     $status = $this->handler->handle($this->args, $this->io, $this->command);
     $this->assertSame(123, $status);
 }