private function checkMageMode($sitePath)
    {
        if (null !== $this->mageMode) {
            // We have already figure out mode, no need to check it again
            return;
        }
        if (!file_exists($sitePath . '/index.php')) {
            $this->mageMode = 'production'; // Can't use developer mode without index.php in project root
            return;
        }
        $mageConfig = [];
        if (file_exists($sitePath . '/app/etc/env.php')) {
            $mageConfig = require $sitePath . '/app/etc/env.php';
        }
        if (array_key_exists('MAGE_MODE', $mageConfig)) {
            $this->mageMode = $mageConfig['MAGE_MODE'];
        }
    }