# blackbar/2.1.4/src/Console.php

Black Bar, version 2.1.4. 53 lines.

- Page: https://pluginprobe.com/plugins/blackbar/2.1.4/code/src/Console.php
- Raw: https://pluginprobe.com/plugins/blackbar/2.1.4/raw/src/Console.php
- Modified: 2018-07-18T22:06:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/blackbar/2.1.4/code/src/Console.php#L10-L20`.

```php
<?php

namespace GeminiLabs\Blackbar;

use DateTime;
use ReflectionClass;

class Console
{
	public $entries = array();

	/**
	 * @param string $message
	 * @return static
	 */
	public function store( $message, $location = '' )
	{
		$this->entries[] = array(
			'errno' => 0,
			'message' => $location.$this->normalizeValue( $message ),
			'name' => '<span class="glbb-info">Debug</span>',
		);
		return $this;
	}

	/**
	 * @param mixed $value
	 * @return bool
	 */
	protected function isObjectOrArray( $value )
	{
		return is_object( $value ) || is_array( $value );
	}

	/**
	 * @param mixed $value
	 * @return string
	 */
	protected function normalizeValue( $value )
	{
		if( $value instanceof DateTime ) {
			$value = $value->format( 'Y-m-d H:i:s' );
		}
		else if( $this->isObjectOrArray( $value )) {
			$value = print_r( json_decode( json_encode( $value )), true );
		}
		else if( is_resource( $value )) {
			$value = (string)$value;
		}
		return esc_html( $value );
	}
}

```
