<?php
|
|
|
use JetBrains\PhpStorm\Pure;
|
|
/**
|
* Class ParamsBase64
|
*/
|
class ParamsBase64
|
{
|
/**
|
* @var string
|
*/
|
private string $path;
|
/**
|
* @var string
|
*/
|
private string $stringValue;
|
/**
|
* @var bool
|
*/
|
private bool $encode;
|
/**
|
*
|
*/
|
private const PARAMS_BASE_64 = array(
|
"NEW_FILE" => [
|
"file_path" => "./scripts/decoded_files/new_decoded_file.txt",
|
"base64_string" => "Q2lhbyBhIHR1dHRpLCBpbyBzb25vIHVuYSBzdHJpbmdhIGEgY2Fzby4="
|
],
|
"NEW_RANDOM_BASE64"
|
);
|
|
/**
|
* ParamsBase64 constructor.
|
* @param string $path
|
* @param string $stringValue
|
* @param bool $encode
|
*/
|
public function __construct($path = __DIR__ . "\\decoded_files\\new_decoded_file.txt" , $stringValue = "Q2lhbyBhIHR1dHRpLCBpbyBzb25vIHVuYSBzdHJpbmdhIGEgY2Fzby4=",$encode = true)
|
{
|
$this->path = $path;
|
$this->stringValue = $stringValue;
|
$this->encode = $stringValue;
|
}
|
|
|
/**
|
* @param $name
|
* @return mixed
|
*/
|
public static function getConst($name)
|
{
|
return constant('self::' . strtoupper($name));
|
}
|
|
/**
|
* @return string
|
*/
|
public function getPath(): string
|
{
|
return $this->path;
|
}
|
|
/**
|
* @param string $path
|
*/
|
public function setPath(string $path): void
|
{
|
$this->path = $path;
|
}
|
|
/**
|
* @return string stringa base64 o file name in base in base a $this->isEncode()
|
*/
|
public function getStringValue(): string
|
{
|
return $this->stringValue;
|
}
|
|
/**
|
* @param string $stringValue
|
*/
|
public function setStringValue(string $stringValue): void
|
{
|
$this->stringValue = $stringValue;
|
}
|
|
/**
|
* @return bool
|
*/
|
public function isEncode(): bool|string
|
{
|
return $this->encode;
|
}
|
|
/**
|
* @param bool $encode
|
*/
|
public function setEncode(bool|string $encode): void
|
{
|
$this->encode = filter_var($encode,FILTER_VALIDATE_BOOL);
|
}
|
|
|
}
|