/** * The entry method. * * @return void */ public function main() { $run = 'hoa://Data/Variable/Run'; while (false !== ($c = $this->getOption($v))) { switch ($c) { case 'r': $run = $v; break; case 'h': case '?': return $this->usage(); case '__ambiguous': $this->resolveOptionAmbiguity($v); break; } } $this->parser->listInputs($workerId); if (null === $workerId) { return $this->usage(); } $run = resolve($run); $protocol = Protocol::getInstance(); $protocol['Data']['Variable']['Run']->setReach("\r" . $run . DS); $password = $this->readPassword('Password: '); $sw = new Worker\Backend\Shared($workerId, $password); $sw->stop(); return; }
protected function getResolved() { $router = $this->router->get(); $data = $this->router->get('data'); if (isset($router['resolvers'])) { foreach ($router['resolvers'] as $urlKey => $resolver) { $resolved = resolve($resolver)->resolve($router[$urlKey] ?? $this->router->getCleanUri()); if (is_string($urlKey)) { $data[$urlKey] = $resolved; } $data[] = $resolved; if (!is_int($urlKey)) { $this->router->resolve($urlKey, $resolved); /** * Remove resolved key. * Why? Can we delete it? */ if (isset($data[$urlKey])) { //unset($data[$urlKey]); } } } } return $data; }
/** * @throws Exception */ public function execute(callable $next) { /** * Skip database initialization if connections are not defined. */ if (!$this->config->get('database')) { return $next(); } $configs = $this->config->get('database'); foreach ($configs as $name => $config) { if (isset($config['lazy'])) { continue; } $repository = null; if ($config['driver'] == 'faker') { $repository = new RepositoryFaker(Factory::create()); } elseif ($config['driver'] == 'middleware') { $repository = resolve($config['middleware'])->execute(function () { }); } else { $repository = $this->initPdoDatabase($config, $name); } if ($repository) { $this->context->bindIfNot(Repository::class, $repository); $this->context->bind(Repository::class . '.' . $name, $repository); } } return $next(); }
private function resolve($value = null) { if (null !== $this->result) { return; } $this->settle(resolve($value)); }
function resolve($op, &$z) { $ops = explode(' ', $op); if (count($ops) === 1) { if (isset($z[$ops[0]]) && !is_numeric($ops[0])) { return $z[$ops[0]] = (int) resolve($z[$ops[0]], $z); } return $z[$ops[0]] = (int) $ops[0]; } if (count($ops) === 2) { return $z[$ops[1]] = ~(int) resolve($ops[1], $z); } $a = resolve($ops[0], $z); $b = resolve($ops[2], $z); switch ($ops[1]) { case 'AND': $r = $a & $b; break; case 'OR': $r = $a | $b; break; case 'LSHIFT': $r = $a << $b; break; case 'RSHIFT': $r = $a >> $b; break; default: throw new Exception('Unknown op: ' . $ops[1]); } return (int) $r; }
public function always(callable $onFulfilledOrRejected) { return $this->then(function ($value) use($onFulfilledOrRejected) { return resolve($onFulfilledOrRejected())->then(function () use($value) { return $value; }); }); }
/** @test */ public function shouldPreserveTheOrderOfArrayWhenResolvingAsyncPromises() { $mock = $this->createCallableMock(); $mock->expects($this->once())->method('__invoke')->with($this->identicalTo([1, 2, 3])); $deferred = new Deferred(); all([resolve(1), $deferred->promise(), resolve(3)])->then($mock); $deferred->resolve(2); }
public function always(callable $onFulfilledOrRejected) { return $this->then(null, function ($reason) use($onFulfilledOrRejected) { return resolve($onFulfilledOrRejected())->then(function () use($reason) { return new RejectedPromise($reason); }); }); }
public function test_update_configuration_replaces_user_and_group_in_config_file() { copy(__DIR__ . '/files/fpm.conf', __DIR__ . '/output/fpm.conf'); resolve(StubForUpdatingFpmConfigFiles::class)->updateConfiguration(); $contents = file_get_contents(__DIR__ . '/output/fpm.conf'); $this->assertTrue(strpos($contents, 'user = '******'listen.owner = ' . user()) !== false); }
public function test_update_domain_removes_old_resolver_and_reinstalls() { $cli = Mockery::mock(CommandLine::class); $cli->shouldReceive('quietly')->with('rm /etc/resolver/old'); $dnsMasq = Mockery::mock(DnsMasq::class . '[install]', [resolve(Brew::class), $cli, new Filesystem()]); $dnsMasq->shouldReceive('install')->with('new'); $dnsMasq->updateDomain('old', 'new'); }
public function always(callable $onFulfilledOrRejected) : ExtendedPromiseInterface { return $this->then(function ($value) use($onFulfilledOrRejected) { return resolve($onFulfilledOrRejected())->then(function () use($value) { return $value; }); }); }
public function case_splFileClassInfo() { $this->given($splFileInfo = 'Hoa\\Iterator\\SplFileInfo', $root = resolve('hoa://Test/Vfs/Root?type=directory'), resolve('hoa://Test/Vfs/Root/a?type=file'), resolve('hoa://Test/Vfs/Root/b?type=file'), resolve('hoa://Test/Vfs/Root/c?type=file'), resolve('hoa://Test/Vfs/Root/d?type=file'), resolve('hoa://Test/Vfs/Root/e?type=file'), resolve('hoa://Test/Vfs/Root/f?type=file'), $iterator = new LUT\FileSystem($root, LUT\FileSystem::CURRENT_AS_FILEINFO, $splFileInfo), $result = [])->when(function () use($iterator, $splFileInfo, &$result) { foreach ($iterator as $file) { $this->object($file)->isInstanceOf($splFileInfo); $result[] = $file->getFilename(); } })->then->array($result)->isEqualTo(['a', 'b', 'c', 'd', 'e', 'f']); }
public function test_drivers_directory_is_created_with_sample_driver_if_it_doesnt_exist() { $files = Mockery::mock(Filesystem::class . '[isDir,mkdirAsUser,putAsUser]'); $files->shouldReceive('isDir')->with(VALET_HOME_PATH . '/Drivers')->andReturn(false); $files->shouldReceive('mkdirAsUser')->with(VALET_HOME_PATH . '/Drivers'); $files->shouldReceive('putAsUser'); swap(Filesystem::class, $files); resolve(Configuration::class)->createDriversDirectory(); }
private function getSerializerInstance($something) { if (!$something) { return new JsonSerializer(); } $serializer = is_string($something) ? resolve($something) : $something; if ($serializer instanceof SerializerAbstract) { return $serializer; } }
public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null) { if (null === $this->promise) { try { $this->promise = resolve(call_user_func($this->factory)); } catch (\Exception $exception) { $this->promise = new RejectedPromise($exception); } } return $this->promise->then($onFulfilled, $onRejected, $onProgress); }
public function test_caddy_daemon_is_placed_in_correct_location() { $files = Mockery::mock(Filesystem::class . '[put]'); swap(Filesystem::class, $files); $caddy = resolve(Caddy::class); $files->shouldReceive('put')->andReturnUsing(function ($path, $contents) use($caddy) { $this->assertEquals($caddy->daemonPath, $path); $this->assertTrue(strpos($contents, VALET_HOME_PATH) !== false); }); $caddy->installCaddyDaemon(); }
private function promise() { if (null === $this->promise) { try { $this->promise = resolve(call_user_func($this->factory)); } catch (\Exception $exception) { $this->promise = new RejectedPromise($exception); } } return $this->promise; }
public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null) { try { if (null === $onRejected) { return new RejectedPromise($this->reason); } return resolve($onRejected($this->reason)); } catch (\Exception $exception) { return new RejectedPromise($exception); } }
public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null) { try { $value = $this->value; if (null !== $onFulfilled) { $value = $onFulfilled($value); } return resolve($value); } catch (\Exception $exception) { return new RejectedPromise($exception); } }
/** * @return \Icicle\Awaitable\Awaitable */ protected function getAwaitable() { if (null === $this->promise) { $promisor = $this->promisor; $this->promisor = null; try { $this->promise = resolve($promisor()); } catch (\Throwable $exception) { $this->promise = reject($exception); } } return $this->promise; }
public function test_install_installs_and_places_configuration_files_in_proper_locations() { $ubuntu = Mockery::mock(Linux::class); $ubuntu->shouldReceive('ensureInstalled')->once()->with('dnsmasq'); $ubuntu->shouldReceive('restartService')->once()->with('dnsmasq'); swap(Linux::class, $ubuntu); $dnsMasq = resolve(StubForCreatingCustomDnsMasqConfigFiles::class); $dnsMasq->exampleConfigPath = __DIR__ . '/files/dnsmasq.conf'; $dnsMasq->configPath = __DIR__ . '/output/dnsmasq.conf'; $dnsMasq->install('dev'); $this->assertSame('address=/.dev/127.0.0.1' . PHP_EOL, file_get_contents(__DIR__ . '/output/custom-dnsmasq.conf')); $this->assertSame('test-contents conf-file=' . __DIR__ . '/output/custom-dnsmasq.conf ', file_get_contents(__DIR__ . '/output/dnsmasq.conf')); }
/** * The entry method. * * @access public * @return int */ public function main() { $reset = false; $generate = false; $cache = 'hoa://Application/Cache/Route.php'; $route = 'hoa://Application/Config/Route.php'; while (false !== ($c = $this->getOption($v))) { switch ($c) { case 'g': $generate = true; case 'r': $reset = true; break; case 'h': case '?': return $this->usage(); break; } } if ($reset === true) { if (file_exists($cache)) { $result = unlink($cache); if ($result) { echo \Hoa\Console\Chrome\Text::colorize('[OK] Cache flush', 'foreground(green)') . "\n"; } else { echo \Hoa\Console\Chrome\Text::colorize('[!!] Cache flush', 'foreground(white) background(red)') . "\n"; } } else { echo \Hoa\Console\Chrome\Text::colorize('No cache found', 'foreground(green)') . "\n"; } } if ($generate === true) { $core = Core::getInstance(); $parameters = $core->getParameters(); $cwd = $parameters->getKeyword('cwd'); $parameters->setKeyword('cwd', $cwd . '/Public'); $framework = new Framework(); $router = $framework->getRouter(); $dir = dirname($cache); $router->saveCache($cache); echo 'Save your router result in' . \Hoa\Console\Chrome\Text::colorize(resolve($cache), 'foreground(green)') . "\n"; } if ($reset === false && $generate === false) { return $this->usage(); } }
/** @test */ public function shouldSupportDeepNestingInPromiseChains() { $d = new Deferred(); $d->resolve(false); $result = resolve(resolve($d->promise()->then(function ($val) { $d = new Deferred(); $d->resolve($val); $identity = function ($val) { return $val; }; return resolve($d->promise()->then($identity))->then(function ($val) { return !$val; }); }))); $mock = $this->createCallableMock(); $mock->expects($this->once())->method('__invoke')->with($this->identicalTo(true)); $result->then($mock); }
public function getRelationForSelect($record = null, $foreignRecord = null) { /** * So, $table is users table, $field is user_group_id for which we need to get relation. * We need to create entity user_groups (which is found on relation) * and select all records. */ $relation = $this->hasOneSelectRelation; if (!$relation) { return $relation; } $showTable = $relation->showTable; $entity = $showTable->createEntity(); resolve(Dynamic::class)->joinTranslationsIfTranslatable($entity); /** * Append relation if we want to print for example * - $record->order->num * - $record->order->num . '<br />' . $record->user->email */ $toEval = $relation->value; $explodedEvals = explode(' ', $toEval); foreach ($explodedEvals as $partialToExplode) { $explodedEval = explode('->', $partialToExplode); if (count($explodedEval) == 3) { $entity->{'with' . ucfirst($explodedEval[1])}(); } } /** * Now, we have $record->addition->title, editing related orders_users_additions on orders_users. * We have to select additions that are added to packets_additions for orders_user.packet_id */ $relation->applyFilterOnEntity($entity, $foreignRecord); $values = []; $entity->all()->each(function ($record) use($relation, &$values) { $values[$record->id] = $this->eval($relation->value, $record, $relation); }); return $values; }
/** * The entry method. * * @access public * @return int */ public function main() { $command = null; while (false !== ($c = $this->getOption($v))) { switch ($c) { case 'h': case '?': return $this->usage(); break; } } $cache = 'hoa://Application/Cache/Route.php'; $route = 'hoa://Application/Config/Route.php'; $core = Core::getInstance(); $parameters = $core->getParameters(); $cwd = $parameters->getKeyword('cwd'); $parameters->setKeyword('cwd', $cwd . '/Public'); $framework = new Framework(); $router = $framework->getRouter(); $router->construct(); echo '# Router rules in ' . resolve($route) . "\n\n"; echo Text::columnize($router->dump()) . "\n\n"; return; }
/** * The entry method. * * @return int */ public function main() { $directories = []; $clean = false; $lang = 'En'; while (false !== ($c = $this->getOption($v))) { switch ($c) { case 'd': foreach ($this->parser->parseSpecialValue($v) as $directory) { $directory = realpath($directory); if (false === is_dir($directory)) { throw new Console\Exception('Directory %s does not exist.', 0, $directory); } $directories[] = $directory; } break; case 'c': $clean = true; break; case 'l': $lang = ucfirst(strtolower($v)); break; case '__ambiguous': $this->resolveOptionAmbiguity($v); break; case 'h': case '?': default: return $this->usage(); } } $workspace = resolve('hoa://Library/Devtools/Resource/Documentation') . DS . 'HackBook.output'; if (true === $clean) { if (true === is_dir($workspace)) { $directory = new File\Directory($workspace); $directory->delete(); unset($directory); } return; } clearstatcache(true); $workspace .= DS . $lang; if (false === is_dir($workspace)) { File\Directory::create($workspace); } Console\Cursor::colorize('foreground(yellow)'); echo 'Selected language: ', $lang, '.', "\n\n"; Console\Cursor::colorize('normal'); require_once 'hoa://Library/Devtools/Resource/Documentation/Router.php'; // $router is defined. $finder = new File\Finder(); foreach ($directories as $location) { $_location = $location . DS . 'Documentation' . DS . $lang; if (false === is_dir($_location)) { throw new Console\Exception('Directory %s does not contain documentation.', 1, $location); } $finder->in($_location); } foreach (resolve('hoa://Library', true, true) as $location) { $libraryFinder = new File\Finder(); $libraryFinder->in($location)->directories()->maxDepth(1); foreach ($libraryFinder as $_location) { $_location = $_location->getPathName() . DS . 'Documentation' . DS . $lang; if (true === is_dir($_location)) { $finder->in($_location); } } } $vendors = []; foreach ($finder as $entry) { $path = dirname(dirname($entry->getPath())); $vendor = ucfirst(strtolower(basename(dirname($path)))); $library = ucfirst(strtolower(basename($path))); if (!isset($vendors[$vendor])) { $vendors[$vendor] = []; } $vendors[$vendor][$library] = ['library' => $library, 'vendor' => $vendor, 'fullname' => $vendor . '\\' . $library]; } foreach ($vendors as $vendor => &$libraries) { $libraries = array_values($libraries); } $layout = new File\Read('hoa://Library/Devtools/Resource/Documentation/Layout.xyl'); $xyl = new Xyl($layout, new File\Write($workspace . '/index.html'), new Xyl\Interpreter\Html(), $router); $xyl->setTheme(''); $data = $xyl->getData(); foreach ($vendors as $vendor => $libraries) { $data->vendors->vendor = ['name' => $vendor, 'library' => $libraries]; } $xyl->addOverlay('hoa://Library/Devtools/Resource/Documentation/Index.xyl'); $xyl->render(); echo 'Generate', "\t"; Console\Cursor::colorize('foreground(green)'); echo 'index.html'; Console\Cursor::colorize('normal'); echo '.', "\n"; $xyl = null; foreach ($vendors as $vendor => $libraries) { File\Directory::create($workspace . dirname($router->unroute('full', ['vendor' => $libraries[0]['vendor'], 'chapter' => $libraries[0]['library']]))); foreach ($libraries as $library) { $in = 'hoa://Library/' . $library['library'] . '/Documentation/' . $lang . '/Index.xyl'; $out = $workspace . $router->unroute('full', ['vendor' => $library['vendor'], 'chapter' => $library['library']]); if (true === file_exists($out) && filemtime($in) <= filemtime($out)) { echo 'Skip', "\t\t"; Console\Cursor::colorize('foreground(green)'); echo $library['fullname']; Console\Cursor::colorize('normal'); echo '.', "\n"; continue; } $out = new File\Write($out); $out->truncate(0); if (null === $xyl) { $xyl = new Xyl($layout, $out, new Xyl\Interpreter\Html(), $router); $xyl->setTheme(''); $xyl->addOverlay('hoa://Library/Devtools/Resource/Documentation/Chapter.xyl'); } else { $xyl->setOutputStream(new File\Write($out)); } $xyl->addOverlay($in); $xyl->getData()->name[0] = $library['fullname']; $xyl->getData()->library[0] = $library['library']; try { $xyl->render(); } catch (\Exception $e) { echo $e->getMessage(), "\n"; } $xyl->removeOverlay($in); echo 'Generate', "\t"; Console\Cursor::colorize('foreground(green)'); echo $library['fullname']; Console\Cursor::colorize('normal'); echo '.', "\n"; } } echo "\n", 'Open file://', $workspace, '/index.html', '.', "\n"; return; }
/** * The entry method. * * @return int */ public function main() { $library = null; $verbose = Console::isDirect(STDOUT); while (false !== ($c = $this->getOption($v))) { switch ($c) { case 'l': $library = $this->parser->parseSpecialValue($v); break; case 'V': $verbose = false; break; case 'h': case '?': return $this->usage(); case '__ambiguous': $this->resolveOptionAmbiguity($v); break; } } if (true === $verbose) { echo Console\Chrome\Text::colorize(' _ _' . "\n" . ' | | | | ___ __ _' . "\n" . ' | |_| |/ _ \\ / _` |' . "\n" . ' | _ | (_) | (_| |' . "\n" . ' |_| |_|\\___/ \\__,_|' . "\n", 'foreground(yellow)'), "\n\n", 'Welcome in the command-line interface of Hoa :-).', "\n\n", Console\Chrome\Text::colorize('List of available commands', 'foreground(green)'), "\n\n"; } if (null !== $library) { $library = array_map('mb_strtolower', $library); } $locations = resolve('hoa://Library', true, true); $iterator = new \AppendIterator(); foreach ($locations as $location) { $iterator->append(new \GlobIterator($location . DS . '*' . DS . 'Bin' . DS . '*.php')); } if (WITH_COMPOSER) { $iterator->append(new \GlobIterator(dirname(dirname(dirname(dirname(__DIR__)))) . DS . 'Bin' . DS . '*.php')); } $binaries = []; foreach ($iterator as $entry) { $pathname = $entry->getPathname(); $lib = mb_strtolower(basename(dirname(dirname($pathname)))); $bin = mb_strtolower(mb_substr($entry->getBasename(), 0, -4)); if (null !== $library && false === in_array($lib, $library)) { continue; } if ('core' === $lib && 'hoa' === $bin) { continue; } if (!isset($binaries[$lib])) { $binaries[$lib] = []; } $description = ''; if (true === $verbose) { $lines = file($pathname); // Berk… for ($i = count($lines) - 1; $i >= 0; --$i) { if ('__halt_compiler();' . "\n" === $lines[$i]) { $description = trim(implode('', array_slice($lines, $i + 1))); break; } } unset($lines); } $binaries[$lib][] = ['name' => $bin, 'description' => $description]; } if (true === $verbose) { $out = []; foreach ($binaries as $group => $commands) { $out[] = [mb_convert_case($group, MB_CASE_TITLE)]; foreach ($commands as $binary) { $out[] = [' ' . Console\Chrome\Text::colorize($binary['name'], 'foreground(blue)'), $binary['description']]; } } echo Console\Chrome\Text::columnize($out); } else { $out = null; foreach ($binaries as $group => $commands) { foreach ($commands as $binary) { $out .= $group . ':' . $binary['name'] . "\n"; } } echo $out; } return; }
function initTwig($file = null) { $dirs = $this->getDirs(); /** * We need to duplicate every dir for proper relative includes ... * * */ if ($file) { $tempDirs = $dirs; foreach ($dirs as $dir) { $partDir = realpath($dir) . path('ds'); $tempDir = $partDir . substr(str_replace('\\', path('ds'), $file), 0, strrpos($file, path('ds'))); if (is_dir($tempDir)) { $tempDirs[] = $tempDir; } } $dirs = array_unique($tempDirs); } $this->twig = new TwigEnv(new Twig_Loader_Chain([new Twig_Loader_Filesystem($dirs), new \Twig_Loader_String()]), ['debug' => dev()]); $this->twig->addExtension(new Twig_Extension_StringLoader()); /** * This should be added to Dev environment Provider. */ $this->twig->addExtension(new Twig_Extension_Debug()); /** * This should be added to Framework/Inter Provider. */ $this->twig->addFunction(new Twig_SimpleFunction('__', function ($key, $data = [], $lang = null) { return __($key, $data, $lang); }, ['is_safe' => ['html']])); /** * This should be added to Framework provider. */ $this->twig->addFunction(new Twig_SimpleFunction('config', function ($text, $default = null) { return config($text, $default); })); /** * This should be added to Framework provider. */ $this->twig->addFunction(new Twig_SimpleFunction('flash', function ($key, $delete = true) { return context()->getOrCreate(Flash::class)->get($key, $delete); })); /** * This should be added to Framework provider. */ $this->twig->addFunction(new Twig_SimpleFunction('url', function ($url, $params = [], $absolute = false) { return context()->get(Router::class)->make($url, $params, $absolute); })); $this->twig->addFunction(new Twig_SimpleFunction('dev', function () { return dev(); })); $this->twig->addFunction(new Twig_SimpleFunction('implicitDev', function () { return implicitDev(); })); $this->twig->addFunction(new Twig_SimpleFunction('prod', function () { return prod(); })); /** * This should be added to Framework provider. */ $this->twig->addFunction(new Twig_SimpleFunction('media', function ($file, $path = null, $relative = true, $base = null) { return media($file, $path, $relative, $base); })); /** * This should be added to Framework provider. */ $this->twig->addFunction(new Twig_SimpleFunction('relativePath', function ($key) { return relativePath($key); })); /** * This should be added to Framework provider. */ $this->twig->addFunction(new Twig_SimpleFunction('select', function ($options, $attributes = [], $valueKey = null) { $select = new Select(); $select->setAttributes($attributes ?? []); foreach ($options as $key => $option) { $select->addOption($valueKey ? $option->id : $key, $valueKey ? $option->{$valueKey} : $option); } return $select; })); /** * This should be added to Framework provider. */ $this->twig->addFilter(new Twig_SimpleFilter('price', function ($price) { if (is_null($price)) { $price = 0.0; } $localeManager = resolve(Locale::class); return number_format($price, 2, $localeManager->getDecimalPoint(), $localeManager->getThousandSeparator()) . ' €'; })); $this->twig->addFilter(new Twig_SimpleFilter('roundPrice', function ($price) { if (is_null($price)) { $price = 0.0; } $localeManager = resolve(Locale::class); return trim((string) number_format($price, 2, $localeManager->getDecimalPoint(), $localeManager->getThousandSeparator()), '0') . ' €'; })); $this->twig->addFilter(new Twig_SimpleFilter('datetime', function ($date) { return (new Carbon($date))->format(resolve(Locale::class)->getDatetimeFormat()); })); $this->twig->addFilter(new Twig_SimpleFilter('date', function ($date) { return (new Carbon($date))->format(resolve(Locale::class)->getDateFormat()); })); $this->twig->getExtension('core')->setDateFormat(resolve(Locale::class)->getDateFormat(), '%d days'); }
/** @test */ public function shouldResolveToInitialValueWhenInputPromiseDoesNotResolveToAnArray() { $mock = $this->createCallableMock(); $mock->expects($this->once())->method('__invoke')->with($this->identicalTo(1)); reduce(resolve(1), $this->plus(), 1)->then($mock); }
/** * The entry method. * * @return int */ public function main() { $dryRun = false; $diff = false; while (false !== ($c = $this->getOption($v))) { switch ($c) { case '__ambiguous': $this->resolveOptionAmbiguity($v); break; case 'd': $dryRun = true; break; case 'D': $diff = true; break; case 'h': case '?': default: return $this->usage(); } } $this->parser->listInputs($path); if (empty($path)) { return $this->usage(); } $phpCsFixer = Console\Processus::locate('php-cs-fixer'); $configurationFile = resolve('hoa://Library/Devtools/Resource/PHPCSFixer/ConfigurationFile.php'); if (empty($phpCsFixer)) { throw new Console\Exception('php-cs-fixer binary is not found.', 0); } $arguments = ['fix', '--config-file' => $configurationFile]; if (true === $dryRun) { $arguments[] = '--dry-run'; } if (true === $diff) { $arguments[] = '--diff'; } $arguments[] = $path; $processus = new Console\Processus($phpCsFixer, $arguments); $processus->on('input', function () { return false; }); $processus->on('output', function (Core\Event\Bucket $bucket) { echo $bucket->getData()['line'], "\n"; return; }); $processus->run(); return; }