<?php

namespace YOOtheme\Theme\Wordpress\Listener;

use YOOtheme\Path;

class DisableAutoUpdate
{
    /**
     * @link https://developer.wordpress.org/reference/hooks/wp_prepare_themes_for_js/
     */
    public static function handle($prepared_themes)
    {
        $name = Path::basename('~theme');

        if (!empty($prepared_themes[$name]['autoupdate']['supported'])) {
            $prepared_themes[$name]['autoupdate']['supported'] = false;
        }

        return $prepared_themes;
    }
}
