src/Theme.php
private function validateTheme(string $theme)
    {
        if (!file_exists($this->themePath . '/' . $theme . '/info.json')) {
            throw new InvalidException('The theme (`' . $theme . '`) is missing the configuration file (`info.json`).');
        }

        try {
            $themeInfo = $this->getThemeInfo($theme);
        } catch (\Throwable $e) {
            throw new InvalidException('The theme\'s (`' . $theme . '`) configuration file (`info.json`) does not contain valid json or could not be read.');
        }

        foreach (self::CONFIG_REQUIRED_FIELDS as $requiredField) {
            if (!array_key_exists($requiredField, $themeInfo)) {
                throw new InvalidException('The theme\'s (`' . $theme . '`) configuration file (`info.json`) is missing the required theme ' . $requiredField . ' property.');
            }
        }
    }
private function validateTheme(string $theme)
    {
        if (!file_exists($this->themePath . '/' . $theme . '/info.json')) {
            throw new InvalidException('The theme (`' . $theme . '`) is missing the configuration file (`info.json`).');
        }

        try {
            $themeInfo = $this->getThemeInfo($theme);
        } catch (\Throwable $e) {
            throw new InvalidException('The theme\'s (`' . $theme . '`) configuration file (`info.json`) does not contain valid json or could not be read.');
        }

        foreach (self::CONFIG_REQUIRED_FIELDS as $requiredField) {
            if (!array_key_exists($requiredField, $themeInfo)) {
                throw new InvalidException('The theme\'s (`' . $theme . '`) configuration file (`info.json`) is missing the required theme ' . $requiredField . ' property.');
            }
        }
    }
private function validateTheme ( string $ theme ) { if ( ! file_exists ( $ this -> themePath . '/' . $ theme . '/info.json' ) ) { throw new InvalidException ( 'The theme (`' . $ theme . '`) is missing the configuration file (`info.json`).' ) ; } try { $ themeInfo = $ this -> getThemeInfo ( $ theme ) ; } catch ( \ Throwable $ e ) { throw new InvalidException ( 'The theme\'s (`' . $ theme . '`) configuration file (`info.json`) does not contain valid json or could not be read.' ) ; } foreach ( self :: CONFIG_REQUIRED_FIELDS as $ requiredField ) { if ( ! array_key_exists ( $ requiredField , $ themeInfo ) ) { throw new InvalidException ( 'The theme\'s (`' . $ theme . '`) configuration file (`info.json`) is missing the required theme ' . $ requiredField . ' property.' ) ; } } }
Checks whether the layout of the theme directory is valid

@param string $theme The name of the theme

@throws \CodeCollab\Theme\InvalidException  When the theme is not valid
Checks whether the layout of the theme directory is valid