for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* File was created 29.05.2015 21:06
*
* @author Karsten J. Gerber <[email protected]>
*/
namespace PeekAndPoke\Component\Psi\Psi;
use PeekAndPoke\Component\Psi\Functions\ParameterizedUnaryFunction;
* IsInstanceOf checks if the input is of a certain type.
* @see ParameterizedUnaryFunction
* @see IsInstanceOfIsNotInstanceOfTest
class IsInstanceOf extends ParameterizedUnaryFunction
{
* @param mixed $input
* @return bool
public function __invoke($input)
$val = $this->getValue();
return $this->isApplicable($val) && ($input instanceof $val);
}
* @param $val
private function isApplicable($val)
return is_string($val) || is_object($val);