当前位置: 首页>>代码示例>>PHP>>正文


PHP Factory::createAdditionalStyles方法代码示例

本文整理汇总了PHP中Composer\Factory::createAdditionalStyles方法的典型用法代码示例。如果您正苦于以下问题:PHP Factory::createAdditionalStyles方法的具体用法?PHP Factory::createAdditionalStyles怎么用?PHP Factory::createAdditionalStyles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\Factory的用法示例。


在下文中一共展示了Factory::createAdditionalStyles方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * {@inheritDoc}
  */
 public function run(InputInterface $input = null, OutputInterface $output = null)
 {
     if (null === $output) {
         $styles = Factory::createAdditionalStyles();
         $formatter = new OutputFormatter(null, $styles);
         $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
     }
     return parent::run($input, $output);
 }
开发者ID:hanovruslan,项目名称:composer,代码行数:12,代码来源:Application.php

示例2: doRun

 /**
  * Runs the current application.
  *
  * @param  \Symfony\Component\Console\Input\InputInterface    $input
  * @param  \Symfony\Component\Console\Output\OutputInterface  $output
  * @return int
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $styles = Factory::createAdditionalStyles();
     foreach ($styles as $name => $style) {
         $output->getFormatter()->setStyle($name, $style);
     }
     $this->consoleIo = new ConsoleIO($input, $output, $this->getHelperSet());
     return parent::doRun($input, $output);
 }
开发者ID:kevindierkx,项目名称:muse,代码行数:16,代码来源:ProxyApplication.php

示例3: run

 /**
  * {@inheritDoc}
  */
 public function run(InputInterface $input = null, OutputInterface $output = null)
 {
     // Add output formatter style used by embedded composer.
     if (null === $output) {
         $styles = \Composer\Factory::createAdditionalStyles();
         $formatter = new OutputFormatter(null, $styles);
         $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
     }
     return parent::run($input, $output);
 }
开发者ID:kohkimakimoto,项目名称:altax,代码行数:13,代码来源:Application.php

示例4: receivePost

 /**
  * Perform the package update
  *
  * @param Request $request the current request
  * @param string $url the repository's URL (deducted from the request)
  * @param string $urlRegex the regex used to split the user packages into domain and path
  * @return Response
  */
 protected function receivePost(Request $request, $url, $urlRegex)
 {
     // try to parse the URL first to avoid the DB lookup on malformed requests
     if (!preg_match($urlRegex, $url)) {
         return new Response(json_encode(array('status' => 'error', 'message' => 'Could not parse payload repository URL')), 406);
     }
     // find the user
     $user = $this->findUser($request);
     if (!$user) {
         return new Response(json_encode(array('status' => 'error', 'message' => 'Invalid credentials')), 403);
     }
     // try to find the user package
     $packages = $this->findPackagesByUrl($user, $url, $urlRegex);
     if (!$packages) {
         return new Response(json_encode(array('status' => 'error', 'message' => 'Could not find a package that matches this request (does user maintain the package?)')), 404);
     }
     // don't die if this takes a while
     set_time_limit(3600);
     // put both updating the database and scanning the repository in a transaction
     $em = $this->get('doctrine.orm.entity_manager');
     $updater = $this->get('packagist.package_updater');
     $config = Factory::createConfig();
     $io = new BufferIO('', OutputInterface::VERBOSITY_VERBOSE, new HtmlOutputFormatter(Factory::createAdditionalStyles()));
     $io->loadConfiguration($config);
     try {
         foreach ($packages as $package) {
             $em->transactional(function ($em) use($package, $updater, $io, $config) {
                 // prepare dependencies
                 $loader = new ValidatingArrayLoader(new ArrayLoader());
                 // prepare repository
                 $repository = new VcsRepository(array('url' => $package->getRepository()), $io, $config);
                 $repository->setLoader($loader);
                 // perform the actual update (fetch and re-scan the repository's source)
                 $updater->update($io, $config, $package, $repository);
                 // update the package entity
                 $package->setAutoUpdated(true);
                 $em->flush();
             });
         }
     } catch (\Exception $e) {
         if ($e instanceof InvalidRepositoryException) {
             $this->get('packagist.package_manager')->notifyUpdateFailure($package, $e, $io->getOutput());
         }
         return new Response(json_encode(array('status' => 'error', 'message' => '[' . get_class($e) . '] ' . $e->getMessage(), 'details' => '<pre>' . $io->getOutput() . '</pre>')), 400);
     }
     return new JsonResponse(array('status' => 'success'), 202);
 }
开发者ID:paulgreenstreet,项目名称:packagist,代码行数:55,代码来源:ApiController.php

示例5: updatePackageAction

 /**
  * @Template()
  * @Route("/packages/{name}", name="update_package", requirements={"name"="[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+"}, defaults={"_format" = "json"})
  * @Method({"PUT"})
  */
 public function updatePackageAction(Request $req, $name)
 {
     $doctrine = $this->getDoctrine();
     try {
         /** @var Package $package */
         $package = $doctrine->getRepository('PackagistWebBundle:Package')->getPackageByName($name);
     } catch (NoResultException $e) {
         return new Response(json_encode(array('status' => 'error', 'message' => 'Package not found')), 404);
     }
     $username = $req->request->has('username') ? $req->request->get('username') : $req->query->get('username');
     $apiToken = $req->request->has('apiToken') ? $req->request->get('apiToken') : $req->query->get('apiToken');
     $update = $req->request->get('update', $req->query->get('update'));
     $autoUpdated = $req->request->get('autoUpdated', $req->query->get('autoUpdated'));
     $updateEqualRefs = $req->request->get('updateAll', $req->query->get('updateAll'));
     $user = $this->getUser() ?: $doctrine->getRepository('PackagistWebBundle:User')->findOneBy(array('username' => $username, 'apiToken' => $apiToken));
     if (!$user) {
         return new Response(json_encode(array('status' => 'error', 'message' => 'Invalid credentials')), 403);
     }
     if ($package->getMaintainers()->contains($user) || $this->isGranted('ROLE_UPDATE_PACKAGES')) {
         $req->getSession()->save();
         if (null !== $autoUpdated) {
             $package->setAutoUpdated((bool) $autoUpdated);
             $doctrine->getManager()->flush();
         }
         if ($update) {
             set_time_limit(3600);
             $updater = $this->get('packagist.package_updater');
             $io = new BufferIO('', OutputInterface::VERBOSITY_VERY_VERBOSE, new HtmlOutputFormatter(Factory::createAdditionalStyles()));
             $config = Factory::createConfig();
             $io->loadConfiguration($config);
             $repository = new VcsRepository(array('url' => $package->getRepository()), $io, $config);
             $loader = new ValidatingArrayLoader(new ArrayLoader());
             $repository->setLoader($loader);
             try {
                 $updater->update($io, $config, $package, $repository, $updateEqualRefs ? Updater::UPDATE_EQUAL_REFS : 0);
             } catch (\Exception $e) {
                 return new Response(json_encode(array('status' => 'error', 'message' => '[' . get_class($e) . '] ' . $e->getMessage(), 'details' => '<pre>' . $io->getOutput() . '</pre>')), 400);
             }
         }
         return new Response('{"status": "success"}', 202);
     }
     return new JsonResponse(array('status' => 'error', 'message' => 'Could not find a package that matches this request (does user maintain the package?)'), 404);
 }
开发者ID:rawphp,项目名称:packagist,代码行数:48,代码来源:PackageController.php

示例6: getIO

 protected function getIO()
 {
     $styles = Factory::createAdditionalStyles();
     $formatter = new OutputFormatter(null, $styles);
     $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
     return new ConsoleIO(new ArgvInput(), $output, new HelperSet(array(new FormatterHelper(), new DialogHelper(), new ProgressHelper())));
 }
开发者ID:pgmillon,项目名称:bundle-generator,代码行数:7,代码来源:SymfonyGeneratorTest.php


注:本文中的Composer\Factory::createAdditionalStyles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。