protected function getCommands($filename, $type)
    {
        $commands = $this->config->get('availableCommands');

        if (!$type || !isset($commands[$type])) {
            return array();
        }

        $command = array();

        foreach ((array)$this->config->get('enabledCommands') as $commandType) {
            if (isset($commands[$type][$commandType])) {
                $command[] = sprintf(
                    $commands[$type][$commandType],
                    rtrim($this->config->get('binDirectory'), '/'),
                    escapeshellarg($filename),
                    $this->config->get('optimisingQuality')
                );
            }
        }

        return $command;
    }