protected function replaceSubparts($templateCode)
    {
        $template = $this;
        return preg_replace_callback(
            self::SUBPART_PATTERN,
            function (array $matches) use ($template) {
                return $template->getSubpart($matches[1]);
            },
            $templateCode
        );
    }