Man sentenced to three years for slamming door on officer's foot