mirror of
https://github.com/Karaka-Management/Resources.git
synced 2026-01-10 21:08:41 +00:00
30 lines
468 B
PHP
Executable File
30 lines
468 B
PHP
Executable File
<?php
|
|
|
|
namespace DeepCopy\TypeMatcher;
|
|
|
|
class TypeMatcher
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
private $type;
|
|
|
|
/**
|
|
* @param string $type
|
|
*/
|
|
public function __construct($type)
|
|
{
|
|
$this->type = $type;
|
|
}
|
|
|
|
/**
|
|
* @param mixed $element
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function matches($element)
|
|
{
|
|
return is_object($element) ? is_a($element, $this->type) : gettype($element) === $this->type;
|
|
}
|
|
}
|