Instead of passing the `$typeGetter` variable, it would be either better to pass the array with the all css/js files directly to the method or create an array where you map the extension to the getter - Something like this:

```php
private $typeGetters = array('css' => 'getStyles', 'js' => 'getScripts');

protected function createSingleFormula(Package $package, $nestDependencies, $typeExtension)
{
//...
    $typeGetter = $this->typeGetters[$typeExtension];
    $package->{$typeGetter}->toArray();
//...
}
```