writeln() public méthode

Writes a line of text
See also: TextWriter::writeln()
public writeln ( string $text = '', $pipe = TextWriter::STDOUT ) : Console
$text string
Résultat Console
 public static function test()
 {
     $out = new Console();
     $singleton1 = Singleton::getInstance('Singleton 1');
     $singleton2 = Singleton::getInstance('Singleton 2');
     $out->writeln($singleton1->getName());
     $out->writeln($singleton2->getName());
 }
 public static function test()
 {
     /**
      * @var \Patterns\AbstractFactoryPattern\AbstractComputerFactory $factory
      */
     $computerFactories = [new ExpensiveComputerFactory(), new CheapComputerFactory()];
     foreach ($computerFactories as $factory) {
         $out = new Console();
         $out->writeln($factory->getHdd()->saveData());
         $out->writeln($factory->getProcessor()->processData());
     }
 }
Exemple #3
0
 /**
  * Writes a line of text
  * 
  * @param string $text
  * @param int|array $formatOptions
  * @param int $pipe
  * @return Command
  */
 public function writeln($text, $formatOptions = array(), $pipe = TextWriter::STDOUT)
 {
     $this->console->writeln($this->format($text, $formatOptions), $pipe);
     return $this;
 }
Exemple #4
0
<?php

require_once 'vendor/autoload.php';
use ConsoleKit\Console;
use MyPatternsTest\TestAbstractFactory;
use MyPatternsTest\TestObserver;
use MyPatternsTest\TestSingleton;
$out = new Console();
$out->writeln('===============Abstract Factory==============');
TestAbstractFactory::test();
$out->writeln('==================Singleton==================');
TestSingleton::test();
$out->writeln('===================Observer==================');
TestObserver::test();