diff options
author | Phie <phie@phie.ovh> | 2018-08-21 18:39:12 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2018-08-21 18:39:12 +0300 |
commit | 7d24cc0120859fc4e46b301c08effc97ddfbb1bb (patch) | |
tree | 94b5b52074022ceccd4c91073f217feaec38ca40 /vendor/myclabs/deep-copy/src/DeepCopy/TypeMatcher/TypeMatcher.php |
first commit for Carnet NC server
Diffstat (limited to 'vendor/myclabs/deep-copy/src/DeepCopy/TypeMatcher/TypeMatcher.php')
-rw-r--r-- | vendor/myclabs/deep-copy/src/DeepCopy/TypeMatcher/TypeMatcher.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/vendor/myclabs/deep-copy/src/DeepCopy/TypeMatcher/TypeMatcher.php b/vendor/myclabs/deep-copy/src/DeepCopy/TypeMatcher/TypeMatcher.php new file mode 100644 index 0000000..a563cb2 --- /dev/null +++ b/vendor/myclabs/deep-copy/src/DeepCopy/TypeMatcher/TypeMatcher.php @@ -0,0 +1,29 @@ +<?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; + } +} |