Added hasName method

Added the method requested in Issue #4784.
Should say `@param  string  $name`.