Rename the VarSetType class to SetVarType
The old name made no sense and it was only used in two projects, so the deprecation step has been skipped
This commit is contained in:
@@ -5,14 +5,14 @@ declare(strict_types=1);
|
||||
namespace tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use CoreLibs\Convert\VarSetTypeNull;
|
||||
use CoreLibs\Convert\SetVarTypeNull;
|
||||
|
||||
/**
|
||||
* Test class for Convert\Strings
|
||||
* @coversDefaultClass \CoreLibs\Convert\VarSetTypeNull
|
||||
* @testdox \CoreLibs\Convert\VarSetTypeNull method tests
|
||||
* @coversDefaultClass \CoreLibs\Convert\SetVarTypeNull
|
||||
* @testdox \CoreLibs\Convert\SetVarTypeNull method tests
|
||||
*/
|
||||
final class CoreLibsConvertVarSetTypeNullTest extends TestCase
|
||||
final class CoreLibsConvertSetVarTypeNullTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Undocumented function
|
||||
@@ -66,7 +66,7 @@ final class CoreLibsConvertVarSetTypeNullTest extends TestCase
|
||||
*/
|
||||
public function testSetString(mixed $input, ?string $default, ?string $expected): void
|
||||
{
|
||||
$set_var = VarSetTypeNull::setStr($input, $default);
|
||||
$set_var = SetVarTypeNull::setStr($input, $default);
|
||||
if ($expected !== null) {
|
||||
$this->assertIsString($set_var);
|
||||
} else {
|
||||
@@ -155,7 +155,7 @@ final class CoreLibsConvertVarSetTypeNullTest extends TestCase
|
||||
*/
|
||||
public function testMakeString(mixed $input, ?string $default, ?string $expected): void
|
||||
{
|
||||
$set_var = VarSetTypeNull::makeStr($input, $default);
|
||||
$set_var = SetVarTypeNull::makeStr($input, $default);
|
||||
if ($expected !== null) {
|
||||
$this->assertIsString($set_var);
|
||||
} else {
|
||||
@@ -219,7 +219,7 @@ final class CoreLibsConvertVarSetTypeNullTest extends TestCase
|
||||
*/
|
||||
public function testSetInt(mixed $input, ?int $default, ?int $expected): void
|
||||
{
|
||||
$set_var = VarSetTypeNull::setInt($input, $default);
|
||||
$set_var = SetVarTypeNull::setInt($input, $default);
|
||||
if ($expected !== null) {
|
||||
$this->assertIsInt($set_var);
|
||||
} else {
|
||||
@@ -303,7 +303,7 @@ final class CoreLibsConvertVarSetTypeNullTest extends TestCase
|
||||
*/
|
||||
public function testMakeInt(mixed $input, ?int $default, ?int $expected): void
|
||||
{
|
||||
$set_var = VarSetTypeNull::makeInt($input, $default);
|
||||
$set_var = SetVarTypeNull::makeInt($input, $default);
|
||||
if ($expected !== null) {
|
||||
$this->assertIsInt($set_var);
|
||||
} else {
|
||||
@@ -367,7 +367,7 @@ final class CoreLibsConvertVarSetTypeNullTest extends TestCase
|
||||
*/
|
||||
public function testSetFloat(mixed $input, ?float $default, ?float $expected): void
|
||||
{
|
||||
$set_var = VarSetTypeNull::setFloat($input, $default);
|
||||
$set_var = SetVarTypeNull::setFloat($input, $default);
|
||||
if ($expected !== null) {
|
||||
$this->assertIsFloat($set_var);
|
||||
} else {
|
||||
@@ -452,7 +452,7 @@ final class CoreLibsConvertVarSetTypeNullTest extends TestCase
|
||||
*/
|
||||
public function testMakeFloat(mixed $input, ?float $default, ?float $expected): void
|
||||
{
|
||||
$set_var = VarSetTypeNull::makeFloat($input, $default);
|
||||
$set_var = SetVarTypeNull::makeFloat($input, $default);
|
||||
if ($expected !== null) {
|
||||
$this->assertIsFloat($set_var);
|
||||
} else {
|
||||
@@ -511,7 +511,7 @@ final class CoreLibsConvertVarSetTypeNullTest extends TestCase
|
||||
*/
|
||||
public function testSetArray(mixed $input, ?array $default, ?array $expected): void
|
||||
{
|
||||
$set_var = VarSetTypeNull::setArray($input, $default);
|
||||
$set_var = SetVarTypeNull::setArray($input, $default);
|
||||
if ($expected !== null) {
|
||||
$this->assertIsArray($set_var);
|
||||
} else {
|
||||
@@ -570,7 +570,7 @@ final class CoreLibsConvertVarSetTypeNullTest extends TestCase
|
||||
*/
|
||||
public function testSetBool(mixed $input, ?bool $default, ?bool $expected): void
|
||||
{
|
||||
$set_var = VarSetTypeNull::setBool($input, $default);
|
||||
$set_var = SetVarTypeNull::setBool($input, $default);
|
||||
if ($expected !== null) {
|
||||
$this->assertIsBool($set_var);
|
||||
} else {
|
||||
@@ -636,7 +636,7 @@ final class CoreLibsConvertVarSetTypeNullTest extends TestCase
|
||||
*/
|
||||
public function testMakeBool(mixed $input, ?bool $expected): void
|
||||
{
|
||||
$set_var = VarSetTypeNull::makeBool($input);
|
||||
$set_var = SetVarTypeNull::makeBool($input);
|
||||
if ($expected !== null) {
|
||||
$this->assertIsBool($set_var);
|
||||
} else {
|
||||
@@ -5,14 +5,14 @@ declare(strict_types=1);
|
||||
namespace tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use CoreLibs\Convert\VarSetType;
|
||||
use CoreLibs\Convert\SetVarType;
|
||||
|
||||
/**
|
||||
* Test class for Convert\Strings
|
||||
* @coversDefaultClass \CoreLibs\Convert\VarSetType
|
||||
* @testdox \CoreLibs\Convert\VarSetType method tests
|
||||
* @coversDefaultClass \CoreLibs\Convert\SetVarType
|
||||
* @testdox \CoreLibs\Convert\SetVarType method tests
|
||||
*/
|
||||
final class CoreLibsConvertVarSetTypeTest extends TestCase
|
||||
final class CoreLibsConvertSetVarTypeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Undocumented function
|
||||
@@ -67,9 +67,9 @@ final class CoreLibsConvertVarSetTypeTest extends TestCase
|
||||
public function testSetString(mixed $input, ?string $default, string $expected): void
|
||||
{
|
||||
if ($default === null) {
|
||||
$set_var = VarSetType::setStr($input);
|
||||
$set_var = SetVarType::setStr($input);
|
||||
} else {
|
||||
$set_var = VarSetType::setStr($input, $default);
|
||||
$set_var = SetVarType::setStr($input, $default);
|
||||
}
|
||||
$this->assertIsString($set_var);
|
||||
$this->assertEquals(
|
||||
@@ -144,9 +144,9 @@ final class CoreLibsConvertVarSetTypeTest extends TestCase
|
||||
public function testMakeString(mixed $input, ?string $default, string $expected): void
|
||||
{
|
||||
if ($default === null) {
|
||||
$set_var = VarSetType::makeStr($input);
|
||||
$set_var = SetVarType::makeStr($input);
|
||||
} else {
|
||||
$set_var = VarSetType::makeStr($input, $default);
|
||||
$set_var = SetVarType::makeStr($input, $default);
|
||||
}
|
||||
$this->assertIsString($set_var);
|
||||
$this->assertEquals(
|
||||
@@ -208,9 +208,9 @@ final class CoreLibsConvertVarSetTypeTest extends TestCase
|
||||
public function testSetInt(mixed $input, ?int $default, int $expected): void
|
||||
{
|
||||
if ($default === null) {
|
||||
$set_var = VarSetType::setInt($input);
|
||||
$set_var = SetVarType::setInt($input);
|
||||
} else {
|
||||
$set_var = VarSetType::setInt($input, $default);
|
||||
$set_var = SetVarType::setInt($input, $default);
|
||||
}
|
||||
$this->assertIsInt($set_var);
|
||||
$this->assertEquals(
|
||||
@@ -285,9 +285,9 @@ final class CoreLibsConvertVarSetTypeTest extends TestCase
|
||||
public function testMakeInt(mixed $input, ?int $default, int $expected): void
|
||||
{
|
||||
if ($default === null) {
|
||||
$set_var = VarSetType::makeInt($input);
|
||||
$set_var = SetVarType::makeInt($input);
|
||||
} else {
|
||||
$set_var = VarSetType::makeInt($input, $default);
|
||||
$set_var = SetVarType::makeInt($input, $default);
|
||||
}
|
||||
$this->assertIsInt($set_var);
|
||||
$this->assertEquals(
|
||||
@@ -349,9 +349,9 @@ final class CoreLibsConvertVarSetTypeTest extends TestCase
|
||||
public function testSetFloat(mixed $input, ?float $default, float $expected): void
|
||||
{
|
||||
if ($default === null) {
|
||||
$set_var = VarSetType::setFloat($input);
|
||||
$set_var = SetVarType::setFloat($input);
|
||||
} else {
|
||||
$set_var = VarSetType::setFloat($input, $default);
|
||||
$set_var = SetVarType::setFloat($input, $default);
|
||||
}
|
||||
$this->assertIsFloat($set_var);
|
||||
$this->assertEquals(
|
||||
@@ -426,9 +426,9 @@ final class CoreLibsConvertVarSetTypeTest extends TestCase
|
||||
public function testMakeFloat(mixed $input, ?float $default, float $expected): void
|
||||
{
|
||||
if ($default === null) {
|
||||
$set_var = VarSetType::makeFloat($input);
|
||||
$set_var = SetVarType::makeFloat($input);
|
||||
} else {
|
||||
$set_var = VarSetType::makeFloat($input, $default);
|
||||
$set_var = SetVarType::makeFloat($input, $default);
|
||||
}
|
||||
$this->assertIsFloat($set_var);
|
||||
$this->assertEquals(
|
||||
@@ -485,9 +485,9 @@ final class CoreLibsConvertVarSetTypeTest extends TestCase
|
||||
public function testSetArray(mixed $input, ?array $default, array $expected): void
|
||||
{
|
||||
if ($default === null) {
|
||||
$set_var = VarSetType::setArray($input);
|
||||
$set_var = SetVarType::setArray($input);
|
||||
} else {
|
||||
$set_var = VarSetType::setArray($input, $default);
|
||||
$set_var = SetVarType::setArray($input, $default);
|
||||
}
|
||||
$this->assertIsArray($set_var);
|
||||
$this->assertEquals(
|
||||
@@ -544,9 +544,9 @@ final class CoreLibsConvertVarSetTypeTest extends TestCase
|
||||
public function testSetBool(mixed $input, ?bool $default, bool $expected): void
|
||||
{
|
||||
if ($default === null) {
|
||||
$set_var = VarSetType::setBool($input);
|
||||
$set_var = SetVarType::setBool($input);
|
||||
} else {
|
||||
$set_var = VarSetType::setBool($input, $default);
|
||||
$set_var = SetVarType::setBool($input, $default);
|
||||
}
|
||||
$this->assertIsBool($set_var);
|
||||
$this->assertEquals(
|
||||
@@ -617,9 +617,9 @@ final class CoreLibsConvertVarSetTypeTest extends TestCase
|
||||
public function testMakeBool(mixed $input, ?bool $default, bool $expected): void
|
||||
{
|
||||
if ($default === null) {
|
||||
$set_var = VarSetType::makeBool($input);
|
||||
$set_var = SetVarType::makeBool($input);
|
||||
} else {
|
||||
$set_var = VarSetType::makeBool($input, $default);
|
||||
$set_var = SetVarType::makeBool($input, $default);
|
||||
}
|
||||
$this->assertIsBool($set_var);
|
||||
$this->assertEquals(
|
||||
@@ -84,6 +84,7 @@ print '<div><a href="class_test.debug.php">Class Test: DEBUG</a></div>';
|
||||
print '<div><a href="class_test.output.form.php">Class Test: OUTPUT FORM</a></div>';
|
||||
print '<div><a href="class_test.admin.backend.php">Class Test: BACKEND ADMIN CLASS</a></div>';
|
||||
print '<div><a href="class_test.lang.php">Class Test: LANG/L10n</a></div>';
|
||||
print '<div><a href="class_test.varistype.php">Class Test: SET VAR TYPE</a></div>';
|
||||
print '<div><a href="class_test.session.php">Class Test: SESSION</a></div>';
|
||||
print '<div><a href="class_test.session.read.php">Class Test: SESSION: READ</a></div>';
|
||||
print '<div><a href="class_test.smarty.php">Class Test: SMARTY</a></div>';
|
||||
|
||||
@@ -25,8 +25,8 @@ require 'config.php';
|
||||
$LOG_FILE_ID = 'classTest-VarIsType';
|
||||
ob_end_flush();
|
||||
|
||||
use CoreLibs\Convert\VarSetType;
|
||||
use CoreLibs\Convert\VarSetTypeNull;
|
||||
use CoreLibs\Convert\SetVarType;
|
||||
use CoreLibs\Convert\SetVarTypeNull;
|
||||
use CoreLibs\Debug\Support;
|
||||
|
||||
$log = new CoreLibs\Debug\Logging([
|
||||
@@ -48,28 +48,28 @@ print '<div><a href="class_test.php">Class Test Master</a></div>';
|
||||
print '<div><h1>' . $PAGE_NAME . '</h1></div>';
|
||||
|
||||
|
||||
print "Test A str set: " . VarSetType::setStr(5, 'set int') . "<br>";
|
||||
print "Test A str make int: " . VarSetType::makeStr(5, 'make int') . "<br>";
|
||||
print "Test A str make object: " . VarSetType::makeStr($log, 'Object') . "<br>";
|
||||
print "Test A str make null: " . VarSetType::makeStr(null, 'null') . "<br>";
|
||||
print "Test B int set: " . VarSetType::setInt("5", -1) . "<br>";
|
||||
print "Test B int make string: " . VarSetType::makeInt("5", -1) . "<br>";
|
||||
print "Test B' int make float: " . VarSetType::makeInt("5.5", -1) . "<br>";
|
||||
print "Test B'' int make class: " . VarSetType::makeInt($log, -1) . "<br>";
|
||||
print "Test B''' int make hex: " . VarSetType::makeInt("0x55", -1) . "<br>";
|
||||
print "Test B''' int make hex: " . VarSetType::makeInt(0x55, -1) . "<br>";
|
||||
print "Test C float make: " . VarSetType::makeFloat("13,232.95", -1) . "<br>";
|
||||
print "Test A str set: " . SetVarType::setStr(5, 'set int') . "<br>";
|
||||
print "Test A str make int: " . SetVarType::makeStr(5, 'make int') . "<br>";
|
||||
print "Test A str make object: " . SetVarType::makeStr($log, 'Object') . "<br>";
|
||||
print "Test A str make null: " . SetVarType::makeStr(null, 'null') . "<br>";
|
||||
print "Test B int set: " . SetVarType::setInt("5", -1) . "<br>";
|
||||
print "Test B int make string: " . SetVarType::makeInt("5", -1) . "<br>";
|
||||
print "Test B' int make float: " . SetVarType::makeInt("5.5", -1) . "<br>";
|
||||
print "Test B'' int make class: " . SetVarType::makeInt($log, -1) . "<br>";
|
||||
print "Test B''' int make hex: " . SetVarType::makeInt("0x55", -1) . "<br>";
|
||||
print "Test B''' int make hex: " . SetVarType::makeInt(0x55, -1) . "<br>";
|
||||
print "Test C float make: " . SetVarType::makeFloat("13,232.95", -1) . "<br>";
|
||||
print "Test D floatval: " . floatval("13,232.95") . "<br>";
|
||||
print "Test E filter_var: "
|
||||
. filter_var("13,232.95", FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) . "<br>";
|
||||
print "Test F filter_var: "
|
||||
. filter_var("string", FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION) . "<br>";
|
||||
|
||||
print "Test G make bool: " . VarSetType::makeBool("on") . "<br>";
|
||||
print "Test G make bool: " . VarSetType::makeBool(null) . "<br>";
|
||||
print "Test G make bool: " . VarSetType::makeBool("null") . "<br>";
|
||||
print "Test G make bool: " . VarSetType::makeBool($log) . "<br>";
|
||||
print "Test G make bool: " . VarSetTypeNull::makeBool($log) . "<br>";
|
||||
print "Test G make bool: " . SetVarType::makeBool("on") . "<br>";
|
||||
print "Test G make bool: " . SetVarType::makeBool(null) . "<br>";
|
||||
print "Test G make bool: " . SetVarType::makeBool("null") . "<br>";
|
||||
print "Test G make bool: " . SetVarType::makeBool($log) . "<br>";
|
||||
print "Test G make bool: " . SetVarTypeNull::makeBool($log) . "<br>";
|
||||
|
||||
print "<hr>";
|
||||
|
||||
@@ -84,30 +84,30 @@ $checks = [
|
||||
foreach ($checks as $string) {
|
||||
print "** SET NOT NULL: (" . gettype($string) . ")<br>";
|
||||
print "Str: " . Support::printToString($string) . ": -"
|
||||
. Support::printToString(VarSetType::setStr($string)) . "-<br>";
|
||||
. Support::printToString(SetVarType::setStr($string)) . "-<br>";
|
||||
print "Int: " . Support::printToString($string) . ": -"
|
||||
. Support::printToString(VarSetType::setInt($string)) . "-<br>";
|
||||
. Support::printToString(SetVarType::setInt($string)) . "-<br>";
|
||||
print "Float: " . Support::printToString($string) . ": -"
|
||||
. Support::printToString(VarSetType::setFloat($string)) . "-<br>";
|
||||
. Support::printToString(SetVarType::setFloat($string)) . "-<br>";
|
||||
print "Bool: " . Support::printToString($string) . ": -"
|
||||
. Support::printToString(VarSetType::setBool($string)) . "-<br>";
|
||||
. Support::printToString(SetVarType::setBool($string)) . "-<br>";
|
||||
print "Array: " . Support::printToString($string) . ": -"
|
||||
. Support::printToString(VarSetType::setArray($string)) . "-<br>";
|
||||
. Support::printToString(SetVarType::setArray($string)) . "-<br>";
|
||||
print "<hr>";
|
||||
}
|
||||
|
||||
foreach ($checks as $string) {
|
||||
print "** SET NULL: (" . gettype($string) . ")<br>";
|
||||
print "Str: " . Support::printToString($string) . ": -"
|
||||
. Support::printToString(VarSetTypeNull::setStr($string)) . "-<br>";
|
||||
. Support::printToString(SetVarTypeNull::setStr($string)) . "-<br>";
|
||||
print "Int: " . Support::printToString($string) . ": -"
|
||||
. Support::printToString(VarSetTypeNull::setInt($string)) . "-<br>";
|
||||
. Support::printToString(SetVarTypeNull::setInt($string)) . "-<br>";
|
||||
print "Float: " . Support::printToString($string) . ": -"
|
||||
. Support::printToString(VarSetTypeNull::setFloat($string)) . "-<br>";
|
||||
. Support::printToString(SetVarTypeNull::setFloat($string)) . "-<br>";
|
||||
print "Bool: " . Support::printToString($string) . ": -"
|
||||
. Support::printToString(VarSetTypeNull::setBool($string)) . "-<br>";
|
||||
. Support::printToString(SetVarTypeNull::setBool($string)) . "-<br>";
|
||||
print "Array: " . Support::printToString($string) . ": -"
|
||||
. Support::printToString(VarSetTypeNull::setArray($string)) . "-<br>";
|
||||
. Support::printToString(SetVarTypeNull::setArray($string)) . "-<br>";
|
||||
print "<hr>";
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace CoreLibs\Convert\Extends;
|
||||
|
||||
class VarSetTypeMain
|
||||
class SetVarTypeMain
|
||||
{
|
||||
/**
|
||||
* If input variable is string then returns it, else returns default set
|
||||
@@ -11,9 +11,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace CoreLibs\Convert;
|
||||
|
||||
use CoreLibs\Convert\Extends\VarSetTypeMain;
|
||||
use CoreLibs\Convert\Extends\SetVarTypeMain;
|
||||
|
||||
class VarSetType extends Extends\VarSetTypeMain
|
||||
class SetVarType extends Extends\SetVarTypeMain
|
||||
{
|
||||
/**
|
||||
* Check is input is string, if not return default string.
|
||||
@@ -25,7 +25,7 @@ class VarSetType extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function setStr(mixed $val, string $default = ''): string
|
||||
{
|
||||
return (string)VarSetTypeMain::setStrMain($val, $default, false);
|
||||
return (string)SetVarTypeMain::setStrMain($val, $default, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,7 @@ class VarSetType extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function makeStr(mixed $val, string $default = ''): string
|
||||
{
|
||||
return (string)VarSetTypeMain::makeStrMain($val, $default, false);
|
||||
return (string)SetVarTypeMain::makeStrMain($val, $default, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ class VarSetType extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function setInt(mixed $val, int $default = 0): int
|
||||
{
|
||||
return (int)VarSetTypeMain::setIntMain($val, $default, false);
|
||||
return (int)SetVarTypeMain::setIntMain($val, $default, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,7 +65,7 @@ class VarSetType extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function makeInt(mixed $val, int $default = 0): int
|
||||
{
|
||||
return (int)VarSetTypeMain::makeIntMain($val, $default, false);
|
||||
return (int)SetVarTypeMain::makeIntMain($val, $default, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ class VarSetType extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function setFloat(mixed $val, float $default = 0.0): float
|
||||
{
|
||||
return (float)VarSetTypeMain::setFloatMain($val, $default, false);
|
||||
return (float)SetVarTypeMain::setFloatMain($val, $default, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,7 +91,7 @@ class VarSetType extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function makeFloat(mixed $val, float $default = 0.0): float
|
||||
{
|
||||
return (float)VarSetTypeMain::makeFloatMain($val, $default, false);
|
||||
return (float)SetVarTypeMain::makeFloatMain($val, $default, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ class VarSetType extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function setArray(mixed $val, array $default = []): array
|
||||
{
|
||||
return (array)VarSetTypeMain::setArrayMain($val, $default, false);
|
||||
return (array)SetVarTypeMain::setArrayMain($val, $default, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,7 +117,7 @@ class VarSetType extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function setBool(mixed $val, bool $default = false): bool
|
||||
{
|
||||
return (bool)VarSetTypeMain::setBoolMain($val, $default, false);
|
||||
return (bool)SetVarTypeMain::setBoolMain($val, $default, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,7 +129,7 @@ class VarSetType extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function makeBool(mixed $val, bool $default = false): bool
|
||||
{
|
||||
return (bool)VarSetTypeMain::makeBoolMain($val, $default, false);
|
||||
return (bool)SetVarTypeMain::makeBoolMain($val, $default, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace CoreLibs\Convert;
|
||||
|
||||
use CoreLibs\Convert\Extends\VarSetTypeMain;
|
||||
use CoreLibs\Convert\Extends\SetVarTypeMain;
|
||||
|
||||
class VarSetTypeNull extends Extends\VarSetTypeMain
|
||||
class SetVarTypeNull extends Extends\SetVarTypeMain
|
||||
{
|
||||
/**
|
||||
* Check is input is string, if not return default string.
|
||||
@@ -23,7 +23,7 @@ class VarSetTypeNull extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function setStr(mixed $val, ?string $default = null): ?string
|
||||
{
|
||||
return VarSetTypeMain::setStrMain($val, $default, true);
|
||||
return SetVarTypeMain::setStrMain($val, $default, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ class VarSetTypeNull extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function makeStr(mixed $val, string $default = null): ?string
|
||||
{
|
||||
return VarSetTypeMain::makeStrMain($val, $default, true);
|
||||
return SetVarTypeMain::makeStrMain($val, $default, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class VarSetTypeNull extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function setInt(mixed $val, ?int $default = null): ?int
|
||||
{
|
||||
return VarSetTypeMain::setIntMain($val, $default, true);
|
||||
return SetVarTypeMain::setIntMain($val, $default, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ class VarSetTypeNull extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function makeInt(mixed $val, int $default = null): ?int
|
||||
{
|
||||
return VarSetTypeMain::makeIntMain($val, $default, true);
|
||||
return SetVarTypeMain::makeIntMain($val, $default, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ class VarSetTypeNull extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function setFloat(mixed $val, ?float $default = null): ?float
|
||||
{
|
||||
return VarSetTypeMain::setFloatMain($val, $default, true);
|
||||
return SetVarTypeMain::setFloatMain($val, $default, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ class VarSetTypeNull extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function makeFloat(mixed $val, float $default = null): ?float
|
||||
{
|
||||
return VarSetTypeMain::makeFloatMain($val, $default, true);
|
||||
return SetVarTypeMain::makeFloatMain($val, $default, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ class VarSetTypeNull extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function setArray(mixed $val, ?array $default = null): ?array
|
||||
{
|
||||
return VarSetTypeMain::setArrayMain($val, $default, true);
|
||||
return SetVarTypeMain::setArrayMain($val, $default, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,7 +110,7 @@ class VarSetTypeNull extends Extends\VarSetTypeMain
|
||||
*/
|
||||
public static function setBool(mixed $val, ?bool $default = null): ?bool
|
||||
{
|
||||
return VarSetTypeMain::setBoolMain($val, $default, true);
|
||||
return SetVarTypeMain::setBoolMain($val, $default, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +123,7 @@ class VarSetTypeNull extends Extends\VarSetTypeMain
|
||||
{
|
||||
// note that the default value here is irrelevant, we return null
|
||||
// on unsetable string var
|
||||
return VarSetTypeMain::makeBoolMain($val, false, true);
|
||||
return SetVarTypeMain::makeBoolMain($val, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user