/** * @When /^I use refactoring "([^"]*)" with:$/ */ public function iUseRefactoringWith($refactoringName, TableNode $table) { vfsStream::create($this->structure, $this->root); $data = array('command' => $refactoringName); foreach ($table->getHash() as $line) { $data[$line['arg']] = $line['value']; } if (isset($data['file'])) { $data['file'] = vfsStream::url('project/' . $data['file']); } if (isset($data['dir'])) { $data['dir'] = vfsStream::url('project/' . $data['dir']); } $data['--verbose'] = true; $fh = fopen("php://memory", "rw"); $input = new ArrayInput($data); $output = new \Symfony\Component\Console\Output\StreamOutput($fh); $app = new CliApplication(); $app->setAutoExit(false); $app->run($input, $output); rewind($fh); $this->output = stream_get_contents($fh); }
<?php include __DIR__ . '/../vendor/autoload.php'; use QafooLabs\Refactoring\Adapters\Symfony\CliApplication; $application = new CliApplication(); $application->run(); /* Refactorings Extract Method php refactor.phar extract-method <file_path> <line-range> <new-method> */ function extractMethod() { $try = ''; } /* Rename Local Variable php refactor.phar rename-local-variable <file_path> <line> <old-name> <new-name> */ function renameLocalVariable() { } /* Convert Local to Instance Variable php refactor.phar convert-local-to-instance-variable <file_path> <line> <variable> */ function convertLocalToInstanceVariable() { } /* Rename Class and Namespaces