/
qK1e
/
php-method-overloading
Обзор
Документация
Войти
/
qK1e
/
php-method-overloading
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.9
src/PassedArgument/BasicComparator.php
29 строк
723 B
Pavlovich
Version 0.9, First fit algorithm
25 май 2024, 22:24
25 май 2024, 22:24
361c891
Код
Авторство
О чём код?
<?php namespace qK1e\Overloading\PassedArgument; class BasicComparator implements IComparator { private string $passedType; public function __construct(int|float|string|bool $value) { $this->passedType = gettype($value); } public function sameType(\ReflectionNamedType $type): bool { if ($this->passedType === "integer") { return $type->getName() === "int"; } if ($this->passedType === "double") { return $type->getName() === "float"; } if ($this->passedType === "boolean") { return $type->getName() === "bool"; } return $this->passedType === $type->getName(); } }