Update Detector.php

Big improvement in class's __construct() method and small improvement in other methods. There is no syntax errors, but I reccomend to write to write tests for it