コード例 #1
0
 /**
  * Check if the constraint is met.
  *
  * @param mixed $value
  * @param array $context
  *
  * @throws UnknownTypeException
  * @return mixed
  */
 public function check($value, array $context = [])
 {
     $hound = new TypeHound($value);
     return $this->expectedType === $hound->resolve();
 }
コード例 #2
0
ファイル: TypeHound.php プロジェクト: sellerlabs/nucleus
 /**
  * Check that the type matches.
  *
  * @param TypeHound $other
  *
  * @throws UnknownTypeException
  * @return bool
  */
 public function matches(TypeHound $other)
 {
     return $this->resolve() === $other->resolve();
 }