undefined variable $method