protected function scaffold($scaffold, $args = [], $options = [])
    {
        $this->init_wordpress();
        Snap::create_container();
        Snap::init_config();
        $original = $this->scaffolding_dir . "{$scaffold}.txt";

        if (\file_exists($original)) {
            $content = \file_get_contents($original);

            if (!empty($options)) {
                foreach ($options as $option => $value) {
                    if ($value !== null) {
                        \preg_match_all("/%IF\|$option%([^%]*)%END%/m", $content, $matches);

                        if (!empty($matches)) {
                            $content = \str_replace(
                                $matches[0],
                                \str_replace($option, $value, $matches[1]),
                                $content
                            );
                        }
                    }
                }
            }

            \preg_match_all("/%IF[^%]*%([^%]*)%END%/m", $content, $matches);

            // Clean up any IF tags.
            if (!empty($matches)) {
                foreach ($matches as $match) {
                    if (!empty($match)) {
                        $content = \str_replace($match[0], '', $content);
                    }
                }
            }

            $args = $this->parse_args($args);
            $target = $this->get_destination($scaffold, $args);

            // Substitute arguments.
            $content = \str_replace(
                \array_keys($args),
                \array_values($args),
                $content
            );

            if (\file_put_contents($target, $content) !== false) {
                return true;
            }
        }

        return false;
    }