Liip\RMT\Config\Handler::validateRootElements PHP Method

validateRootElements() protected method

protected validateRootElements ( $config )
    protected function validateRootElements($config)
    {
        // Check for extra keys
        $extraKeys = array_diff(array_keys($config), array_keys($this->getDefaultConfig()));
        if (count($extraKeys) > 0) {
            $extraKeys = implode(', ', $extraKeys);
            $validKeys = implode(', ', array_keys($this->getDefaultConfig()));
            throw new Exception('key(s) [' . $extraKeys . '] are invalid, must be [' . $validKeys . ']');
        }
        // Check for missing keys
        foreach (array('version-generator', 'version-persister') as $mandatoryParam) {
            if ($config[$mandatoryParam] == null) {
                throw new Exception("[{$mandatoryParam}] should be defined");
            }
        }
    }