protected static function validateString($test, $source, $argument = "Argument") { if (is_object($test) && !method_exists($test, '__toString')) { throw new InvalidArgumentException("{$argument} to {$source} must be a string"); } }