Filippo Bertilotti
9 days ago c52de027ae84a21cdf03c392b29734793bedff6a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?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);
    }
 
 
}