removed unused variable
Refactored, tested using PHPUnit Mock.