Create new Scope from the configuration string.

@param \RomanPitak\Nginx\Config\Text $configString
@return Scope
@throws Exception
685
public static function fromString(Text $configString)
    {
        $scope = new Scope();
        while (false === $configString->eof()) {

            if (true === $configString->isEmptyLine()) {
                $scope->addPrintable(EmptyLine::fromString($configString));
            }

            $char = $configString->getChar();

            if ('#' === $char) {
                $scope->addPrintable(Comment::fromString($configString));
                continue;
            }

            if (('a' <= $char) && ('z' >= $char)) {
                $scope->addDirective(Directive::fromString($configString));
                continue;
            }

            if ('}' === $configString->getChar()) {
                break;
            }

            $configString->inc();
        }
        return $scope;
    }
164109
public static function fromString(string $string): self
    {
        $stringHeaders = explode(SourceInterface::DELIMETER_HEADER, $string);
        $headers       = [];

        foreach ($stringHeaders as $value) {
            [$name, $valueRow] = explode(SourceInterface::DELIMETER_HEADER_ROW, $value);

            $headers[$name] = $valueRow;
        }

        return new self($headers);
    }
1191276
public static function createFromConnectionString($connectionString)
    {
        $tokenizedSettings = self::parseAndValidateKeys($connectionString);

        $matchedSpecs = self::matchedSpecification(
            $tokenizedSettings,
            self::allRequired(
                self::$_subscriptionIdSetting,
                self::$_certificatePathSetting
            ),
            self::optional(
                self::$_endpointSetting
            )
        );
        if ($matchedSpecs) {
            $endpointUri = Utilities::tryGetValueInsensitive(
                Resources::SERVICE_MANAGEMENT_ENDPOINT_NAME,
                $tokenizedSettings,
                Resources::SERVICE_MANAGEMENT_URL
            );
            $subscriptionId = Utilities::tryGetValueInsensitive(
                Resources::SUBSCRIPTION_ID_NAME,
                $tokenizedSettings
            );
            $certificatePath = Utilities::tryGetValueInsensitive(
                Resources::CERTIFICATE_PATH_NAME,
                $tokenizedSettings
            );

            return new self(
                $subscriptionId,
                $endpointUri,
                $certificatePath
            );
        }

        self::noMatch($connectionString);
        return null;
    }
1136378
public static function fromString(string $fieldListString, string $delimiter = ',') : BigramPhraseFields
    {
        return self::initializeFromString($fieldListString, $delimiter);
    }
317615
static public function setConfig($config)
        {
            if (!is_array($config)) {
                throw new Exception("Config must be an array.");
            }

            foreach ($config as $k => $v) {
                self::$_config[$k] = $v;
            }
        }
965157
public function scope(string $scope, ...$arguments)
	{
		$this->model->{Str::underscored2camel($scope) . 'Scope'}(...array_merge([$this], $arguments));

		return $this;
	}
402539
public static function fromString(string $string): self
    {
        if (1 !== \preg_match('/^( *|\t+)$/', $string)) {
            throw Exception\InvalidIndentStringException::fromString($string);
        }

        return new self($string);
    }
563414
public static function configure($config)
    {
        if (is_null(static::$instance)) {
            static::$instance = new self();

            static::$name = $config['default'];

            static::$config = $config;
        }

        return static::$instance;
    }
1200860
public function parseString($config)
    {
        // Handle PHP start tag
        $config = trim($config);
        if (substr($config, 0, 2) === '<?') {
            $config = '?>' . $config;
        }

        // Eval the string, if it throws an exception, rethrow it
        try {
            $data = $this->isolate($config);
        } catch (Exception $exception) {
            throw new ParseException(
                [
                    'message'   => 'PHP string threw an exception',
                    'exception' => $exception,
                ]
            );
        }

        // Complete parsing
        return (array)$this->parse($data);
    }
788535
public static function create($name, array $config = [], $title = null){
        $handler = call_user_func([MonologHandlerFactory::class,$name], $config, $title);
        
        // Keep newline characters
        $format = ['fleephook', 'hipchat', 'mail', 'mailgun', 'pushover', 'raven', 'slack'];
        
        if(in_array($name, $format)) {
            $handler->setFormatter(new LineFormatter(null, null, true));
        }

        if ($handler instanceof \Monolog\Handler\NativeMailerHandler) {
            $handler->setContentType('text/html');
        }

        return $handler;
    }
1179942
public static function fromJson(string $jsonString): ApiContext
    {
        $apiContext = new static();
        $contextJson = \GuzzleHttp\json_decode($jsonString, true);
        $apiContext->environmentType = new BunqEnumApiEnvironmentType($contextJson[self::FIELD_ENVIRONMENT_TYPE]);
        $apiContext->apiKey = $contextJson[self::FIELD_API_KEY];
        $apiContext->proxyUrl = static::restoreProxyUrl($contextJson);
        $apiContext->installationContext = InstallationContext::restore($contextJson[self::FIELD_INSTALLATION_CONTEXT]);
        $apiContext->sessionContext = SessionContext::restore($contextJson[self::FIELD_SESSION_CONTEXT]);

        return $apiContext;
    }
232995
@Override
	public Object putString(Scope scope, String key, String value) {
		return getScopeMap(scope).put(key, value);
	}
138633
public static function fromString(string $string): self
    {
        if (1 !== \preg_match('/^(?>\r\n|\n|\r)$/', $string)) {
            throw Exception\InvalidNewLineStringException::fromString($string);
        }

        return new self($string);
    }
1259799
protected function setStringIntoTag($sString, $sTag, $features = null)
    {
        return '<' . $sTag . $this->buildAttributesForTag($features) . '>' . $sString . '</' . $sTag . '>';
    }
1147693
public static function configure($config = [])
    {
        if (empty(static::$config)) {
            static::$config = $config;
        }

        if (!in_array($config['driver'], ["smtp", "mail"])) {
            throw new MailException("The type is not known.", E_USER_ERROR);
        }

        if ($config['driver'] == "mail") {
            if (!static::$instance instanceof Native) {
                static::$instance = new Native($config['mail']);
            }
        } else {
            if (!static::$instance instanceof Smtp) {
                static::$instance = new Smtp($config['smtp']);
            }
        }

        return static::$instance;
    }
382802
public static function createFromString($uri = ''): self
    {
        $components = UriString::parse($uri);

        return new self(
            $components['scheme'],
            $components['user'],
            $components['pass'],
            $components['host'],
            $components['port'],
            $components['path'],
            $components['query'],
            $components['fragment']
        );
    }
1182536
static function parse_string( $s ){
		if( $s == '' ){
			throw new Exception('Cannot parse empty string');
		}
		// instantiate self
		$Parser = new BNFParser;
		// perform external tokenizing on string input 
		$tokens = bnf_tokenize( $s );
		return $Parser->parse( $tokens );
	}