public static function resolveLanguagesPath(\WP_Theme $theme)
 {
     // as taken from wp-includes/class-wp-theme.php:1114
     $path = $theme->get_stylesheet_directory();
     if ($domainpath = $theme->get('DomainPath')) {
         $path .= $domainpath;
     } else {
         $path .= '/languages';
     }
     return $path;
 }
    /**
     * Runs the actual child theme creation functionality
     *
     * @global WP_Filesystem_Base $wp_filesystem
     *
     * @param string              $new_theme
     * @param WP_Theme            $template
     *
     * @throws Exception If the global filesystem object isn't available
     */
    public static function procreate($new_theme, WP_Theme $template)
    {
        /** @var WP_Filesystem_Base $wp_filesystem */
        global $wp_filesystem;
        if (!$wp_filesystem instanceof WP_Filesystem_Base) {
            if (!WP_Filesystem()) {
                throw new Exception(esc_html__('Could not access the filesystem!', 'child-themify'));
            }
        }
        $oldStylesheet = $template->get_stylesheet();
        $templateDirectory = untrailingslashit($template->get_stylesheet_directory());
        $oldName = $template->name;
        $new_theme_directory = trailingslashit(get_theme_root()) . sanitize_file_name(strtolower($new_theme));
        $wp_filesystem->mkdir($new_theme_directory);
        $newStylesheet = trailingslashit($new_theme_directory) . 'style.css';
        $wp_filesystem->touch($newStylesheet);
        $stylesheetContents = <<<EOF
/*
Theme Name: {$new_theme}
Version: 1.0
Description: A child theme of {$oldName}
Template: {$oldStylesheet}
*/

@import url("../{$oldStylesheet}/style.css");

EOF;
        $wp_filesystem->put_contents($newStylesheet, $stylesheetContents);
        if (file_exists("{$templateDirectory}/screenshot.png")) {
            $wp_filesystem->copy("{$templateDirectory}/screenshot.png", "{$new_theme_directory}/screenshot.png");
        }
        add_settings_error('', 'child-themify', esc_html__('Your child theme was created successfully.', 'child-themify'), 'updated');
    }
 private function loadFile($file, \WP_Theme $theme)
 {
     if (!is_file($file) || !preg_match('/\\.ya?ml$/', $file)) {
         return;
     }
     $theme_dir = $theme->get_stylesheet_directory();
     $theme_uri = $theme->get_stylesheet_directory_uri();
     $components_uri = WP_CONTENT_URL . '/components';
     ob_start();
     include $file;
     $content = ob_get_clean();
     try {
         $config = Yaml::parse($content);
         self::array_overwrite($this->configs, $config);
     } catch (ParseException $e) {
         trigger_error("Error while parsing {$file}: " . $e->getMessage(), E_USER_WARNING);
     }
 }