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


PHP IO::writeln方法代码示例

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


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

示例1: generate

 /**
  * @param ResourceInterface $resource
  * @param array             $data
  */
 public function generate(ResourceInterface $resource, array $data = array())
 {
     $filepath = $resource->getSrcFilename();
     $methodName = $data['name'];
     $arguments = $data['arguments'];
     $content = $this->getContent($resource, $methodName, $arguments);
     $code = $this->appendMethodToCode($this->filesystem->getFileContents($filepath), $content);
     $this->filesystem->putFileContents($filepath, $code);
     $this->io->writeln(sprintf("<info>Method <value>%s::%s()</value> has been created.</info>\n", $resource->getSrcClassname(), $methodName), 2);
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:14,代码来源:NamedConstructorGenerator.php

示例2: generate

 /**
  * @param ResourceInterface $resource
  * @param array $data
  */
 public function generate(ResourceInterface $resource, array $data)
 {
     $filepath = $resource->getSrcFilename();
     if (!($content = $this->templates->render('private-constructor', array()))) {
         $content = $this->templates->renderString($this->getTemplate(), array());
     }
     $code = $this->filesystem->getFileContents($filepath);
     $code = $this->codeWriter->insertMethodFirstInClass($code, $content);
     $this->filesystem->putFileContents($filepath, $code);
     $this->io->writeln("<info>Private constructor has been created.</info>\n", 2);
 }
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:15,代码来源:PrivateConstructorGenerator.php

示例3: generate

 /**
  * @param ResourceInterface $resource
  * @param array             $data
  */
 public function generate(ResourceInterface $resource, array $data = array())
 {
     $filepath = $resource->getSrcFilename();
     $methodName = $data['name'];
     $arguments = $data['arguments'];
     $content = $this->getContent($resource, $methodName, $arguments);
     $code = $this->filesystem->getFileContents($filepath);
     $code = preg_replace('/}[ \\n]*$/', rtrim($content) . "\n}\n", trim($code));
     $this->filesystem->putFileContents($filepath, $code);
     $this->io->writeln(sprintf("\n<info>Method <value>%s::%s()</value> has been created.</info>", $resource->getSrcClassname(), $methodName), 2);
 }
开发者ID:franzliedke,项目名称:phpspec,代码行数:15,代码来源:NamedConstructorGenerator.php

示例4: generate

 /**
  * @param ResourceInterface $resource
  * @param array $data
  */
 public function generate(ResourceInterface $resource, array $data)
 {
     $filepath = $resource->getSrcFilename();
     if (!($content = $this->templates->render('private-constructor', array()))) {
         $content = $this->templates->renderString($this->getTemplate(), array());
     }
     $code = $this->filesystem->getFileContents($filepath);
     $code = preg_replace('/}[ \\n]*$/', rtrim($content) . "\n}\n", trim($code));
     $this->filesystem->putFileContents($filepath, $code);
     $this->io->writeln("<info>Private constructor has been created.</info>\n", 2);
 }
开发者ID:araines,项目名称:phpspec,代码行数:15,代码来源:PrivateConstructorGenerator.php

示例5: printSpecificException

 /**
  * @param ExampleEvent $event
  * @param string $type
  */
 protected function printSpecificException(ExampleEvent $event, $type)
 {
     $title = str_replace('\\', DIRECTORY_SEPARATOR, $event->getSpecification()->getTitle());
     $message = $this->getPresenter()->presentException($event->getException(), $this->io->isVerbose());
     foreach (explode("\n", wordwrap($title, $this->io->getBlockWidth(), "\n", true)) as $line) {
         $this->io->writeln(sprintf('<%s-bg>%s</%s-bg>', $type, str_pad($line, $this->io->getBlockWidth()), $type));
     }
     $this->io->writeln(sprintf('<lineno>%4d</lineno>  <%s>- %s</%s>', $event->getExample()->getFunctionReflection()->getStartLine(), $type, $event->getExample()->getTitle(), $type));
     $this->io->writeln(sprintf('<%s>%s</%s>', $type, lcfirst($message), $type), 6);
     $this->io->writeln();
 }
开发者ID:ejay010,项目名称:Ploy,代码行数:15,代码来源:ConsoleFormatter.php

示例6: generate

 /**
  * @param ResourceInterface $resource
  * @param array $data
  */
 public function generate(ResourceInterface $resource, array $data = array())
 {
     $filepath = $resource->getSrcFilename();
     $name = $data['name'];
     $arguments = $data['arguments'];
     $argString = $this->buildArgumentString($arguments);
     $values = array('%name%' => $name, '%arguments%' => $argString);
     if (!($content = $this->templates->render('interface-method-signature', $values))) {
         $content = $this->templates->renderString($this->getTemplate(), $values);
     }
     $this->insertMethodSignature($filepath, $content);
     $this->io->writeln(sprintf("<info>Method signature <value>%s::%s()</value> has been created.</info>\n", $resource->getSrcClassname(), $name), 2);
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:17,代码来源:MethodSignatureGenerator.php

示例7: generate

 /**
  * @param ResourceInterface $resource
  * @param array $data
  */
 public function generate(ResourceInterface $resource, array $data)
 {
     $destination = $this->getSavePath($resource);
     if (file_exists($destination) && !$this->io->askConfirmation(sprintf('File "%s" already exists. Overwrite?', basename($destination)), false)) {
         return;
     }
     $directory = dirname($destination);
     if (!file_exists($directory)) {
         $this->createDir($directory);
     }
     $code = $this->generateCodeForResource($resource, $data);
     $this->filesystem->putFileContents($destination, $code);
     $this->io->writeln($this->getPromptMessage($resource, $resource->getSrcFilename()));
 }
开发者ID:ulabox,项目名称:bus-spec,代码行数:18,代码来源:AbstractGenerator.php

示例8: generate

 /**
  * @param ResourceInterface $resource
  * @param array             $data
  */
 public function generate(ResourceInterface $resource, array $data = array())
 {
     $filepath = $resource->getSrcFilename();
     $name = $data['name'];
     $arguments = $data['arguments'];
     $argString = count($arguments) ? '$argument' . implode(', $argument', range(1, count($arguments))) : '';
     $values = array('%name%' => $name, '%arguments%' => $argString);
     if (!($content = $this->templates->render('method', $values))) {
         $content = $this->templates->renderString($this->getTemplate(), $values);
     }
     $code = $this->filesystem->getFileContents($filepath);
     $this->filesystem->putFileContents($filepath, $this->getUpdatedCode($name, $content, $code));
     $this->io->writeln(sprintf("<info>Method <value>%s::%s()</value> has been created.</info>\n", $resource->getSrcClassname(), $name), 2);
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:18,代码来源:MethodGenerator.php

示例9: generate

 /**
  * @param ResourceInterface $resource
  * @param array $data
  *
  * @return mixed
  */
 public function generate(ResourceInterface $resource, array $data = array())
 {
     $filepath = $resource->getSrcFilename();
     $name = $data['name'];
     $arguments = $data['arguments'];
     $argString = $this->argumentBuilder->buildFrom($arguments);
     $values = array('%name%' => $name, '%arguments%' => $argString);
     if (!($content = $this->templates->render('method', $values))) {
         $content = $this->templates->renderString($this->getTemplate(), $values);
     }
     $code = $this->filesystem->getFileContents($filepath);
     $code = preg_replace('/}[ \\n]*$/', rtrim($content) . "\n}\n", trim($code));
     $this->filesystem->putFileContents($filepath, $code);
     $this->io->writeln(sprintf("\n<info>Method <value>%s::%s()</value> has been created.</info>", $resource->getSrcClassname(), $name), 2);
 }
开发者ID:amir20202000,项目名称:phpspec-typehintedmethods,代码行数:21,代码来源:TypeHintedMethodGenerator.php

示例10: generate

 /**
  * @param ResourceInterface $resource
  * @param array $data
  */
 public function generate(ResourceInterface $resource, array $data)
 {
     $method = $data['method'];
     $expected = $data['expected'];
     $code = $this->filesystem->getFileContents($resource->getSrcFilename());
     $values = array('%constant%' => var_export($expected, true));
     if (!($content = $this->templates->render('method', $values))) {
         $content = $this->templates->renderString($this->getTemplate(), $values);
     }
     $pattern = '/' . '(function\\s+' . preg_quote($method, '/') . '\\s*\\([^\\)]*\\))\\s+{[^}]*?}/';
     $replacement = '$1' . $content;
     $modifiedCode = preg_replace($pattern, $replacement, $code);
     $this->filesystem->putFileContents($resource->getSrcFilename(), $modifiedCode);
     $this->io->writeln(sprintf("\n<info>Method <value>%s::%s()</value> has been modified.</info>", $resource->getSrcClassname(), $method), 2);
 }
开发者ID:franzliedke,项目名称:phpspec,代码行数:19,代码来源:ReturnConstantGenerator.php

示例11: let

 function let(IO $io, ResourceManager $resourceManager, GeneratorManager $generatorManager, SuiteEvent $suiteEvent, ExampleEvent $exampleEvent, NameCheckerInterface $nameChecker)
 {
     $io->writeln(Argument::any())->willReturn();
     $io->askConfirmation(Argument::any())->willReturn();
     $this->beConstructedWith($io, $resourceManager, $generatorManager, $nameChecker);
     $io->isCodeGenerationEnabled()->willReturn(true);
 }
开发者ID:drickferreira,项目名称:rastreador,代码行数:7,代码来源:MethodNotFoundListenerSpec.php

示例12: displayFatal

 public function displayFatal(CurrentExampleTracker $currentExample, $error)
 {
     if (null !== $error && $currentExample->getCurrentExample() || is_null($currentExample->getCurrentExample()) && defined('HHVM_VERSION')) {
         ini_set('display_errors', "stderr");
         $failedOpen = $this->io->isDecorated() ? '<failed>' : '';
         $failedClosed = $this->io->isDecorated() ? '</failed>' : '';
         $failedCross = $this->io->isDecorated() ? '✘' : '';
         $this->io->writeln("{$failedOpen}{$failedCross} Fatal error happened while executing the following {$failedClosed}");
         $this->io->writeln("{$failedOpen}    {$currentExample->getCurrentExample()} {$failedClosed}");
         $this->io->writeln("{$failedOpen}    {$error['message']} in {$error['file']} on line {$error['line']} {$failedClosed}");
     }
 }
开发者ID:focuslife,项目名称:v0.1,代码行数:12,代码来源:ConsoleFormatter.php

示例13: outputSummary

 public function outputSummary()
 {
     $this->io->writeln();
 }
开发者ID:ciaranmcnulty,项目名称:phpspec-emoji-formatter,代码行数:4,代码来源:EmojiFormatter.php

示例14: generateFileAndRenderTemplate

 /**
  * @param ResourceInterface $resource
  * @param string            $filepath
  */
 private function generateFileAndRenderTemplate(ResourceInterface $resource, $filepath)
 {
     $content = $this->renderTemplate($resource, $filepath);
     $this->filesystem->putFileContents($filepath, $content);
     $this->io->writeln($this->getGeneratedMessage($resource, $filepath));
 }
开发者ID:mawaha,项目名称:tracker,代码行数:10,代码来源:PromptingGenerator.php

示例15:

 function it_outputs_a_break_at_the_end(IO $io)
 {
     $this->outputSummary();
     $io->writeln()->shouldHaveBeenCalled();
 }
开发者ID:ciaranmcnulty,项目名称:phpspec-emoji-formatter,代码行数:5,代码来源:EmojiFormatterSpec.php


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