[TASK] Install tool: System maintainer administration
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / ExtDirect / ExtDirectDebug.php
1 <?php
2 namespace TYPO3\CMS\Core\ExtDirect;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Ext Direct Debug
19 */
20 class ExtDirectDebug
21 {
22 /**
23 * Internal debug message array
24 *
25 * @var array
26 */
27 protected $debugMessages = [];
28
29 /**
30 * destructor
31 *
32 * Currently empty, but automatically registered and called during
33 * ExtDirect shutdown.
34 *
35 * @see http://forge.typo3.org/issues/25278
36 */
37 public function __destruct()
38 {
39 }
40
41 /**
42 * Adds a new message of any data type to the internal debug message array.
43 *
44 * @param mixed $message
45 */
46 public function debug($message)
47 {
48 $this->debugMessages[] = $message;
49 }
50
51 /**
52 * Returns the internal debug messages as a string.
53 *
54 * @return string
55 */
56 public function toString()
57 {
58 $messagesAsString = '';
59 if (!empty($this->debugMessages)) {
60 $messagesAsString = \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($this->debugMessages);
61 }
62 return $messagesAsString;
63 }
64 }