Library/Documentation.php
private function prepareThemeOptions($themeConfig, $options = null)
    {
        $parsedOptions = null;
        if (!empty($options)) {
            if ('{' == $options[0]) {
                $parsedOptions = json_decode(trim($options), true);
                if (!$parsedOptions || !\is_array($parsedOptions)) {
                    throw new Exception("Unable to parse json from 'theme-options' argument");
                }
            } else {
                if (file_exists($options)) {
                    $unparsed = file_get_contents($options);
                    $parsedOptions = json_decode($unparsed, true);
                    if (!$parsedOptions || !\is_array($parsedOptions)) {
                        throw new Exception(
                            sprintf("Unable to parse json from the file '%s'", $options)
                        );
                    }
                } else {
                    throw new Exception(sprintf("Unable to find file '%s'", $options));
                }
            }
        }

        if (\is_array($parsedOptions)) {
            $options = array_merge($themeConfig['options'], $parsedOptions);
        } else {
            $options = $themeConfig['options'];
        }

        return $options;
    }
private function prepareThemeOptions($themeConfig, $options = null)
    {
        $parsedOptions = null;
        if (!empty($options)) {
            if ('{' == $options[0]) {
                $parsedOptions = json_decode(trim($options), true);
                if (!$parsedOptions || !\is_array($parsedOptions)) {
                    throw new Exception("Unable to parse json from 'theme-options' argument");
                }
            } else {
                if (file_exists($options)) {
                    $unparsed = file_get_contents($options);
                    $parsedOptions = json_decode($unparsed, true);
                    if (!$parsedOptions || !\is_array($parsedOptions)) {
                        throw new Exception(
                            sprintf("Unable to parse json from the file '%s'", $options)
                        );
                    }
                } else {
                    throw new Exception(sprintf("Unable to find file '%s'", $options));
                }
            }
        }

        if (\is_array($parsedOptions)) {
            $options = array_merge($themeConfig['options'], $parsedOptions);
        } else {
            $options = $themeConfig['options'];
        }

        return $options;
    }
private function prepareThemeOptions ( $ themeConfig , $ options = null ) { $ parsedOptions = null ; if ( ! empty ( $ options ) ) { if ( '{' == $ options [ 0 ] ) { $ parsedOptions = json_decode ( trim ( $ options ) , true ) ; if ( ! $ parsedOptions || ! \ is_array ( $ parsedOptions ) ) { throw new Exception ( "Unable to parse json from 'theme-options' argument" ) ; } } else { if ( file_exists ( $ options ) ) { $ unparsed = file_get_contents ( $ options ) ; $ parsedOptions = json_decode ( $ unparsed , true ) ; if ( ! $ parsedOptions || ! \ is_array ( $ parsedOptions ) ) { throw new Exception ( sprintf ( "Unable to parse json from the file '%s'" , $ options ) ) ; } } else { throw new Exception ( sprintf ( "Unable to find file '%s'" , $ options ) ) ; } } } if ( \ is_array ( $ parsedOptions ) ) { $ options = array_merge ( $ themeConfig [ 'options' ] , $ parsedOptions ) ; } else { $ options = $ themeConfig [ 'options' ] ; } return $ options ; }
Prepare the options by merging the one in the project config with the one in the command line arg "theme-options".

command line arg "theme-options" can be either a path to a json file containing the options or a raw json string

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

@throws Exception

@return array
Prepare the options by merging the one in the project config with the one in the command line arg theme - options .