1: <?php
2: /**
3: * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
4: * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
5: *
6: * Licensed under The MIT License
7: * For full copyright and license information, please see the LICENSE.txt
8: * Redistributions of files must retain the above copyright notice.
9: *
10: * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
11: * @link https://cakephp.org CakePHP(tm) Project
12: * @since 3.1.0
13: * @license https://opensource.org/licenses/mit-license.php MIT License
14: */
15: namespace Cake\Console;
16:
17: use Cake\Core\InstanceConfigTrait;
18:
19: /**
20: * Base class for Helpers.
21: *
22: * Console Helpers allow you to package up reusable blocks
23: * of Console output logic. For example creating tables,
24: * progress bars or ascii art.
25: */
26: abstract class Helper
27: {
28: use InstanceConfigTrait;
29:
30: /**
31: * Default config for this helper.
32: *
33: * @var array
34: */
35: protected $_defaultConfig = [];
36:
37: /**
38: * ConsoleIo instance.
39: *
40: * @var \Cake\Console\ConsoleIo
41: */
42: protected $_io;
43:
44: /**
45: * Constructor.
46: *
47: * @param \Cake\Console\ConsoleIo $io The ConsoleIo instance to use.
48: * @param array $config The settings for this helper.
49: */
50: public function __construct(ConsoleIo $io, array $config = [])
51: {
52: $this->_io = $io;
53: $this->setConfig($config);
54: }
55:
56: /**
57: * This method should output content using `$this->_io`.
58: *
59: * @param array $args The arguments for the helper.
60: * @return void
61: */
62: abstract public function output($args);
63: }
64: