src/ThemeManager/Starter.php
private function addTheme(&$themes, &$path, &$file, array $requiredFields = [])
    {
        try {
            $isYaml = (stristr($file, '.yaml'));

            return $themes[$path] = new Theme($path, $requiredFields, $isYaml, $this->isSecondaryLocation);
        } catch (NoThemeData $error) {
            if ($this->exceptionOnInvalid === false && $error->getTheme()) {
                return $themes[$path] = $error->getTheme();
            }

            throw $error;
        }
    }
private function addTheme(&$themes, &$path, &$file, array $requiredFields = [])
    {
        try {
            $isYaml = (stristr($file, '.yaml'));

            return $themes[$path] = new Theme($path, $requiredFields, $isYaml, $this->isSecondaryLocation);
        } catch (NoThemeData $error) {
            if ($this->exceptionOnInvalid === false && $error->getTheme()) {
                return $themes[$path] = $error->getTheme();
            }

            throw $error;
        }
    }
@param       $themes
@param       $path
@param       $file
@param array $requiredFields

@throws \ThemeManager\Exceptions\EmptyThemeName - When themes name is empty
@throws \ThemeManager\Exceptions\NoThemeName - When themes name isn't defined
@throws \ThemeManager\Exceptions\NoThemeData - When theme.yml is empty

@return Theme - When themes name is empty