Normalize `$type` so you don't end up with `array('app', 'App', 'APp', 'aPp', 'APP')`. :)

This should do:
```php
$type = strtolower($type);
if (!in_array($type, array('app', 'core'))) {
```