/*
HELPER: Get GET parameter or throw an exception

@param    string   Parameter name to search for
@param    string   Custom exception message (optional)
@return   mixed    Parameter value
556042
protected function getGetParamOrException ($name, $customExceptionMsg=null)
    {
        $value = $this->getGetParam($name);

        if (NULL === $value) {
            $eMsg = ($customExceptionMsg ? $customExceptionMsg : "URL GET parameter not found: $name");
            throw new Exception($eMsg);
        }

        return $value;
    }
359480
public function getArgument($name, $mode = self::MODE_THROW_EXCEPTION_ON_ERROR)
    {
        $this->checkGetMode($mode, __METHOD__);

        if (false === $this->hasArgument($name)) {
            if ($mode === static::MODE_THROW_EXCEPTION_ON_ERROR) {
                throw new InvalidNameException(sprintf("The argument name '%s' doesn't exist", $name));
            } elseif ($mode === static::MODE_RETURN_BOOLEAN) {
                return false;
            } elseif ($mode === static::MODE_RETURN_NULL) {
                return;
            }
        }

        return $this->collection[$name];
    }
85238
public function getOption(string $name)
    {
        if (!array_key_exists($name, $this->options)) {
            throw new Exception('Invalid option "'.$name.'" for field "'.$this->name.'"');
        }

        return $this->options[$name];
    }
1332218
protected function getParamFromRequest($name)
    {
        if (null !== $value = $this->requestStack->getCurrentRequest()->get($name)) {
            return $value;
        }

        if ((null !== $request = $this->requestStack->getParentRequest()) && null !== $value = $request->get($name)) {
            return $value;
        }

        if ((null !== $request = $this->requestStack->getMasterRequest()) && null !== $value = $request->get($name)) {
            return $value;
        }

        return null;
    }
748559
protected function get($name)
    {
        if ($this->modified === null) {
            $this->load();
        }

        if (false === array_key_exists($name, $this->properties)) {
            throw new Exception('Unknown property "' . $name . '"');
        }

        return $this->resolve($this->properties[$name], $name);
    }
1181495
protected String getParameterOrException(Map<String, String> parameters, String paramName)
        throws TransformationOperationException {
        return getParameter(parameters, paramName, true, null);
    }
9869
public function serverGetByName($name)
  {
    foreach($this->serverList() as $server)
    {
      if($server["virtualserver_name"] == $name) return $server;
    }

    throw new Exception("invalid serverID", 0x400);
  }
30219
private Parameter getParameterByName(String name)
    {
        if (getParameters() != null)
        {
            for (Parameter p : parameters)
            {
                if (name.equals(p.getName()))
                {
                    return p;
                }
            }
        }

        return null;
    }
489407
public function getGetParameter($name)
    {
        if (!$this->hasGetParameter($name)) {
            throw new \InvalidArgumentException(sprintf('The GET request parameter "%s" does not exist.', $name));
        }

        return $this->getParameters[rawurlencode($name)];
    }
1031701
public function getIntParam($name, $default = null, $optional = false)
    {
        $value = $this->getParam($name, $default, $optional);
        if ($value !== null) {
            if (!preg_match('/^\-?\d*$/', $value)) {
                throw new InvalidParameterException("Parameter '{$name}' is invalid");
            }
            $value = (int)$value;
        }
        return $value;
    }
995872
protected function getSymfonyFormFromParams($params, $name, $throwException = false)
    {
        $sfForm = $this->getParam($params, $name);

        if (null === $sfForm && false === $throwException) {
            return null;
        }

        if (!$sfForm instanceof SymfonyForm) {
            throw new \InvalidArgumentException(
                sprintf(
                    "%s parameter must be an instance of " .
                    "\Symfony\Component\Form\Form, instance of %s found",
                    $name,
                    is_object($sfForm) ? get_class($sfForm) : gettype($sfForm)
                )
            );
        }

        return $sfForm;
    }
823269
public function getException($message)
    {
        // make exception based on the status code
        switch ($this->statusCode) {
            case 400:
                return
                    $message?
                        new PlivoValidationException($message):
                        new PlivoValidationException(
                            "A parameter is missing or ".
                            "is invalid while accessing resource");
                break;
            case 401:
                return
                    $message?
                        new PlivoAuthenticationException($message):
                        new PlivoAuthenticationException(
                        "Failed to authenticate while accessing resource");
                break;
            case 404:
                return
                    $message?
                        new PlivoNotFoundException($message):
                        new PlivoNotFoundException(
                        "Failed to authenticate while accessing resource");
                break;
            case 405:
                return
                    $message?
                        new PlivoRequestException($message):
                        new PlivoRequestException(
                        "HTTP method used is not allowed to access resource");
                break;
            case 500:
                return
                    $message?
                        new PlivoServerException($message):
                        new PlivoServerException(
                        "A server error occurred while accessing resource");
                break;
            default:
                return new PlivoRestException(json_encode($this->responseData));
        }

    }
960999
protected function getRawParameter($paramName)
    {
        $raw = $this->getRequest()->getRawParameters();
        if (!isset($raw[$paramName])) {
            throw new \common_exception_MissingParameter($paramName);
        }
        return $raw[$paramName];
    }
793719
public function getParameter(string $parameterName): Parameter
    {
        if (!$this->hasParameter($parameterName)) {
            throw ParameterException::noParameter($parameterName);
        }

        return $this->parameters[$parameterName];
    }
58289
public function getParameter($name)
    {
        $key = strtolower($name);

        if (isset($this->parameters[$key])) {
            return $this->parameters[$key];
        }

        return null;
    }
348976
public static function get($name)
    {
        if (!isset(self::$connections[$name])) {
            throw new Exception(sprintf('Connection "%s" does not exist.', $name));
        }

        return self::$connections[$name];
    }
791563
@Override
    public String getParameter(String name) {
        String value = super.getParameter(name);
        if (value == null) {
            value = parameters.get(name);
        }
        return value;
    }