protected function filterBlocks(string $condition, array $blocks)
    {
        if (empty($condition)) {
            return $blocks;
        }

        $conditions = [];
        foreach (explode(';', $condition) as $condition) {
            if (strpos($condition, ':') === false) {
                //Invalid
                continue;
            }

            list($name, $value) = explode(":", $condition);
            $conditions[$name] = $value;
        }

        $result = $blocks;
        if (isset($conditions['prefix'])) {
            $result = [];
            foreach ($blocks as $name => $value) {
                if (strpos($name, $conditions['prefix']) === 0) {
                    //Prefix plus "-" sign
                    $result[substr($name, strlen($conditions['prefix']) + 1)] = $value;
                }
            }
        }

        if (isset($conditions['include'])) {
            $include = explode(',', $conditions['include']);

            foreach ($blocks as $name => $value) {
                if (!in_array($name, $include)) {
                    unset($result[$name]);
                }
            }
        }

        if (isset($conditions['exclude'])) {
            $exclude = explode(',', $conditions['exclude']);

            foreach ($blocks as $name => $value) {
                if (in_array($name, $exclude)) {
                    unset($result[$name]);
                }

                foreach ($exclude as $pattern) {
                    if (strpos($pattern, '*') === false) {
                        //Not pattern
                        continue;
                    }

                    $pattern = '/^' . str_replace('*', '.+', $pattern) . '/i';

                    if (preg_match($pattern, $name)) {
                        unset($result[$name]);
                    }
                }
            }
        }

        return $result;
    }