Moves multiple class methods to their own power classes. Moves many compiler config values to its own config class. Updated the Expantion method to use the new config class.
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Utilities;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
|
||||
|
||||
/**
|
||||
* The Indentation Factory
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
abstract class Indent
|
||||
{
|
||||
/**
|
||||
* Spacer bucket (to speed-up the build)
|
||||
*
|
||||
* @var array
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private static array $bucket = [];
|
||||
|
||||
/**
|
||||
* The indentation string
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private static string $indent;
|
||||
|
||||
/**
|
||||
* Set the space
|
||||
*
|
||||
* @param int $nr The number of spaces
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function _(int $nr): string
|
||||
{
|
||||
// check if we already have the string
|
||||
if (!isset(self::$bucket[$nr]))
|
||||
{
|
||||
// get the string
|
||||
self::$bucket[$nr] = str_repeat(self::indent(), (int) $nr);
|
||||
}
|
||||
// return stored indentation
|
||||
return self::$bucket[$nr];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the indentation string
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private static function indent(): string
|
||||
{
|
||||
if (empty(self::$indent))
|
||||
{
|
||||
self::init();
|
||||
}
|
||||
|
||||
return self::$indent;
|
||||
}
|
||||
|
||||
/**
|
||||
* The constructor for indent
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private static function init()
|
||||
{
|
||||
// the default is TAB
|
||||
self::$indent = Compiler::_('Config')->indentation_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Utilities;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
|
||||
|
||||
|
||||
/**
|
||||
* The Debug Line Number Factory
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
abstract class Line
|
||||
{
|
||||
/**
|
||||
* Should we add debug lines
|
||||
*
|
||||
* @since 3.2.0
|
||||
**/
|
||||
private static $add = 'check';
|
||||
|
||||
/**
|
||||
* Set the line number in comments
|
||||
*
|
||||
* @param int $nr The line number
|
||||
* @param string $class The class name
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function _(int $nr, string $class): string
|
||||
{
|
||||
if (self::add())
|
||||
{
|
||||
return ' [' . $class . ' ' . $nr . ']';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we should add the line number
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private static function add(): bool
|
||||
{
|
||||
if (!is_bool(self::$add))
|
||||
{
|
||||
self::init();
|
||||
}
|
||||
|
||||
return self::$add;
|
||||
}
|
||||
|
||||
/**
|
||||
* The constructor for add
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private static function init()
|
||||
{
|
||||
self::$add = Compiler::_('Config')->debug_line_nr;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Utilities;
|
||||
|
||||
|
||||
/**
|
||||
* The Placeholder Prefix and Suffix Factory
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
abstract class Placefix
|
||||
{
|
||||
/**
|
||||
* The hash prefix and suffix
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
**/
|
||||
private static $hhh = '#' . '#' . '#';
|
||||
|
||||
/**
|
||||
* The open prefix
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
**/
|
||||
private static $bbb = '[' . '[' . '[';
|
||||
|
||||
/**
|
||||
* The close suffix
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
**/
|
||||
private static $ddd = ']' . ']' . ']';
|
||||
|
||||
/**
|
||||
* Get a prefix and suffix added to given string
|
||||
*
|
||||
* @param string $class The class name
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function _(string $string): string
|
||||
{
|
||||
return self::b() . $string . self::d();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a open prefix
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function b(): string
|
||||
{
|
||||
return self::$bbb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a close suffix
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function d(): string
|
||||
{
|
||||
return self::$ddd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a hash prefix and suffix added to given string
|
||||
*
|
||||
* @param string $class The class name
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function _h(string $string): string
|
||||
{
|
||||
return self::h() . $string . self::h();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a hash-fix
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public static function h(): string
|
||||
{
|
||||
return self::$hhh;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
Reference in New Issue
Block a user