/** * constructor * * @param \evidev\laravel4\extensions\workbench\PackageCreator $creator */ private function __construct($creator) { \Patchwork\replace('evidev\\laravel4\\extensions\\workbench\\console\\WorkbenchCommand::callComposerUpdate', function ($path) { return true; }); $this->command = new WorkbenchCommand($creator); }
function setRealpath() { $__handle = Patchwork\replace("Skully\\Application::getRealpath", function ($path) { if (substr($path, 0, 3) == 'vfs') { return $path; } else { $originalPath = realpath($path); $check = realpath(__DIR__ . '/../../../'); $check_r = explode(DIRECTORY_SEPARATOR, $check); if ($check_r[count($check_r) - 1] == 'vendor') { $basePath = realpath(__DIR__ . '/../../../../../'); } else { $basePath = realpath(__DIR__ . '/../../'); } $newPath = str_replace($basePath, vfsStream::url('root'), $originalPath); return $newPath; } }); }
/** * Replace a function with patchwork * * @param string $function_name * * @return bool */ private function replace_function($function_name) { if (in_array($function_name, $this->patchwork_functions)) { return true; } if (!function_exists('Patchwork\\replace')) { return true; } $this->patchwork_functions[] = $function_name; \Patchwork\replace($function_name, function () use($function_name) { return Handler::handle_function($function_name, func_get_args()); }); return true; }