northox/stupid-password

Refactor Check Disable option

Opened this issue · 0 comments

An array of checks should be created and loop trough. When a check must be disabled, simply removing it from the array will do the trick.

This will remove all of this duplication:

if(!in_array('length', $this->options['disable']))
    $this->length();
if(!in_array('numeric', $this->options['disable']))
    $this->numeric();
if(!in_array('special', $this->options['disable']))
    $this->special();
if(!in_array('onlynumeric', $this->options['disable']))
    $this->onlynumeric();