@param int $requestMode - one of self::REQUEST_MODE_ASYNCHRONOUS

@throws \InvalidArgumentException
766314
public function setRequestMode($requestMode)
    {
        if (null !== $requestMode && (self::REQUEST_MODE_ASYNCHRONOUS !== $requestMode && self::REQUEST_MODE_SYNCHRONOUS !== $requestMode)) {
            throw new \InvalidArgumentException("invalid mode [{$requestMode}], expecting one of self::REQUEST_MODE_*");
        }
        $this->requestMode = $requestMode;
    }
460222
public function lock($entity, $lockMode, $lockVersion = null)
    {
        if ($entity === null) {
            throw new InvalidArgumentException('No entity passed to UnitOfWork#lock().');
        }

        if ($this->getEntityState($entity, self::STATE_DETACHED) !== self::STATE_MANAGED) {
            throw ORMInvalidArgumentException::entityNotManaged($entity);
        }

        $class = $this->em->getClassMetadata(get_class($entity));

        switch (true) {
            case $lockMode === LockMode::OPTIMISTIC:
                if (! $class->isVersioned()) {
                    throw OptimisticLockException::notVersioned($class->getClassName());
                }

                if ($lockVersion === null) {
                    return;
                }

                if ($entity instanceof GhostObjectInterface && ! $entity->isProxyInitialized()) {
                    $entity->initializeProxy();
                }

                $entityVersion = $class->versionProperty->getValue($entity);

                if ($entityVersion !== $lockVersion) {
                    throw OptimisticLockException::lockFailedVersionMismatch($entity, $lockVersion, $entityVersion);
                }

                break;

            case $lockMode === LockMode::NONE:
            case $lockMode === LockMode::PESSIMISTIC_READ:
            case $lockMode === LockMode::PESSIMISTIC_WRITE:
                if (! $this->em->getConnection()->isTransactionActive()) {
                    throw TransactionRequiredException::transactionRequired();
                }

                $oid = spl_object_id($entity);

                $this->getEntityPersister($class->getClassName())->lock(
                    array_combine($class->getIdentifierFieldNames(), $this->entityIdentifiers[$oid]),
                    $lockMode
                );
                break;

            default:
                // Do nothing
        }
    }
1094671
protected function getUri($module, $method, $responseFormat, array $requestParameters = array())
    {
        if (!$this->hasMethod($method)) {
            throw new \InvalidArgumentException(sprintf('The method %s is not registered', $method));
        }

        if (!$this->hasResponseFormat($responseFormat)) {
            throw new \InvalidArgumentException(sprintf('The response format %s is not registered', $responseFormat));
        }

        if (!isset($requestParameters['scope'])) {
            $requestParameters['scope'] = self::API_DEFAULT_SCOPE;
        }

        if (!isset($requestParameters['version'])) {
            $requestParameters['version'] = self::API_DEFAULT_VERSION;
        }

        $uri = sprintf(
            self::API_BASE_URL,
            $responseFormat,
            $module,
            $method,
            $this->getAuthToken()
        );

        return $uri . $this->generateQueryStringByRequestParams($requestParameters);
    }
1047232
public void setPaginationMode(final PaginationMode paginationMode) {
		getOrCreateComponentModel().paginationMode = PaginationMode.SERVER.equals(paginationMode) ? PaginationMode.DYNAMIC
				: paginationMode;
	}
16911
public function setRequestFormat($requestFormat)
    {
        $this->requestFormat = $requestFormat;
        switch ($requestFormat) {
            case self::FORMAT_JSON:
                $this->setRequestContentType(self::CONTENT_TYPE_JSON);
                break;
            case self::FORMAT_XML:
                $this->setRequestContentType(self::CONTENT_TYPE_XML);
                break;
            case self::FORMAT_URL_ENCODED:
                $this->setRequestContentType(self::CONTENT_TYPE_URL_ENCODED);
                break;
        }

        return $this;
    }
1049627
public function dispatch($requestUrl = null, $requestMethod = null) 
	{
		$params = array();
		$match = false;
		// set Request Url if it isn't passed as parameter
		if ($requestUrl === null) {
			$requestUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
		}
		// strip base path from request url
		$requestUrl = substr($requestUrl, strlen($this->basePath));
		// Strip query string (?a=b) from Request Url
		if (($strpos = strpos($requestUrl, '?')) !== false) {
			$requestUrl = substr($requestUrl, 0, $strpos);
		}
		// Strip anchors from the url
		// if (($strpos = strpos($requestUrl, '#')) !== false) {
		// 	$requestUrl = substr($requestUrl, 0, $strpos);
		// }
		// set Request Method if it isn't passed as a parameter
		if ($requestMethod === null) {
			$requestMethod = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
		}
		foreach ($this->routes as $handler) {
			list($method, $_route, $target, $name) = $handler;
			$methods = explode('|', $method);
			$method_match = false;
			// Check if request method matches. If not, abandon early. (CHEAP)
			foreach ($methods as $method) {
				if (strcasecmp($requestMethod, $method) === 0) {
					$method_match = true;
					break;
				}
			}
			// Method did not match, continue to next route.
			if (!$method_match) {
				continue;
			}
			// Check for a wildcard (matches all)
			if ($_route === '*') {
				$match = true;
			} elseif (isset($_route[0]) && $_route[0] === '@') {
				$pattern = '`' . substr($_route, 1) . '`u';
				$match = preg_match($pattern, $requestUrl, $params);
			} else {
				$route = null;
				$regex = false;
				$j = 0;
				$n = isset($_route[0]) ? $_route[0] : null;
				$i = 0;
				// Find the longest non-regex substring and match it against the URI
				while (true) {
					if (!isset($_route[$i])) {
						break;
					} elseif (false === $regex) {
						$c = $n;
						$regex = $c === '[' || $c === '(' || $c === '.';
						if (false === $regex && false !== isset($_route[$i+1])) {
							$n = $_route[$i + 1];
							$regex = $n === '?' || $n === '+' || $n === '*' || $n === '{';
						}
						if (false === $regex && $c !== '/' && (!isset($requestUrl[$j]) || $c !== $requestUrl[$j])) {
							continue 2;
						}
						$j++;
					}
					$route .= $_route[$i++];
				}
				$regex = $this->compileRoute($route);
				$match = preg_match($regex, $requestUrl, $params);
			}
			if (($match == true || $match > 0)) {
				if ($params) {
					foreach ($params as $key => $value) {
						if (is_numeric($key)) unset($params[$key]);
					}
				}			
				$mm = array(
					'target' => $target,
					'params' => $params,
					'name' => $name
				);
				if ($match) {	
				  //we are going to change this to use all be in the router function
				  //break up the target at the @ symbol. first part is function second is the file 
				  $target = explode('@', $mm['target']);
				  $method = $target[0];
				  $class = "\\App\\Controllers\\".$target[1];
				  //include the source file
				  include $this->controllersDir . str_replace('\\', '/', $target[1]) . '.php';
				  //instantiate the class
				  $instance = new $class();
				  //this is where we will place our middleware. first check to see if the there is an alias in 
				  //the middleware array and then execute it against our controller.
				  //get the middleware array from the instance
				  $instanceMiddleware = $instance->getMiddleware();
				  $middleware = $this->getMiddleWareArray();
					//count the instance middleware array
					$middlewareCnt = count($instanceMiddleware);
				  $middlewareInstances = [];
				  //build an acceptible middleware list to send to relay
				  $i = 0;
				  foreach($instanceMiddleware as $val) {
				  	//then loop through the middleware and see if we have a match
					  foreach ($middleware as $key => $value) {
							if($val==$key) {
						  	//check if its an array if it is we have to add them to the container individually.
						  	$middlewareInstances[$i][]=$instanceMiddleware[$i];
						  	if (is_array($value)) {
						  		//first index is the middleware class and the second index is the plugin
						  		for($j=0;$j<count($value);$j++) {
						  			$middlewareInstances[$i][] = $value[$j];
					  				$i++;
						  		}
						  	} else {
						  		//just a middleware class. This class will extend from another and doesnt need the plugin portion
					  			$middlewareInstances[$i][] = $value;
					  			$i++;
						  	}
						  }
					  }
				  }
				  //get the request array
				if (defined('PHPUNIT_BETASYNTAX_TESTSUITE') == true) { 
					$requestMethod = $requestMethod;
				}
				// } else {
				// 	if($requestMethod === null) {
			 //  			$requestMethod = $_SERVER['REQUEST_METHOD'];	
				// 	} else {
				// 		$requestMethod = $_SERVER['REQUEST_METHOD'];
				// 	}
				// }
			  	//instantiate our request and response for Relay
			  	$request = new Request($requestMethod,$requestUrl);
			  	$response = new Response;
			  	$queue = [];
			  	//build the middleware queue
			  	for($i=0;$i<count($middlewareInstances);$i++) {
			  			$queue[] = $middlewareInstances[$i][1];
			  	}
			  	//setup the automatic resolver
					$resolver = function ($class) {
					    return new $class();
					};
					//build the Relay builder class
					$relayBuilder = new RelayBuilder($resolver);
					$relay = $relayBuilder->newInstance($queue);
					//run the middleware against our controller
					$response = $relay($request, $response);
					//finally if all our middleware passed on the response we can then run our intended controller action				
					if (!defined('PHPUNIT_BETASYNTAX_TESTSUITE') == true) { 
						$instance->$method($mm['params']);
					} 
					$this->routeFound=true;
				}
			}
		}
		if(!$this->routeFound) {
			if (defined('PHPUNIT_BETASYNTAX_TESTSUITE') == true) { 
				return true;
			} else {
				view('Errors/404.haml'); 	
			}
		} else {
			return false;
		}
	}
1078870
function setLadderMode($mode, $multicall = false)
    {
        if ($mode !== 0 && $mode !== 1) {
            throw new InvalidArgumentException('mode = ' . print_r($mode, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($mode), $multicall);
    }
508141
private function initParams($requestId)
    {
        $controller = $this->params[$requestId]['controller'];
        if (!is_array($controller) || empty($controller[0]) || !is_object($controller[0])) {
            throw new \InvalidArgumentException(
                'Controller needs to be set as a class instance (closures/functions are not supported)'
            );
        }

        $class = class_exists(ClassUtils::class)
            ? ClassUtils::getClass($controller[0])
            : get_class($controller[0]);

        return $this->params[$requestId]['params'] = $this->paramReader->read(
            new \ReflectionClass($class),
            $controller[1]
        );
    }
26296
public function setFetchMode( $fetchMode, $fetchArgument = null, array $fetchConstructorArgument = [] )
	{
		$this->fetchMode = $fetchMode;
		$this->fetchArgument = $fetchArgument;
		$this->fetchConstructorArgument = $fetchConstructorArgument;
	}
952247
public function onKernelRequest(GetResponseEvent $event)
    {
        if (null === $module = $event->getRequest()->get('module')) {
            return;
        }

        if (!$module instanceof ModuleInterface) {
            $module = $this->getModularRouter()->getModuleByRequest($event->getRequest());
        }

        // todo remove current module functionality, as it can lead to unexpected behavior
        $this->getModuleManager()->setCurrentModule($module);
    }
314304
public function setDefaultMode(string $mode = null) : RauthInterface
    {
        if (!in_array($mode, self::MODES)) {
            throw new \InvalidArgumentException(
                'Mode ' . $mode . ' not accepted!'
            );
        }
        $this->defaultMode = $mode;

        return $this;
    }
395643
public function setWriteMode($mode)
    {
        if (!in_array($mode, $this->validWriteModes, true)) {
            throw new InvalidArgumentException("Invalid write mode specified: $mode");
        }

        $this->config["writeMode"] = $mode;
        $this->createFileHandler();
    }
347460
public void setEditMode(EditMode currentMode) {
		super.setEditMode(currentMode);
		if (controller != null) {
			controller.setEditMode(currentMode);
		}
	}
713601
public function setColorMode($colorMode)
    {
        $validColorModes = [
            self::COLOR_MODE_AUTO,
            self::COLOR_MODE_FORCED,
            self::COLOR_MODE_DISABLED,
        ];

        if (\in_array($colorMode, $validColorModes)) {
            $this->colorMode = $colorMode;
        } else {
            throw new \InvalidArgumentException('invalid color mode: ' . $colorMode);
        }
    }
768940
public function onKernelRequest(GetResponseEvent $event): void
    {
        $request = $event->getRequest();
        if (
            'html' !== $request->getRequestFormat('') ||
            !($request->attributes->has('_api_resource_class') || $request->attributes->getBoolean('_api_respond', false))
        ) {
            return;
        }

        $request->attributes->set('_controller', 'api_platform.swagger.action.ui');
    }
364288
public function setMode($mode)
    {
        if (!in_array($mode, [self::MODE_AND, self::MODE_OR])) {
            throw new InvalidArgumentException("Invalid mode $mode");
        }
        $this->mode = $mode;

        return $this;
    }
1174764
public function attach($resource, $mode = 'r')
    {
        $error = null;
        if (! is_resource($resource) && is_string($resource)) {
            set_error_handler(function ($e) use (&$error) {
                $error = $e;
            }, E_WARNING);
            $resource = fopen($resource, $mode);
            restore_error_handler();
        }

        if ($error) {
            throw new InvalidArgumentException('Invalid stream reference provided');
        }

        if (! is_resource($resource)) {
            throw new InvalidArgumentException(
                'Invalid stream provided; must be a string stream identifier or resource'
            );
        }

        $this->resource = $resource;
    }