Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Replace all occurrences of the search string with the replacement string
<?php str_replace( array|string $search, array|string $replace, string|array $subject, int &$count = null): string|array
<?php public function stripShortcodes(string $value): string
{
return strip_tags(str_replace(['[', ']'], ['<', '>'], $value));
}
<?php test('test alert w auto', function (): void {
$value = alert('Stay RAD!')->wAuto()->renderToString();
$alert = terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30mStay RAD!" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($alert);
});
test('test alert info', function (): void {
<?php test('test alert info', function (): void {
$value = alert('Stay RAD!')->info()->renderToString();
$alert = terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30mStay RAD!" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($alert);
});
test('test alert warning', function (): void {
<?php test('test alert warning', function (): void {
$value = alert('Stay RAD!')->warning()->renderToString();
$alert = terminal()->getCsi() . "30m" . terminal()->getCsi() . "43m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "43m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "43m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "43m" . terminal()->getCsi() . "30mStay RAD!" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "43m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "43m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($alert);
});
test('test alert danger', function (): void {
<?php test('test alert danger', function (): void {
$value = alert('Stay RAD!')->danger()->renderToString();
$alert = terminal()->getCsi() . "37m" . terminal()->getCsi() . "41m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "41m" . terminal()->getCsi() . "37m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "37m" . terminal()->getCsi() . "41m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "41m" . terminal()->getCsi() . "37mStay RAD!" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "37m" . terminal()->getCsi() . "41m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "41m" . terminal()->getCsi() . "37m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($alert);
});
test('test alert success', function (): void {
<?php test('test alert success', function (): void {
$value = alert('Stay RAD!')->success()->renderToString();
$alert = terminal()->getCsi() . "30m" . terminal()->getCsi() . "42m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "42m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "42m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "42m" . terminal()->getCsi() . "30mStay RAD!" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "42m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "42m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($alert);
});
test('test alert primary', function (): void {
<?php test('test alert primary', function (): void {
$value = alert('Stay RAD!')->primary()->renderToString();
$alert = terminal()->getCsi() . "37m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "37m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "37m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "37mStay RAD!" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "37m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "37m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($alert);
});
test('test alert secondary', function (): void {
<?php test('test alert secondary', function (): void {
$value = alert('Stay RAD!')->secondary()->renderToString();
$alert = terminal()->getCsi() . "30m" . terminal()->getCsi() . "100m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "100m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "100m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "100m" . terminal()->getCsi() . "30mStay RAD!" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "100m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "100m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($alert);
});
test('test alert with text align right', function (): void {
<?php test('test alert with text align right', function (): void {
$value = alert('Stay RAD!')->textAlignRight()->renderToString();
$alert = terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30mStay RAD!" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($alert);
});
test('test alert with text align left', function (): void {
<?php test('test alert with text align left', function (): void {
$value = alert('Stay RAD!')->textAlignLeft()->renderToString();
$alert = terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30mStay RAD!" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($alert);
});
test('test alert w', function (): void {
<?php test('test alert w', function (): void {
$value = alert('Stay RAD!')->w(200)->renderToString();
$alert = terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30mStay RAD!" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($alert);
});
test('test alert w magic', function (): void {
<?php test('test alert w magic', function (): void {
$value = alert('Stay RAD!')->w200()->renderToString();
$alert = terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30mStay RAD!" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "0m" . terminal()->getCsi() . "44m" . terminal()->getCsi() . "30m" . terminal()->getCsi() . "39m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "49m" . terminal()->getCsi() . "39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($alert);
});
class AlertTestTheme extends Theme implements ThemeInterface
<?php test('test horizontal', function (): void {
$value = chart()->data($this->data)->horizontal()->renderToString();
$chart = "\e[31mApple\e[39m\e[41m\e[49m\e[33mOrange\e[39m\e[43m\e[49m\e[32mLime\e[39m\e[42m\e[49m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($chart);
});
test('test inline', function (): void {
<?php test('test inline', function (): void {
$value = chart()->data($this->data)->inline()->renderToString();
$chart = "\e[41m\e[49m\e[43m\e[49m\e[42m\e[49m\e[31mApple\e[39m\e[33mOrange\e[39m\e[32mLime\e[39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($chart);
});
test('test showPercents', function (): void {
<?php test('test showPercents', function (): void {
$value = chart()->data($this->data)->showPercents()->renderToString();
$chart = "\e[31mApple\e[39m\e[41m\e[49m\e[31m17%\e[39m\e[33mOrange\e[39m\e[43m\e[49m\e[33m46%\e[39m\e[32mLime\e[39m\e[42m\e[49m\e[32m37%\e[39m";
expect(str_replace([PHP_EOL, Element::getSpace()], "", strings($value)->trim()->toString()))->toEqual($chart);
});
test('test showValues', function (): void {