Library/Documentation.php
private function findThemeDirectory($themeConfig, $path = null)
    {
        // check if there are additional theme paths in the config
        $themeDirectoriesConfig = $this->config->get('theme-directories', 'api');
        if ($themeDirectoriesConfig) {
            if (\is_array($themeDirectoriesConfig)) {
                $themesDirectories = $themeDirectoriesConfig;
            } else {
                throw new InvalidArgumentException("Invalid value for theme config 'theme-directories'");
            }
        } else {
            $themesDirectories = [];
        }

        $themesDirectories[] = $this->templatesPath.'/Api/themes';
        $this->themesDirectories = $themesDirectories;

        // check if the path was set from the command
        if (!empty($path)) {
            if (file_exists($path) && is_dir($path)) {
                return $path;
            } else {
                throw new InvalidArgumentException(
                    sprintf(
                        "Invalid value for option 'theme-path': the theme '%s' was not found or is not a valid theme.",
                        $path
                    )
                );
            }
        }

        if (!isset($themeConfig['name']) || !$themeConfig['name']) {
            throw new ConfigException(
                'There is no theme neither in the the theme config nor as a command line argument'
            );
        }

        return $this->findThemePathByName($themeConfig['name']);
    }
private function findThemeDirectory($themeConfig, $path = null)
    {
        // check if there are additional theme paths in the config
        $themeDirectoriesConfig = $this->config->get('theme-directories', 'api');
        if ($themeDirectoriesConfig) {
            if (\is_array($themeDirectoriesConfig)) {
                $themesDirectories = $themeDirectoriesConfig;
            } else {
                throw new InvalidArgumentException("Invalid value for theme config 'theme-directories'");
            }
        } else {
            $themesDirectories = [];
        }

        $themesDirectories[] = $this->templatesPath.'/Api/themes';
        $this->themesDirectories = $themesDirectories;

        // check if the path was set from the command
        if (!empty($path)) {
            if (file_exists($path) && is_dir($path)) {
                return $path;
            } else {
                throw new InvalidArgumentException(
                    sprintf(
                        "Invalid value for option 'theme-path': the theme '%s' was not found or is not a valid theme.",
                        $path
                    )
                );
            }
        }

        if (!isset($themeConfig['name']) || !$themeConfig['name']) {
            throw new ConfigException(
                'There is no theme neither in the the theme config nor as a command line argument'
            );
        }

        return $this->findThemePathByName($themeConfig['name']);
    }
private function findThemeDirectory ( $ themeConfig , $ path = null ) { // check if there are additional theme paths in the config $ themeDirectoriesConfig = $ this -> config -> get ( 'theme-directories' , 'api' ) ; if ( $ themeDirectoriesConfig ) { if ( \ is_array ( $ themeDirectoriesConfig ) ) { $ themesDirectories = $ themeDirectoriesConfig ; } else { throw new InvalidArgumentException ( "Invalid value for theme config 'theme-directories'" ) ; } } else { $ themesDirectories = [ ] ; } $ themesDirectories [ ] = $ this -> templatesPath . '/Api/themes' ; $ this -> themesDirectories = $ themesDirectories ; // check if the path was set from the command if ( ! empty ( $ path ) ) { if ( file_exists ( $ path ) && is_dir ( $ path ) ) { return $ path ; } else { throw new InvalidArgumentException ( sprintf ( "Invalid value for option 'theme-path': the theme '%s' was not found or is not a valid theme." , $ path ) ) ; } } if ( ! isset ( $ themeConfig [ 'name' ] ) || ! $ themeConfig [ 'name' ] ) { throw new ConfigException ( 'There is no theme neither in the the theme config nor as a command line argument' ) ; } return $ this -> findThemePathByName ( $ themeConfig [ 'name' ] ) ; }
Find the theme directory depending on the command  line options and the config.

theme directory is checked in this order :
=> check if the command line argument --theme-path was given
=> if not ; find the different theme directories on the config $config['api']['theme-directories']
search the theme from the name ($config['api']['theme']['name'] in the theme directories,
if nothing was found, we look in the zephir install dir default themes (templates/Api/themes)

@param array       $themeConfig
@param string|null $path

@throws InvalidArgumentException
@throws ConfigException

@return string|null
Find the theme directory depending on the command line options and the config .