JOOMLA中国
  • Joomla中国首页
  • 社区
  • 教程
  • 应用市场
  • B计划
Joomla! Framework TM
  • Namespace
  • Class
  • Tree
  • Deprecated

Namespaces

  • Composer
    • Autoload
  • Joomla
    • Application
      • Cli
        • Output
          • Processor
      • Web
    • Data
    • DI
      • Exception
    • Event
    • Filter
    • Input
    • Ldap
    • Registry
      • Format
    • Session
      • Storage
    • String
    • Uri
    • Utilities
  • None
  • PasswordCompat
    • binary
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Yaml
        • Exception
    • Polyfill
      • Util

Classes

  • CliInput
  • CliOutput
  • ColorProcessor
  • ColorStyle
 1 <?php
 2 /**
 3  * Part of the Joomla Framework Application Package
 4  *
 5  * @copyright  Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
 6  * @license    GNU General Public License version 2 or later; see LICENSE
 7  */
 8 
 9 namespace Joomla\Application\Cli;
10 
11 use Joomla\Application\Cli\Output\Processor\ProcessorInterface;
12 
13 /**
14  * Class CliOutput
15  *
16  * @since  1.0
17  */
18 abstract class CliOutput
19 {
20     /**
21      * Color processing object
22      *
23      * @var    ProcessorInterface
24      * @since  1.0
25      */
26     protected $processor;
27 
28     /**
29      * Constructor
30      *
31      * @param   ProcessorInterface  $processor  The output processor.
32      *
33      * @since   1.1.2
34      */
35     public function __construct(ProcessorInterface $processor = null)
36     {
37         $this->setProcessor(($processor instanceof ProcessorInterface) ? $processor : new Output\Processor\ColorProcessor);
38     }
39 
40     /**
41      * Set a processor
42      *
43      * @param   ProcessorInterface  $processor  The output processor.
44      *
45      * @return  Stdout  Instance of $this to allow chaining.
46      *
47      * @since   1.0
48      */
49     public function setProcessor(ProcessorInterface $processor)
50     {
51         $this->processor = $processor;
52 
53         return $this;
54     }
55 
56     /**
57      * Get a processor
58      *
59      * @return  ProcessorInterface
60      *
61      * @since   1.0
62      * @throws  \RuntimeException
63      */
64     public function getProcessor()
65     {
66         if ($this->processor)
67         {
68             return $this->processor;
69         }
70 
71         throw new \RuntimeException('A ProcessorInterface object has not been set.');
72     }
73 
74     /**
75      * Write a string to an output handler.
76      *
77      * @param   string   $text  The text to display.
78      * @param   boolean  $nl    True (default) to append a new line at the end of the output string.
79      *
80      * @return  void
81      *
82      * @since   1.0
83      * @codeCoverageIgnore
84      */
85     abstract public function out($text = '', $nl = true);
86 }
87 
Joomla! Framework TM API documentation generated by ApiGen 2.8.0
Joomla!® and Joomla! Framework™ are trademarks of Open Source Matters, Inc. in the United States and other countries.