<commit_before><?php

namespace Nether;
use \Nether;

////////////////
////////////////

Option::Define([
	'surface-autocapture' => true,
	/*//option//
	@name surface-autocapture
	@type bool
	@default true
	//*/

	'surface-autostash' => true,
	/*//option//
	@name surface-autostash
	@type bool
	@default true
	//*/

	'surface-stash-name' => 'surface',
	/*//option//
	@name surface-stash-name
	@type string
	@default "avenue"
	//*/

	'surface-theme' => 'default',
	/*//option//
	@name surface-theme
	@type string
	@default "default"
	//*/

	'surface-theme-common' => 'common',
	/*//option//
	@name surface-theme-option
	@type string
	@default "common"
	//*/

	'surface-style' => 'default',
	/*//option//
	@name surface-style
	@type string
	@default "default"
	//*/

	'surface-theme-root' => sprintf(
		'%s/themes',
		Option::Get('nether-web-root')
	),
	/*//option//
	@name surface-theme-root
	@type string
	@default "%nether-web-root%/themes"
	the filesystem path to the themes directory.
	//*/

	'surface-theme-path' => sprintf(
		'%s/themes',
		trim(Option::Get('nether-web-path'),'/')
	),
	/*//option//
	@name surface-theme-path
	@type string
	@default "%nether-web-path%/themes"
	the web path to the themes directory.
	//*/

	'surface-title-brand' => true
	/*//option//
	@name surface-title-brand
	@type bool
	@default true
	define if surface should brand the page title with the app-name.
	//*/
]);

////////////////
////////////////

Ki::Queue('avenue-redirect',function(){
	// if a redirect was requested shut down the automatic surface instance and
	// throw away whatever it already collected.

	$surface = Stash::Get(Option::Get('surface-stash-name'));

	if($surface && $surface instanceof Surface)
	$surface->Stop(false);

	return;
},true);

////////////////
////////////////

class Surface {
/*//
this is the engine engine designed to make it easy to application output into
page templates with ease. there is no template language, the templates are
plain html with embedded php calls to the various surface methods.

to work as intended surface needs to know two things, which you should configure
as early as possible in the application real booting process via Nether\Option.

* nether-web-root - the filepath to the root of the public web directory.
* nether-web-path - the web url base directory from the base domain. e.g. "/"

armed with those values, surface will extrapolate where the themes are stored
by way of the suggested Nether application structure. if you wish to be specific
instead of allowing it to guess, you may specify the root and path for the
theme directory via surface-theme-root (filesystem path) and
surface-theme-path (web url path).
//*/

	protected $Rendered = false;
	/*//
	@type boolean
	a sentinel marking if this object has performed a render operation yet or
	not.
	//*/

	protected $Started = false;
	/*//
	@type boolean
	a sentinel marking if this object has begun capturing a level of stdout
	or not.
	//*/

	protected $Storage = [];
	/*//
	@type array
	where this surface instance stores the data to be used for rendering.
	//*/

	protected $Style;
	/*//
	@type string
	the name of the subtheme for the theme to use if it wants. the library
	itself does not actually use this, but it is there to make subthemes easier
	to make.
	//*/

	protected $Theme;
	/*//
	@type string
	the name of the theme to render in.
	//*/

	////////////////
	////////////////

	public function __construct() {

		$this->Storage['stdout'] = '';

		// pull in default settings.
		$this->Theme = Option::Get('surface-theme');
		$this->Style = Option::Get('surface-style');

		// stash if autostash is enabled.
		if(Option::Get('surface-autostash'))
		Stash::Set(Option::Get('surface-stash-name'),$this);

		// begin capture if autocapture is enabled.
		if(Option::Get('surface-autocapture'))<commit_msg>consideration for subsurfaces not tanking the app because stashed already exists.<commit_after><?php

namespace Nether;
use \Nether;

////////////////
////////////////

Option::Define([
	'surface-autocapture' => true,
	/*//option//
	@name surface-autocapture
	@type bool
	@default true
	//*/

	'surface-autostash' => true,
	/*//option//
	@name surface-autostash
	@type bool
	@default true
	//*/

	'surface-stash-name' => 'surface',
	/*//option//
	@name surface-stash-name
	@type string
	@default "avenue"
	//*/

	'surface-theme' => 'default',
	/*//option//
	@name surface-theme
	@type string
	@default "default"
	//*/

	'surface-theme-common' => 'common',
	/*//option//
	@name surface-theme-option
	@type string
	@default "common"
	//*/

	'surface-style' => 'default',
	/*//option//
	@name surface-style
	@type string
	@default "default"
	//*/

	'surface-theme-root' => sprintf(
		'%s/themes',
		Option::Get('nether-web-root')
	),
	/*//option//
	@name surface-theme-root
	@type string
	@default "%nether-web-root%/themes"
	the filesystem path to the themes directory.
	//*/

	'surface-theme-path' => sprintf(
		'%s/themes',
		trim(Option::Get('nether-web-path'),'/')
	),
	/*//option//
	@name surface-theme-path
	@type string
	@default "%nether-web-path%/themes"
	the web path to the themes directory.
	//*/

	'surface-title-brand' => true
	/*//option//
	@name surface-title-brand
	@type bool
	@default true
	define if surface should brand the page title with the app-name.
	//*/
]);

////////////////
////////////////

Ki::Queue('avenue-redirect',function(){
	// if a redirect was requested shut down the automatic surface instance and
	// throw away whatever it already collected.

	$surface = Stash::Get(Option::Get('surface-stash-name'));

	if($surface && $surface instanceof Surface)
	$surface->Stop(false);

	return;
},true);

////////////////
////////////////

class Surface {
/*//
this is the engine engine designed to make it easy to application output into
page templates with ease. there is no template language, the templates are
plain html with embedded php calls to the various surface methods.

to work as intended surface needs to know two things, which you should configure
as early as possible in the application real booting process via Nether\Option.

* nether-web-root - the filepath to the root of the public web directory.
* nether-web-path - the web url base directory from the base domain. e.g. "/"

armed with those values, surface will extrapolate where the themes are stored
by way of the suggested Nether application structure. if you wish to be specific
instead of allowing it to guess, you may specify the root and path for the
theme directory via surface-theme-root (filesystem path) and
surface-theme-path (web url path).
//*/

	protected $Rendered = false;
	/*//
	@type boolean
	a sentinel marking if this object has performed a render operation yet or
	not.
	//*/

	protected $Started = false;
	/*//
	@type boolean
	a sentinel marking if this object has begun capturing a level of stdout
	or not.
	//*/

	protected $Storage = [];
	/*//
	@type array
	where this surface instance stores the data to be used for rendering.
	//*/

	protected $Style;
	/*//
	@type string
	the name of the subtheme for the theme to use if it wants. the library
	itself does not actually use this, but it is there to make subthemes easier
	to make.
	//*/

	protected $Theme;
	/*//
	@type string
	the name of the theme to render in.
	//*/

	////////////////
	////////////////

	public function __construct() {

		$this->Storage['stdout'] = '';

		// pull in default settings.
		$this->Theme = Option::Get('surface-theme');
		$this->Style = Option::Get('surface-style');

		// stash if autostash is enabled.
		if(Option::Get('surface-autostash')) {
			if(!Stash::Has(Option::Get('surface-stash-name'))) {
				Stash::Set(Option::Get('surface-stash-name'),$this);
			}
		}

		// begin capture if autocapture is enabled.
		if(Option::Get('surface-autocapture'))
{'fraction_non_alphanumeric': 0.16626042334830018, 'fraction_numerical': 0.0, 'mean_word_length': 2.98364844149208, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2449601', 'n_tokens_mistral': 2505, 'n_tokens_neox': 2400, 'n_words': 832}