src/WMS/Library/BusinessRulesEngine/Loader/YamlFileLoader.php
protected function validate($config, $name, $path)
    {
        if (!is_array($config)) {
            throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
        }
        if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {
            throw new \InvalidArgumentException(sprintf(
                'The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".',
                $path,
                $name,
                implode('", "', $extraKeys),
                implode('", "', self::$availableKeys)
            ));
        }
        if (isset($config['resource']) && isset($config['expression'])) {
            throw new \InvalidArgumentException(sprintf(
                'The business rule file "%s" must not specify both the "resource" key and the "expression" key for "%s". Choose between an import and a rule definition.',
                $path,
                $name
            ));
        }
        if (!isset($config['resource']) && isset($config['type'])) {
            throw new \InvalidArgumentException(sprintf(
                'The "type" key for the rule definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.',
                $name,
                $path
            ));
        }
        if (!isset($config['resource']) && !isset($config['expression'])) {
            throw new \InvalidArgumentException(sprintf(
                'You must define an "expression" for the rule "%s" in file "%s".',
                $name,
                $path
            ));
        }
        if (isset($config['tags']) && !is_array($config['tags'])) {
            throw new \InvalidArgumentException(sprintf(
                'The "tags" key for the rule definition "%s" in "%s" contains unsupported data. Each tag defined must be an array with at least the "name" element set to a string.',
                $name,
                $path
            ));
        } elseif (isset($config['tags'])) {
            foreach ($config['tags'] as $tag) {
                if (!isset($tag['name'])) {
                    throw new \InvalidArgumentException(sprintf(
                        'The "tags" key for the rule definition "%s" in "%s" contains unsupported data. Each tag defined must be an array with at least the "name" element set to a string.',
                        $name,
                        $path
                    ));
                }
            }
        }
    }
protected function validate($config, $name, $path)
    {
        if (!is_array($config)) {
            throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
        }
        if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {
            throw new \InvalidArgumentException(sprintf(
                'The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".',
                $path,
                $name,
                implode('", "', $extraKeys),
                implode('", "', self::$availableKeys)
            ));
        }
        if (isset($config['resource']) && isset($config['expression'])) {
            throw new \InvalidArgumentException(sprintf(
                'The business rule file "%s" must not specify both the "resource" key and the "expression" key for "%s". Choose between an import and a rule definition.',
                $path,
                $name
            ));
        }
        if (!isset($config['resource']) && isset($config['type'])) {
            throw new \InvalidArgumentException(sprintf(
                'The "type" key for the rule definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.',
                $name,
                $path
            ));
        }
        if (!isset($config['resource']) && !isset($config['expression'])) {
            throw new \InvalidArgumentException(sprintf(
                'You must define an "expression" for the rule "%s" in file "%s".',
                $name,
                $path
            ));
        }
        if (isset($config['tags']) && !is_array($config['tags'])) {
            throw new \InvalidArgumentException(sprintf(
                'The "tags" key for the rule definition "%s" in "%s" contains unsupported data. Each tag defined must be an array with at least the "name" element set to a string.',
                $name,
                $path
            ));
        } elseif (isset($config['tags'])) {
            foreach ($config['tags'] as $tag) {
                if (!isset($tag['name'])) {
                    throw new \InvalidArgumentException(sprintf(
                        'The "tags" key for the rule definition "%s" in "%s" contains unsupported data. Each tag defined must be an array with at least the "name" element set to a string.',
                        $name,
                        $path
                    ));
                }
            }
        }
    }
Validates the rule configuration.

@param array  $config A resource config
@param string $name   The config key
@param string $path   The loaded file path

@throws \InvalidArgumentException If one of the provided config keys is not supported,
something is missing or the combination is nonsense