| Server : LiteSpeed System : Linux in-mum-web984.main-hosting.eu 4.18.0-553.34.1.lve.el8.x86_64 #1 SMP Thu Jan 9 16:30:32 UTC 2025 x86_64 User : u689097916 ( 689097916) PHP Version : 8.0.30 Disable Function : NONE Directory : /home/u689097916/public_html/php/libraries/classes/Plugins/ |
Upload File : |
<?php
/**
* Abstract class for the transformations plugins
*/
declare(strict_types=1);
namespace PhpMyAdmin\Plugins;
use PhpMyAdmin\FieldMetadata;
/**
* Provides a common interface that will have to
* be implemented by all of the transformations plugins.
*/
abstract class TransformationsPlugin implements TransformationsInterface
{
/**
* Does the actual work of each specific transformations plugin.
*
* @param array $options transformation options
*/
public function applyTransformationNoWrap(array $options = []): bool
{
return false;
}
/**
* Does the actual work of each specific transformations plugin.
*
* @param string $buffer text to be transformed
* @param array $options transformation options
* @param FieldMetadata|null $meta meta information
*
* @return string the transformed text
*/
abstract public function applyTransformation(
$buffer,
array $options = [],
?FieldMetadata $meta = null
);
/**
* Returns passed options or default values if they were not set
*
* @param string[] $options List of passed options
* @param string[] $defaults List of default values
*
* @return array List of options possibly filled in by defaults.
*/
public function getOptions(array $options, array $defaults)
{
$result = [];
foreach ($defaults as $key => $value) {
if (isset($options[$key]) && $options[$key] !== '') {
$result[$key] = $options[$key];
} else {
$result[$key] = $value;
}
}
return $result;
}
}