Replace function is_file() verification to helper method detectPath()

small refactory to fix issue #25