Deduplicate dependency checks

Some code that I also used for https://github.com/owncloud/administration/pull/11
This construction is rather weird. It is hard to understand and for larger arrays also inefficient. You should really have three loops instead, the first one being
```
foreach ($dependencies['classes'] as $class => $module) {
    if (class_exists($requirement)) {
        $missingDependencies[] = $module;
    }
}
```