diff --git a/4dev/tests/CoreLibsConvertVarSetTypeNullTest.php b/4dev/tests/CoreLibsConvertVarSetTypeNullTest.php
new file mode 100644
index 00000000..027d661b
--- /dev/null
+++ b/4dev/tests/CoreLibsConvertVarSetTypeNullTest.php
@@ -0,0 +1,652 @@
+ [
+ '',
+ null,
+ ''
+ ],
+ 'filled string' => [
+ 'string',
+ null,
+ 'string'
+ ],
+ 'valid string, override set' => [
+ 'string',
+ 'override',
+ 'string'
+ ],
+ 'int, no override' => [
+ 1,
+ null,
+ null
+ ],
+ 'int, override set' => [
+ 1,
+ 'not int',
+ 'not int'
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setStr
+ * @dataProvider varSetTypeStringProvider
+ * @testdox setStr $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param string|null $default
+ * @param string|null $expected
+ * @return void
+ */
+ public function testSetString(mixed $input, ?string $default, ?string $expected): void
+ {
+ $set_var = VarSetTypeNull::setStr($input, $default);
+ if ($expected !== null) {
+ $this->assertIsString($set_var);
+ } else {
+ $this->assertNull($set_var);
+ }
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varMakeTypeStringProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'empty string' => [
+ '',
+ null,
+ ''
+ ],
+ 'filled string' => [
+ 'string',
+ null,
+ 'string'
+ ],
+ 'valid string, override set' => [
+ 'string',
+ 'override',
+ 'string'
+ ],
+ 'int, no override' => [
+ 1,
+ null,
+ '1'
+ ],
+ 'int, override set' => [
+ 1,
+ 'not int',
+ '1'
+ ],
+ 'float, no override' => [
+ 1.5,
+ null,
+ '1.5'
+ ],
+ // all the strange things here
+ 'function, override set' => [
+ $foo = function () {
+ return '';
+ },
+ 'function',
+ 'function'
+ ],
+ 'function, no override' => [
+ $foo = function () {
+ return '';
+ },
+ null,
+ null
+ ],
+ 'hex value, override set' => [
+ 0x55,
+ 'hex',
+ '85'
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::makeStr
+ * @dataProvider varMakeTypeStringProvider
+ * @testdox makeStr $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param string|null $default
+ * @param string|null $expected
+ * @return void
+ */
+ public function testMakeString(mixed $input, ?string $default, ?string $expected): void
+ {
+ $set_var = VarSetTypeNull::makeStr($input, $default);
+ if ($expected !== null) {
+ $this->assertIsString($set_var);
+ } else {
+ $this->assertNull($set_var);
+ }
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varSetTypeIntProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'int' => [
+ 1,
+ null,
+ 1
+ ],
+ 'int, override set' => [
+ 1,
+ -1,
+ 1
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ null
+ ],
+ 'string, override' => [
+ 'string',
+ -1,
+ -1
+ ],
+ 'float' => [
+ 1.5,
+ null,
+ null
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setInt
+ * @dataProvider varSetTypeIntProvider
+ * @testdox setInt $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param int|null $default
+ * @param int|null $expected
+ * @return void
+ */
+ public function testSetInt(mixed $input, ?int $default, ?int $expected): void
+ {
+ $set_var = VarSetTypeNull::setInt($input, $default);
+ if ($expected !== null) {
+ $this->assertIsInt($set_var);
+ } else {
+ $this->assertNull($set_var);
+ }
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varMakeTypeIntProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'int' => [
+ 1,
+ null,
+ 1
+ ],
+ 'int, override set' => [
+ 1,
+ -1,
+ 1
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ 0
+ ],
+ 'string, override' => [
+ 'string',
+ -1,
+ 0
+ ],
+ 'float' => [
+ 1.5,
+ null,
+ 1
+ ],
+ // all the strange things here
+ 'function, override set' => [
+ $foo = function () {
+ return '';
+ },
+ -1,
+ -1
+ ],
+ 'function, no override ' => [
+ $foo = function () {
+ return '';
+ },
+ null,
+ null
+ ],
+ 'hex value, override set' => [
+ 0x55,
+ -1,
+ 85
+ ],
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::makeInt
+ * @dataProvider varMakeTypeIntProvider
+ * @testdox makeInt $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param int|null $default
+ * @param int|null $expected
+ * @return void
+ */
+ public function testMakeInt(mixed $input, ?int $default, ?int $expected): void
+ {
+ $set_var = VarSetTypeNull::makeInt($input, $default);
+ if ($expected !== null) {
+ $this->assertIsInt($set_var);
+ } else {
+ $this->assertNull($set_var);
+ }
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varSetTypeFloatProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'float' => [
+ 1.5,
+ null,
+ 1.5
+ ],
+ 'float, override set' => [
+ 1.5,
+ -1.5,
+ 1.5
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ null
+ ],
+ 'string, override' => [
+ 'string',
+ 1.5,
+ 1.5
+ ],
+ 'int' => [
+ 1,
+ null,
+ null
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setFloat
+ * @dataProvider varSetTypeFloatProvider
+ * @testdox setFloat $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param float|null $default
+ * @param float|null $expected
+ * @return void
+ */
+ public function testSetFloat(mixed $input, ?float $default, ?float $expected): void
+ {
+ $set_var = VarSetTypeNull::setFloat($input, $default);
+ if ($expected !== null) {
+ $this->assertIsFloat($set_var);
+ } else {
+ $this->assertNull($set_var);
+ }
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varMakeTypeFloatProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'float' => [
+ 1.5,
+ null,
+ 1.5
+ ],
+ 'float, override set' => [
+ 1.5,
+ -1.5,
+ 1.5
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ 0.0
+ ],
+ 'string, override' => [
+ 'string',
+ 1.5,
+ 0.0
+ ],
+ 'int' => [
+ 1,
+ null,
+ 1.0
+ ],
+ // all the strange things here
+ 'function, override set' => [
+ $foo = function () {
+ return '';
+ },
+ -1.0,
+ -1.0
+ ],
+ // all the strange things here
+ 'function, no override' => [
+ $foo = function () {
+ return '';
+ },
+ null,
+ null
+ ],
+ 'hex value, override set' => [
+ 0x55,
+ -1,
+ 85.0
+ ],
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::makeFloat
+ * @dataProvider varMakeTypeFloatProvider
+ * @testdox makeFloat $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param float|null $default
+ * @param float|null $expected
+ * @return void
+ */
+ public function testMakeFloat(mixed $input, ?float $default, ?float $expected): void
+ {
+ $set_var = VarSetTypeNull::makeFloat($input, $default);
+ if ($expected !== null) {
+ $this->assertIsFloat($set_var);
+ } else {
+ $this->assertNull($set_var);
+ }
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varSetTypeArrayProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'array, empty' => [
+ [],
+ null,
+ []
+ ],
+ 'array, filled' => [
+ ['array'],
+ null,
+ ['array']
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ null
+ ],
+ 'string, override' => [
+ 'string',
+ ['string'],
+ ['string']
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setArray
+ * @dataProvider varSetTypeArrayProvider
+ * @testdox setArray $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param array|null $default
+ * @param array|null $expected
+ * @return void
+ */
+ public function testSetArray(mixed $input, ?array $default, ?array $expected): void
+ {
+ $set_var = VarSetTypeNull::setArray($input, $default);
+ if ($expected !== null) {
+ $this->assertIsArray($set_var);
+ } else {
+ $this->assertNull($set_var);
+ }
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varSetTypeBoolProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'bool true' => [
+ true,
+ null,
+ true
+ ],
+ 'bool false' => [
+ false,
+ null,
+ false
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ null
+ ],
+ 'string, override' => [
+ 'string',
+ true,
+ true
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setBool
+ * @dataProvider varSetTypeBoolProvider
+ * @testdox setBool $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param bool|null $default
+ * @param bool|null $expected
+ * @return void
+ */
+ public function testSetBool(mixed $input, ?bool $default, ?bool $expected): void
+ {
+ $set_var = VarSetTypeNull::setBool($input, $default);
+ if ($expected !== null) {
+ $this->assertIsBool($set_var);
+ } else {
+ $this->assertNull($set_var);
+ }
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varMakeTypeBoolProvider(): array
+ {
+ // 0: input
+ // 2: expected
+ return [
+ 'true' => [
+ true,
+ true
+ ],
+ 'false' => [
+ false,
+ false
+ ],
+ 'string on' => [
+ 'on',
+ true
+ ],
+ 'string off' => [
+ 'off',
+ false
+ ],
+ 'invalid string' => [
+ 'sulzenbacher',
+ null,
+ ],
+ 'invalid string, override' => [
+ 'sulzenbacher',
+ null,
+ ],
+ 'array to default' => [
+ [],
+ false
+ ],
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setBool
+ * @dataProvider varMakeTypeBoolProvider
+ * @testdox setBool $input will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param bool|null $default
+ * @param bool|null $expected
+ * @return void
+ */
+ public function testMakeBool(mixed $input, ?bool $expected): void
+ {
+ $set_var = VarSetTypeNull::makeBool($input);
+ if ($expected !== null) {
+ $this->assertIsBool($set_var);
+ } else {
+ $this->assertNull($set_var);
+ }
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+}
+
+// __END__
diff --git a/4dev/tests/CoreLibsConvertVarSetTypeTest.php b/4dev/tests/CoreLibsConvertVarSetTypeTest.php
new file mode 100644
index 00000000..1885a0a6
--- /dev/null
+++ b/4dev/tests/CoreLibsConvertVarSetTypeTest.php
@@ -0,0 +1,632 @@
+ [
+ '',
+ null,
+ ''
+ ],
+ 'filled string' => [
+ 'string',
+ null,
+ 'string'
+ ],
+ 'valid string, override set' => [
+ 'string',
+ 'override',
+ 'string'
+ ],
+ 'int, no override' => [
+ 1,
+ null,
+ ''
+ ],
+ 'int, override set' => [
+ 1,
+ 'not int',
+ 'not int'
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setStr
+ * @dataProvider varSetTypeStringProvider
+ * @testdox setStr $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param string|null $default
+ * @param string $expected
+ * @return void
+ */
+ public function testSetString(mixed $input, ?string $default, string $expected): void
+ {
+ if ($default === null) {
+ $set_var = VarSetType::setStr($input);
+ } else {
+ $set_var = VarSetType::setStr($input, $default);
+ }
+ $this->assertIsString($set_var);
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varMakeTypeStringProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'empty string' => [
+ '',
+ null,
+ ''
+ ],
+ 'filled string' => [
+ 'string',
+ null,
+ 'string'
+ ],
+ 'valid string, override set' => [
+ 'string',
+ 'override',
+ 'string'
+ ],
+ 'int, no override' => [
+ 1,
+ null,
+ '1'
+ ],
+ 'int, override set' => [
+ 1,
+ 'not int',
+ '1'
+ ],
+ // all the strange things here
+ 'function, override set' => [
+ $foo = function () {
+ return '';
+ },
+ 'function',
+ 'function'
+ ],
+ 'hex value, override set' => [
+ 0x55,
+ 'hex',
+ '85'
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::makeStr
+ * @dataProvider varMakeTypeStringProvider
+ * @testdox makeStr $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param string|null $default
+ * @param string $expected
+ * @return void
+ */
+ public function testMakeString(mixed $input, ?string $default, string $expected): void
+ {
+ if ($default === null) {
+ $set_var = VarSetType::makeStr($input);
+ } else {
+ $set_var = VarSetType::makeStr($input, $default);
+ }
+ $this->assertIsString($set_var);
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varSetTypeIntProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'int' => [
+ 1,
+ null,
+ 1
+ ],
+ 'int, override set' => [
+ 1,
+ -1,
+ 1
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ 0
+ ],
+ 'string, override' => [
+ 'string',
+ -1,
+ -1
+ ],
+ 'float' => [
+ 1.5,
+ null,
+ 0
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setInt
+ * @dataProvider varSetTypeIntProvider
+ * @testdox setInt $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param int|null $default
+ * @param int $expected
+ * @return void
+ */
+ public function testSetInt(mixed $input, ?int $default, int $expected): void
+ {
+ if ($default === null) {
+ $set_var = VarSetType::setInt($input);
+ } else {
+ $set_var = VarSetType::setInt($input, $default);
+ }
+ $this->assertIsInt($set_var);
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varMakeTypeIntProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'int' => [
+ 1,
+ null,
+ 1
+ ],
+ 'int, override set' => [
+ 1,
+ -1,
+ 1
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ 0
+ ],
+ 'string, override' => [
+ 'string',
+ -1,
+ 0
+ ],
+ 'float' => [
+ 1.5,
+ null,
+ 1
+ ],
+ // all the strange things here
+ 'function, override set' => [
+ $foo = function () {
+ return '';
+ },
+ -1,
+ -1
+ ],
+ 'hex value, override set' => [
+ 0x55,
+ -1,
+ 85
+ ],
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::makeInt
+ * @dataProvider varMakeTypeIntProvider
+ * @testdox makeInt $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param int|null $default
+ * @param int $expected
+ * @return void
+ */
+ public function testMakeInt(mixed $input, ?int $default, int $expected): void
+ {
+ if ($default === null) {
+ $set_var = VarSetType::makeInt($input);
+ } else {
+ $set_var = VarSetType::makeInt($input, $default);
+ }
+ $this->assertIsInt($set_var);
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varSetTypeFloatProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'float' => [
+ 1.5,
+ null,
+ 1.5
+ ],
+ 'float, override set' => [
+ 1.5,
+ -1.5,
+ 1.5
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ 0.0
+ ],
+ 'string, override' => [
+ 'string',
+ 1.5,
+ 1.5
+ ],
+ 'int' => [
+ 1,
+ null,
+ 0.0
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setFloat
+ * @dataProvider varSetTypeFloatProvider
+ * @testdox setFloat $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param float|null $default
+ * @param float $expected
+ * @return void
+ */
+ public function testSetFloat(mixed $input, ?float $default, float $expected): void
+ {
+ if ($default === null) {
+ $set_var = VarSetType::setFloat($input);
+ } else {
+ $set_var = VarSetType::setFloat($input, $default);
+ }
+ $this->assertIsFloat($set_var);
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varMakeTypeFloatProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'float' => [
+ 1.5,
+ null,
+ 1.5
+ ],
+ 'float, override set' => [
+ 1.5,
+ -1.5,
+ 1.5
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ 0.0
+ ],
+ 'string, override' => [
+ 'string',
+ 1.5,
+ 0.0
+ ],
+ 'int' => [
+ 1,
+ null,
+ 1.0
+ ],
+ // all the strange things here
+ 'function, override set' => [
+ $foo = function () {
+ return '';
+ },
+ -1.0,
+ -1.0
+ ],
+ 'hex value, override set' => [
+ 0x55,
+ -1,
+ 85.0
+ ],
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::makeFloat
+ * @dataProvider varMakeTypeFloatProvider
+ * @testdox makeFloat $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param float|null $default
+ * @param float $expected
+ * @return void
+ */
+ public function testMakeFloat(mixed $input, ?float $default, float $expected): void
+ {
+ if ($default === null) {
+ $set_var = VarSetType::makeFloat($input);
+ } else {
+ $set_var = VarSetType::makeFloat($input, $default);
+ }
+ $this->assertIsFloat($set_var);
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varSetTypeArrayProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'array, empty' => [
+ [],
+ null,
+ []
+ ],
+ 'array, filled' => [
+ ['array'],
+ null,
+ ['array']
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ []
+ ],
+ 'string, override' => [
+ 'string',
+ ['string'],
+ ['string']
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setArray
+ * @dataProvider varSetTypeArrayProvider
+ * @testdox setArray $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param array|null $default
+ * @param array $expected
+ * @return void
+ */
+ public function testSetArray(mixed $input, ?array $default, array $expected): void
+ {
+ if ($default === null) {
+ $set_var = VarSetType::setArray($input);
+ } else {
+ $set_var = VarSetType::setArray($input, $default);
+ }
+ $this->assertIsArray($set_var);
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varSetTypeBoolProvider(): array
+ {
+ // 0: input
+ // 1: default (null default)
+ // 2: expected
+ return [
+ 'bool true' => [
+ true,
+ null,
+ true
+ ],
+ 'bool false' => [
+ false,
+ null,
+ false
+ ],
+ 'string, no override' => [
+ 'string',
+ null,
+ false
+ ],
+ 'string, override' => [
+ 'string',
+ true,
+ true
+ ]
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setBool
+ * @dataProvider varSetTypeBoolProvider
+ * @testdox setBool $input with override $default will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param bool|null $default
+ * @param bool $expected
+ * @return void
+ */
+ public function testSetBool(mixed $input, ?bool $default, bool $expected): void
+ {
+ if ($default === null) {
+ $set_var = VarSetType::setBool($input);
+ } else {
+ $set_var = VarSetType::setBool($input, $default);
+ }
+ $this->assertIsBool($set_var);
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+
+ /**
+ * Undocumented function
+ *
+ * @return array
+ */
+ public function varMakeTypeBoolProvider(): array
+ {
+ // 0: input
+ // 2: expected
+ return [
+ 'true' => [
+ true,
+ null,
+ true
+ ],
+ 'false' => [
+ false,
+ null,
+ false
+ ],
+ 'string on' => [
+ 'on',
+ null,
+ true
+ ],
+ 'string off' => [
+ 'off',
+ null,
+ false
+ ],
+ 'invalid string' => [
+ 'sulzenbacher',
+ null,
+ false,
+ ],
+ 'invalid string, override' => [
+ 'sulzenbacher',
+ true,
+ true,
+ ],
+ 'array to default' => [
+ [],
+ null,
+ false
+ ],
+ ];
+ }
+
+ /**
+ * Undocumented function
+ * @covers ::setBool
+ * @dataProvider varMakeTypeBoolProvider
+ * @testdox setBool $input will be $expected [$_dataName]
+ *
+ * @param mixed $input
+ * @param bool|null $default
+ * @param bool $expected
+ * @return void
+ */
+ public function testMakeBool(mixed $input, ?bool $default, bool $expected): void
+ {
+ if ($default === null) {
+ $set_var = VarSetType::makeBool($input);
+ } else {
+ $set_var = VarSetType::makeBool($input, $default);
+ }
+ $this->assertIsBool($set_var);
+ $this->assertEquals(
+ $expected,
+ $set_var
+ );
+ }
+}
+
+// __END__
diff --git a/4dev/tests/CoreLibsDebugSupportTest.php b/4dev/tests/CoreLibsDebugSupportTest.php
index 7d8c0229..9bf2fef6 100644
--- a/4dev/tests/CoreLibsDebugSupportTest.php
+++ b/4dev/tests/CoreLibsDebugSupportTest.php
@@ -114,7 +114,15 @@ final class CoreLibsDebugSupportTest extends TestCase
*/
public function printToStringProvider(): array
{
+ // 0: unput
+ // 1: html flag (only for strings and arry)
+ // 2: expected
return [
+ 'null' => [
+ null,
+ null,
+ 'NULL',
+ ],
'string' => [
'a string',
null,
@@ -333,16 +341,19 @@ final class CoreLibsDebugSupportTest extends TestCase
* @dataProvider printToStringProvider
* @testdox printToString $input with $flag will be $expected [$_dataName]
*
- * @param mixed $input
- * @param boolean|null $flag
- * @param string $expected
+ * @param mixed $input anything
+ * @param boolean|null $flag html flag, only for string and array
+ * @param string $expected always string
* @return void
*/
- public function testPrintToString($input, ?bool $flag, string $expected): void
+ public function testPrintToString(mixed $input, ?bool $flag, string $expected): void
{
if ($flag === null) {
// if expected starts with / and ends with / then this is a regex compare
- if (substr($expected, 0, 1) == '/' && substr($expected, -1, 1) == '/') {
+ if (
+ substr($expected, 0, 1) == '/' &&
+ substr($expected, -1, 1) == '/'
+ ) {
$this->assertMatchesRegularExpression(
$expected,
\CoreLibs\Debug\Support::printToString($input)
diff --git a/www/admin/class_test.varistype.php b/www/admin/class_test.varistype.php
new file mode 100644
index 00000000..c1fb2153
--- /dev/null
+++ b/www/admin/class_test.varistype.php
@@ -0,0 +1,119 @@
+ BASE . LOG,
+ 'file_id' => $LOG_FILE_ID,
+ // add file date
+ 'print_file_date' => true,
+ // set debug and print flags
+ 'debug_all' => $DEBUG_ALL ?? false,
+ 'echo_all' => $ECHO_ALL ?? false,
+ 'print_all' => $PRINT_ALL ?? false,
+]);
+
+$PAGE_NAME = 'TEST CLASS: CONVERT\VARISTYPE';
+print "";
+print "
" . $PAGE_NAME . "";
+print "";
+print '';
+print '' . $PAGE_NAME . '
';
+
+
+print "Test A str set: " . VarSetType::setStr(5, 'set int') . "
";
+print "Test A str make int: " . VarSetType::makeStr(5, 'make int') . "
";
+print "Test A str make object: " . VarSetType::makeStr($log, 'Object') . "
";
+print "Test A str make null: " . VarSetType::makeStr(null, 'null') . "
";
+print "Test B int set: " . VarSetType::setInt("5", -1) . "
";
+print "Test B int make string: " . VarSetType::makeInt("5", -1) . "
";
+print "Test B' int make float: " . VarSetType::makeInt("5.5", -1) . "
";
+print "Test B'' int make class: " . VarSetType::makeInt($log, -1) . "
";
+print "Test B''' int make hex: " . VarSetType::makeInt("0x55", -1) . "
";
+print "Test B''' int make hex: " . VarSetType::makeInt(0x55, -1) . "
";
+print "Test C float make: " . VarSetType::makeFloat("13,232.95", -1) . "
";
+print "Test D floatval: " . floatval("13,232.95") . "
";
+print "Test E filter_var: "
+ . filter_var("13,232.95", FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) . "
";
+print "Test F filter_var: "
+ . filter_var("string", FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) . "
";
+
+print "Test G make bool: " . VarSetType::makeBool("on") . "
";
+print "Test G make bool: " . VarSetType::makeBool(null) . "
";
+print "Test G make bool: " . VarSetType::makeBool("null") . "
";
+print "Test G make bool: " . VarSetType::makeBool($log) . "
";
+print "Test G make bool: " . VarSetTypeNull::makeBool($log) . "
";
+
+print "
";
+
+$checks = [
+ 'string',
+ 5,
+ 1.2,
+ ['array'],
+ true,
+ // resource?
+];
+foreach ($checks as $string) {
+ print "** SET NOT NULL: (" . gettype($string) . ")
";
+ print "Str: " . Support::printToString($string) . ": -"
+ . Support::printToString(VarSetType::setStr($string)) . "-
";
+ print "Int: " . Support::printToString($string) . ": -"
+ . Support::printToString(VarSetType::setInt($string)) . "-
";
+ print "Float: " . Support::printToString($string) . ": -"
+ . Support::printToString(VarSetType::setFloat($string)) . "-
";
+ print "Bool: " . Support::printToString($string) . ": -"
+ . Support::printToString(VarSetType::setBool($string)) . "-
";
+ print "Array: " . Support::printToString($string) . ": -"
+ . Support::printToString(VarSetType::setArray($string)) . "-
";
+ print "
";
+}
+
+foreach ($checks as $string) {
+ print "** SET NULL: (" . gettype($string) . ")
";
+ print "Str: " . Support::printToString($string) . ": -"
+ . Support::printToString(VarSetTypeNull::setStr($string)) . "-
";
+ print "Int: " . Support::printToString($string) . ": -"
+ . Support::printToString(VarSetTypeNull::setInt($string)) . "-
";
+ print "Float: " . Support::printToString($string) . ": -"
+ . Support::printToString(VarSetTypeNull::setFloat($string)) . "-
";
+ print "Bool: " . Support::printToString($string) . ": -"
+ . Support::printToString(VarSetTypeNull::setBool($string)) . "-
";
+ print "Array: " . Support::printToString($string) . ": -"
+ . Support::printToString(VarSetTypeNull::setArray($string)) . "-
";
+ print "
";
+}
+
+// error message
+print $log->printErrorMsg();
+
+print "";
+
+// __END__
diff --git a/www/lib/CoreLibs/Convert/Extends/VarSetTypeMain.php b/www/lib/CoreLibs/Convert/Extends/VarSetTypeMain.php
new file mode 100644
index 00000000..e1f43822
--- /dev/null
+++ b/www/lib/CoreLibs/Convert/Extends/VarSetTypeMain.php
@@ -0,0 +1,256 @@
+ checks and return default value if not this type
+ * This will return default null on invalid entries
+ */
+
+declare(strict_types=1);
+
+namespace CoreLibs\Convert\Extends;
+
+class VarSetTypeMain
+{
+ /**
+ * If input variable is string then returns it, else returns default set
+ * if not null is true, then null as return is allowed, else return is
+ * converted to string
+ *
+ * @param mixed $val Input variable
+ * @param string|null $default Default value
+ * @param bool $to_null Convert to null (default no)
+ * @return string|null Input var or default value
+ */
+ protected static function setStrMain(
+ mixed $val,
+ ?string $default = null,
+ bool $to_null = false
+ ): ?string {
+ if (is_string($val)) {
+ return $val;
+ }
+ if ($to_null === false) {
+ return (string)$default;
+ }
+ return $default;
+ }
+
+ /**
+ * Will convert input data to string if possible.
+ * Runs for string/int/float/bool/null
+ * Will skip array/object/resource/callable/etc and use default for that
+ *
+ * @param mixed $val Input variable
+ * @param string|null $default Default value
+ * @param bool $to_null Convert to null (default no)
+ * @return string|null Converted input data to string/null
+ */
+ protected static function makeStrMain(
+ mixed $val,
+ string $default = null,
+ bool $to_null = false
+ ): ?string {
+ // int/float/string/bool/null, everything else is ignored
+ // no: array/object/resource/callable
+ if (
+ is_int($val) ||
+ is_float($val) ||
+ is_string($val) ||
+ is_bool($val) ||
+ is_null($val)
+ ) {
+ return (string)$val;
+ }
+ if ($to_null === false) {
+ return (string)$default;
+ }
+ return $default;
+ }
+
+
+ /**
+ * If input variable is int, return it, else return default value. If to_null
+ * is true then null as return is allowed, else only int is returned
+ *
+ * @param mixed $val Input variable
+ * @param int|null $default Default value
+ * @param bool $to_null Convert to null (default no)
+ * @return int|null Input var or default value
+ */
+ protected static function setIntMain(
+ mixed $val,
+ ?int $default = null,
+ bool $to_null = false
+ ): ?int {
+ if (is_int($val)) {
+ return $val;
+ }
+ if ($to_null === false) {
+ return (int)$default;
+ }
+ return $default;
+ }
+
+ /**
+ * Convert input to int via filter_var. If not convertable return default value.
+ * If to_null is set to true null return is allowed
+ * NOTE: this is only a drastic fallback and not recommned for special use.
+ * It will try to check via filter_var if we can get an int value and then use
+ * intval to convert it.
+ * Reason is that filter_var will convert eg 1.5 to 15 instead 1
+ * One is very wrong, the other is at least better, but not perfect
+ *
+ * @param mixed $val Input variable
+ * @param int|null $default Default value
+ * @param bool $to_null Convert to null (default no)
+ * @return int|null Converted input data to int/null
+ */
+ protected static function makeIntMain(
+ mixed $val,
+ int $default = null,
+ bool $to_null = false
+ ): ?int {
+ // if we can filter it to a valid int, we can convert it
+ // we so avoid object, array, etc
+ if (
+ filter_var(
+ $val,
+ FILTER_SANITIZE_NUMBER_INT
+ ) !== false
+ ) {
+ return intval($val);
+ }
+ if ($to_null === false) {
+ return (int)$default;
+ }
+ return $default;
+ }
+
+ /**
+ * If input is float return it, else set to default value. If to_null is set
+ * to true, allow null return
+ *
+ * @param mixed $val Input variable
+ * @param float|null $default Default value
+ * @param bool $to_null Convert to null (default no)
+ * @return float|null Input var or default value
+ */
+ protected static function setFloatMain(
+ mixed $val,
+ ?float $default = null,
+ bool $to_null = false
+ ): ?float {
+ if (is_float($val)) {
+ return $val;
+ }
+ if ($to_null === false) {
+ return (float)$default;
+ }
+ return $default;
+ }
+
+ /**
+ * Convert intput var to float via filter_var. If failed to so return default.
+ * If to_null is set to true allow null return
+ *
+ * @param mixed $val Input variable
+ * @param float|null $default Default value
+ * @param bool $to_null Convert to null (default no)
+ * @return float|null Converted intput data to float/null
+ */
+ protected static function makeFloatMain(
+ mixed $val,
+ float $default = null,
+ bool $to_null = false
+ ): ?float {
+ if (
+ (
+ $val = filter_var(
+ $val,
+ FILTER_SANITIZE_NUMBER_FLOAT,
+ FILTER_FLAG_ALLOW_FRACTION
+ )
+ ) !== false
+ ) {
+ return (float)$val;
+ }
+ if ($to_null === false) {
+ return (float)$default;
+ }
+ return $default;
+ }
+
+ /**
+ * If input var is array return it, else return default value. If to_null is
+ * set to true, allow null return
+ *
+ * @param mixed $val Input variable
+ * @param array|null $default Default value
+ * @param bool $to_null Convert to null (default no)
+ * @return array|null Input var or default value
+ */
+ protected static function setArrayMain(
+ mixed $val,
+ ?array $default = null,
+ bool $to_null = false
+ ): ?array {
+ if (is_array($val)) {
+ return $val;
+ }
+ if ($to_null === false) {
+ return (array)$default;
+ }
+ return $default;
+ }
+
+ /**
+ * If input var is bool return it, else return default value. If to_null is
+ * set to true will allow null return.
+ *
+ * @param mixed $val Input variable
+ * @param bool|null $default Default value
+ * @param bool $to_null Convert to null (default no)
+ * @return bool|null Input var or default value
+ */
+ protected static function setBoolMain(
+ mixed $val,
+ ?bool $default = null,
+ bool $to_null = false
+ ): ?bool {
+ if (is_bool($val)) {
+ return $val;
+ }
+ if ($to_null === false) {
+ return (bool)$default;
+ }
+ return $default;
+ }
+
+ /**
+ * Convert anything to bool. If it is a string it will try to use the filter_var
+ * to convert know true/false strings.
+ * Else it uses (bool) to convert the rest
+ * If null is allowed, will return null
+ *
+ * @param mixed $val Input variable
+ * @param bool $default Default value if to_null if false
+ * @param bool $to_null Convert to null (default no)
+ * @return bool|null Converted input data to bool/ null
+ */
+ protected static function makeBoolMain(
+ mixed $val,
+ bool $default = false,
+ bool $to_null = false
+ ): ?bool {
+ $boolvar = is_string($val) ?
+ filter_var(
+ $val,
+ FILTER_VALIDATE_BOOLEAN,
+ FILTER_NULL_ON_FAILURE
+ ) :
+ (bool)$val;
+ return $boolvar === null && !$to_null ? $default : $boolvar;
+ }
+}
+
+// __END__
diff --git a/www/lib/CoreLibs/Convert/VarSetType.php b/www/lib/CoreLibs/Convert/VarSetType.php
new file mode 100644
index 00000000..8ed140e8
--- /dev/null
+++ b/www/lib/CoreLibs/Convert/VarSetType.php
@@ -0,0 +1,136 @@
+ checks and return default value if not this type
+ * This will return a default value as always what is expected and never null
+ * Use this for santize output from multi return functions where we know what
+ * will come back
+ */
+
+declare(strict_types=1);
+
+namespace CoreLibs\Convert;
+
+use CoreLibs\Convert\Extends\VarSetTypeMain;
+
+class VarSetType extends Extends\VarSetTypeMain
+{
+ /**
+ * Check is input is string, if not return default string.
+ * Will always return string
+ *
+ * @param mixed $val Input value
+ * @param string $default Default override value
+ * @return string Input value or default as string
+ */
+ public static function setStr(mixed $val, string $default = ''): string
+ {
+ return (string)VarSetTypeMain::setStrMain($val, $default, false);
+ }
+
+ /**
+ * Convert input to string if possible.
+ * Will only work on string/int/float/bool/null types
+ * Will always return string
+ *
+ * @param mixed $val Input value
+ * @param string $default Default override value
+ * @return string Input value as string or default as string
+ */
+ public static function makeStr(mixed $val, string $default = ''): string
+ {
+ return (string)VarSetTypeMain::makeStrMain($val, $default, false);
+ }
+
+ /**
+ * Check if input is int, if not return default int value 0.
+ * Will always return int.
+ *
+ * @param mixed $val Input value
+ * @param int $default Default override value
+ * @return int Input value or default as int
+ */
+ public static function setInt(mixed $val, int $default = 0): int
+ {
+ return (int)VarSetTypeMain::setIntMain($val, $default, false);
+ }
+
+ /**
+ * Convert intput to int if possible, if not return default value 0.
+ * Will always return int.
+ *
+ * @param mixed $val Input value
+ * @param int $default Default override value
+ * @return int Input value as int or default as int
+ */
+ public static function makeInt(mixed $val, int $default = 0): int
+ {
+ return (int)VarSetTypeMain::makeIntMain($val, $default, false);
+ }
+
+ /**
+ * Check if input is float, if not return default value value 0.0.
+ * Will always return float
+ *
+ * @param mixed $val Input value
+ * @param float $default Default override value
+ * @return float Input value or default as float
+ */
+ public static function setFloat(mixed $val, float $default = 0.0): float
+ {
+ return (float)VarSetTypeMain::setFloatMain($val, $default, false);
+ }
+
+ /**
+ * Convert input to float, if not possible return default value 0.0.
+ * Will always return float
+ *
+ * @param mixed $val Input value
+ * @param float $default Default override value
+ * @return float Input value as float or default as float
+ */
+ public static function makeFloat(mixed $val, float $default = 0.0): float
+ {
+ return (float)VarSetTypeMain::makeFloatMain($val, $default, false);
+ }
+
+ /**
+ * Check if input is array, if not return default empty array.
+ * Will always return array.
+ *
+ * @param mixed $val Input value
+ * @param array $default Default override value
+ * @return array Input value or default as array
+ */
+ public static function setArray(mixed $val, array $default = []): array
+ {
+ return (array)VarSetTypeMain::setArrayMain($val, $default, false);
+ }
+
+ /**
+ * Check if input is bool, if not will return default value false.
+ * Will aways return bool.
+ *
+ * @param mixed $val Input value
+ * @param bool $default Default override value
+ * @return bool Input value or default as bool
+ */
+ public static function setBool(mixed $val, bool $default = false): bool
+ {
+ return (bool)VarSetTypeMain::setBoolMain($val, $default, false);
+ }
+
+ /**
+ * Convert anything to bool
+ *
+ * @param mixed $val Input value
+ * @param bool $default Default override value
+ * @return bool Input value as bool or default as bool
+ */
+ public static function makeBool(mixed $val, bool $default = false): bool
+ {
+ return (bool)VarSetTypeMain::makeBoolMain($val, $default, false);
+ }
+}
+
+// __END__
diff --git a/www/lib/CoreLibs/Convert/VarSetTypeNull.php b/www/lib/CoreLibs/Convert/VarSetTypeNull.php
new file mode 100644
index 00000000..0fc82e52
--- /dev/null
+++ b/www/lib/CoreLibs/Convert/VarSetTypeNull.php
@@ -0,0 +1,130 @@
+ checks and return default value if not this type
+ * This will return default null on invalid entries
+ */
+
+declare(strict_types=1);
+
+namespace CoreLibs\Convert;
+
+use CoreLibs\Convert\Extends\VarSetTypeMain;
+
+class VarSetTypeNull extends Extends\VarSetTypeMain
+{
+ /**
+ * Check is input is string, if not return default string.
+ * Will return null if no string as default.
+ *
+ * @param mixed $val Input value
+ * @param string|null $default Default override value
+ * @return string|null Input value or default as string/null
+ */
+ public static function setStr(mixed $val, ?string $default = null): ?string
+ {
+ return VarSetTypeMain::setStrMain($val, $default, true);
+ }
+
+ /**
+ * Convert input to string if possible.
+ * Will only work on string/int/float/bool/null types.
+ * Will return null if convert failed as default.
+ *
+ * @param mixed $val Input value
+ * @param string|null $default Default override value
+ * @return string|null Input value as string or default as string/null
+ */
+ public static function makeStr(mixed $val, string $default = null): ?string
+ {
+ return VarSetTypeMain::makeStrMain($val, $default, true);
+ }
+
+
+ /**
+ * Check if input is int, if not return default value null.
+ *
+ * @param mixed $val Input value
+ * @param int|null $default Default override value
+ * @return int|null Input value or default as int/null
+ */
+ public static function setInt(mixed $val, ?int $default = null): ?int
+ {
+ return VarSetTypeMain::setIntMain($val, $default, true);
+ }
+
+ /**
+ * Convert intput to int if possible, if not return default value value null.
+ *
+ * @param mixed $val Input value $val
+ * @param int|null $default Default override value
+ * @return int|null Input value as int or default as int/null
+ */
+ public static function makeInt(mixed $val, int $default = null): ?int
+ {
+ return VarSetTypeMain::makeIntMain($val, $default, true);
+ }
+
+ /**
+ * Check if input is float, if not return default value value null.
+ *
+ * @param mixed $val Input value $val
+ * @param float|null $default Default override value
+ * @return float|null Input value or default as float/null
+ */
+ public static function setFloat(mixed $val, ?float $default = null): ?float
+ {
+ return VarSetTypeMain::setFloatMain($val, $default, true);
+ }
+
+ /**
+ * Convert input to float, if not possible return default value null.
+ *
+ * @param mixed $val Input value $val
+ * @param float|null $default Default override value
+ * @return float|null Input value as float or default as float/null
+ */
+ public static function makeFloat(mixed $val, float $default = null): ?float
+ {
+ return VarSetTypeMain::makeFloatMain($val, $default, true);
+ }
+
+ /**
+ * Check if input is array, if not return default value null.
+ *
+ * @param mixed $val Input value $val
+ * @param array|null $default Default override value
+ * @return array|null Input value or default as array/null
+ */
+ public static function setArray(mixed $val, ?array $default = null): ?array
+ {
+ return VarSetTypeMain::setArrayMain($val, $default, true);
+ }
+
+ /**
+ * Check if input is bool, if not will return default value null.
+ *
+ * @param mixed $val Input value $val
+ * @param bool|null $default Default override value
+ * @return bool|null Input value or default as bool/null
+ */
+ public static function setBool(mixed $val, ?bool $default = null): ?bool
+ {
+ return VarSetTypeMain::setBoolMain($val, $default, true);
+ }
+
+ /**
+ * Convert anything to bool
+ *
+ * @param mixed $val Input value $val
+ * @return bool|null Input value as bool or default as bool/null
+ */
+ public static function makeBool(mixed $val): ?bool
+ {
+ // note that the default value here is irrelevant, we return null
+ // on unsetable string var
+ return VarSetTypeMain::makeBoolMain($val, false, true);
+ }
+}
+
+// __END__
diff --git a/www/lib/CoreLibs/Debug/Support.php b/www/lib/CoreLibs/Debug/Support.php
index 36af4a39..c4a322b2 100644
--- a/www/lib/CoreLibs/Debug/Support.php
+++ b/www/lib/CoreLibs/Debug/Support.php
@@ -94,9 +94,11 @@ class Support
* @param bool $no_html set to true to use ##HTMLPRE##or html escape
* @return string
*/
- public static function printToString($mixed, bool $no_html = false): string
+ public static function printToString(mixed $mixed, bool $no_html = false): string
{
- if (is_bool($mixed)) {
+ if (is_null($mixed)) {
+ return (string)'NULL';
+ } elseif (is_bool($mixed)) {
return self::printBool($mixed, '', 'TRUE', 'FALSE');
} elseif (is_resource($mixed)) {
return (string)$mixed;
diff --git a/www/vendor/autoload.php b/www/vendor/autoload.php
index e95f2fda..74efe898 100644
--- a/www/vendor/autoload.php
+++ b/www/vendor/autoload.php
@@ -2,6 +2,24 @@
// autoload.php @generated by Composer
+if (PHP_VERSION_ID < 50600) {
+ if (!headers_sent()) {
+ header('HTTP/1.1 500 Internal Server Error');
+ }
+ $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
+ if (!ini_get('display_errors')) {
+ if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
+ fwrite(STDERR, $err);
+ } elseif (!headers_sent()) {
+ echo $err;
+ }
+ }
+ trigger_error(
+ $err,
+ E_USER_ERROR
+ );
+}
+
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit10fe8fe2ec4017b8644d2b64bcf398b9::getLoader();
diff --git a/www/vendor/composer/ClassLoader.php b/www/vendor/composer/ClassLoader.php
index 0cd6055d..fd56bd7d 100644
--- a/www/vendor/composer/ClassLoader.php
+++ b/www/vendor/composer/ClassLoader.php
@@ -42,6 +42,9 @@ namespace Composer\Autoload;
*/
class ClassLoader
{
+ /** @var \Closure(string):void */
+ private static $includeFile;
+
/** @var ?string */
private $vendorDir;
@@ -106,6 +109,7 @@ class ClassLoader
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
+ self::initializeIncludeClosure();
}
/**
@@ -149,7 +153,7 @@ class ClassLoader
/**
* @return string[] Array of classname => path
- * @psalm-var array
+ * @psalm-return array
*/
public function getClassMap()
{
@@ -425,7 +429,7 @@ class ClassLoader
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
- includeFile($file);
+ (self::$includeFile)($file);
return true;
}
@@ -555,18 +559,23 @@ class ClassLoader
return false;
}
-}
-/**
- * Scope isolated include.
- *
- * Prevents access to $this/self from included files.
- *
- * @param string $file
- * @return void
- * @private
- */
-function includeFile($file)
-{
- include $file;
+ private static function initializeIncludeClosure(): void
+ {
+ if (self::$includeFile !== null) {
+ return;
+ }
+
+ /**
+ * Scope isolated include.
+ *
+ * Prevents access to $this/self from included files.
+ *
+ * @param string $file
+ * @return void
+ */
+ self::$includeFile = static function($file) {
+ include $file;
+ };
+ }
}
diff --git a/www/vendor/composer/autoload_classmap.php b/www/vendor/composer/autoload_classmap.php
index 4408f1f4..59ddd58d 100644
--- a/www/vendor/composer/autoload_classmap.php
+++ b/www/vendor/composer/autoload_classmap.php
@@ -2,7 +2,7 @@
// autoload_classmap.php @generated by Composer
-$vendorDir = dirname(dirname(__FILE__));
+$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
@@ -24,12 +24,15 @@ return array(
'CoreLibs\\Convert\\Byte' => $baseDir . '/lib/CoreLibs/Convert/Byte.php',
'CoreLibs\\Convert\\Colors' => $baseDir . '/lib/CoreLibs/Convert/Colors.php',
'CoreLibs\\Convert\\Encoding' => $baseDir . '/lib/CoreLibs/Convert/Encoding.php',
+ 'CoreLibs\\Convert\\Extends\\VarSetTypeMain' => $baseDir . '/lib/CoreLibs/Convert/Extends/VarSetTypeMain.php',
'CoreLibs\\Convert\\Html' => $baseDir . '/lib/CoreLibs/Convert/Html.php',
'CoreLibs\\Convert\\Json' => $baseDir . '/lib/CoreLibs/Convert/Json.php',
'CoreLibs\\Convert\\Math' => $baseDir . '/lib/CoreLibs/Convert/Math.php',
'CoreLibs\\Convert\\MimeAppName' => $baseDir . '/lib/CoreLibs/Convert/MimeAppName.php',
'CoreLibs\\Convert\\MimeEncode' => $baseDir . '/lib/CoreLibs/Convert/MimeEncode.php',
'CoreLibs\\Convert\\Strings' => $baseDir . '/lib/CoreLibs/Convert/Strings.php',
+ 'CoreLibs\\Convert\\VarSetType' => $baseDir . '/lib/CoreLibs/Convert/VarSetType.php',
+ 'CoreLibs\\Convert\\VarSetTypeNull' => $baseDir . '/lib/CoreLibs/Convert/VarSetTypeNull.php',
'CoreLibs\\Create\\Email' => $baseDir . '/lib/CoreLibs/Create/Email.php',
'CoreLibs\\Create\\Hash' => $baseDir . '/lib/CoreLibs/Create/Hash.php',
'CoreLibs\\Create\\RandomKey' => $baseDir . '/lib/CoreLibs/Create/RandomKey.php',
diff --git a/www/vendor/composer/autoload_files.php b/www/vendor/composer/autoload_files.php
index 7fa6f4a9..2530eb44 100644
--- a/www/vendor/composer/autoload_files.php
+++ b/www/vendor/composer/autoload_files.php
@@ -2,10 +2,10 @@
// autoload_files.php @generated by Composer
-$vendorDir = dirname(dirname(__FILE__));
+$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
- 'ec07570ca5a812141189b1fa81503674' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
+ 'ec07570ca5a812141189b1fa81503674' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
);
diff --git a/www/vendor/composer/autoload_namespaces.php b/www/vendor/composer/autoload_namespaces.php
index b7fc0125..15a2ff3a 100644
--- a/www/vendor/composer/autoload_namespaces.php
+++ b/www/vendor/composer/autoload_namespaces.php
@@ -2,7 +2,7 @@
// autoload_namespaces.php @generated by Composer
-$vendorDir = dirname(dirname(__FILE__));
+$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
diff --git a/www/vendor/composer/autoload_psr4.php b/www/vendor/composer/autoload_psr4.php
index f80149dc..1908da4c 100644
--- a/www/vendor/composer/autoload_psr4.php
+++ b/www/vendor/composer/autoload_psr4.php
@@ -2,7 +2,7 @@
// autoload_psr4.php @generated by Composer
-$vendorDir = dirname(dirname(__FILE__));
+$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
diff --git a/www/vendor/composer/autoload_real.php b/www/vendor/composer/autoload_real.php
index 95c52c4e..a7a82972 100644
--- a/www/vendor/composer/autoload_real.php
+++ b/www/vendor/composer/autoload_real.php
@@ -23,51 +23,26 @@ class ComposerAutoloaderInit10fe8fe2ec4017b8644d2b64bcf398b9
}
spl_autoload_register(array('ComposerAutoloaderInit10fe8fe2ec4017b8644d2b64bcf398b9', 'loadClassLoader'), true, true);
- self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInit10fe8fe2ec4017b8644d2b64bcf398b9', 'loadClassLoader'));
- $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
- if ($useStaticLoader) {
- require __DIR__ . '/autoload_static.php';
-
- call_user_func(\Composer\Autoload\ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9::getInitializer($loader));
- } else {
- $map = require __DIR__ . '/autoload_namespaces.php';
- foreach ($map as $namespace => $path) {
- $loader->set($namespace, $path);
- }
-
- $map = require __DIR__ . '/autoload_psr4.php';
- foreach ($map as $namespace => $path) {
- $loader->setPsr4($namespace, $path);
- }
-
- $classMap = require __DIR__ . '/autoload_classmap.php';
- if ($classMap) {
- $loader->addClassMap($classMap);
- }
- }
+ require __DIR__ . '/autoload_static.php';
+ call_user_func(\Composer\Autoload\ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9::getInitializer($loader));
$loader->register(true);
- if ($useStaticLoader) {
- $includeFiles = Composer\Autoload\ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9::$files;
- } else {
- $includeFiles = require __DIR__ . '/autoload_files.php';
- }
- foreach ($includeFiles as $fileIdentifier => $file) {
- composerRequire10fe8fe2ec4017b8644d2b64bcf398b9($fileIdentifier, $file);
+ $filesToLoad = \Composer\Autoload\ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9::$files;
+ $requireFile = static function ($fileIdentifier, $file) {
+ if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
+ $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
+
+ require $file;
+ }
+ };
+ foreach ($filesToLoad as $fileIdentifier => $file) {
+ ($requireFile)($fileIdentifier, $file);
}
return $loader;
}
}
-
-function composerRequire10fe8fe2ec4017b8644d2b64bcf398b9($fileIdentifier, $file)
-{
- if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
- require $file;
-
- $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
- }
-}
diff --git a/www/vendor/composer/autoload_static.php b/www/vendor/composer/autoload_static.php
index 9661276c..19a41a77 100644
--- a/www/vendor/composer/autoload_static.php
+++ b/www/vendor/composer/autoload_static.php
@@ -7,8 +7,8 @@ namespace Composer\Autoload;
class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
{
public static $files = array (
- 'ec07570ca5a812141189b1fa81503674' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
'6124b4c8570aa390c21fafd04a26c69f' => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
+ 'ec07570ca5a812141189b1fa81503674' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
);
public static $prefixLengthsPsr4 = array (
@@ -57,12 +57,15 @@ class ComposerStaticInit10fe8fe2ec4017b8644d2b64bcf398b9
'CoreLibs\\Convert\\Byte' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/Byte.php',
'CoreLibs\\Convert\\Colors' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/Colors.php',
'CoreLibs\\Convert\\Encoding' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/Encoding.php',
+ 'CoreLibs\\Convert\\Extends\\VarSetTypeMain' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/Extends/VarSetTypeMain.php',
'CoreLibs\\Convert\\Html' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/Html.php',
'CoreLibs\\Convert\\Json' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/Json.php',
'CoreLibs\\Convert\\Math' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/Math.php',
'CoreLibs\\Convert\\MimeAppName' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/MimeAppName.php',
'CoreLibs\\Convert\\MimeEncode' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/MimeEncode.php',
'CoreLibs\\Convert\\Strings' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/Strings.php',
+ 'CoreLibs\\Convert\\VarSetType' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/VarSetType.php',
+ 'CoreLibs\\Convert\\VarSetTypeNull' => __DIR__ . '/../..' . '/lib/CoreLibs/Convert/VarSetTypeNull.php',
'CoreLibs\\Create\\Email' => __DIR__ . '/../..' . '/lib/CoreLibs/Create/Email.php',
'CoreLibs\\Create\\Hash' => __DIR__ . '/../..' . '/lib/CoreLibs/Create/Hash.php',
'CoreLibs\\Create\\RandomKey' => __DIR__ . '/../..' . '/lib/CoreLibs/Create/RandomKey.php',