check and set the router interface

@param   Object  Instance of an Router
@return  bool
@throws  \InvalidArgumentException
331275
public function setRouter($Router)
    {
        if (! is_object($Router) || ! $Router instanceof Router) {
            throw new \InvalidArgumentException(
                'The Router Interface must be a valid Router Object'
            );
        }
        $this->Router = $Router;

        return true;
    }
579992
public function setURL($url)
    {
        if (!$this->validateURL($url)) {
            throw new \InvalidArgumentException(sprintf('The URL "%s" is invalid.', $url));
        }

        $this->url = $url;
        $this->endpoint = null;
    }
787274
function setPort($port)
    {
        if ($port !== null) {
            if (empty($port) && $port !== 0)
                $port = null;
            elseif ($port < 1 || $port > 65535)
                throw new \InvalidArgumentException(sprintf(
                    'Invalid port "%d" specified; must be a valid TCP/UDP port',
                    $port
                ));
        }

        $this->port = $port;
        return $this;
    }
578995
public function generate($type, $object, $absolute = false, array $extraParams = array())
    {
        if ( ! is_object($object)) {
            throw new \InvalidArgumentException(sprintf('$object must be an object, but got "%s".', gettype($object)));
        }

        /** @var $metadata ClassMetadata */
        $metadata = $this->metadataFactory->getMetadataForClass(get_class($object));
        if (null === $metadata) {
            throw new \RuntimeException(sprintf('There were no object routes defined for class "%s".', get_class($object)));
        }

        if ( ! isset($metadata->routes[$type])) {
            throw new \RuntimeException(sprintf(
                'The object of class "%s" has no route with type "%s". Available types: %s',
                get_class($object),
                $type,
                implode(', ', array_keys($metadata->routes))
            ));
        }

        $route = $metadata->routes[$type];

        $params = $extraParams;
        foreach ($route['params'] as $k => $path) {
            $params[$k] = $this->accessor->getValue($object, $path);
        }

        return $this->router->generate($route['name'], $params, $absolute);
    }
989879
public static function reset($object)
	{
		if (!($object instanceof FileOptions)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\FileOptions.');
		}
		$object->javaPackage = NULL;
		$object->javaOuterClassname = NULL;
		$object->javaMultipleFiles = NULL;
		$object->javaGenerateEqualsAndHash = NULL;
		$object->javaStringCheckUtf8 = NULL;
		$object->optimizeFor = NULL;
		$object->goPackage = NULL;
		$object->ccGenericServices = NULL;
		$object->javaGenericServices = NULL;
		$object->pyGenericServices = NULL;
		$object->deprecated = NULL;
		$object->ccEnableArenas = NULL;
		$object->objcClassPrefix = NULL;
		$object->csharpNamespace = NULL;
		$object->javananoUseDeprecatedPackage = NULL;
		$object->uninterpretedOption = NULL;
	}
33119
public static function isActiveRecord($object, $throwException=false)
	{
		if ($object instanceof \yii\db\ActiveRecord) return true;
		if ($throwException) {
			$msg = Yii::t('app', 'Object {obj} does not extend ActiveRecord', ['obj'=>get_class($object)]);
			throw new InvalidConfigException($msg);
		}

		return false;
	}
757903
public function offsetUnset($object)
    {
        if (!$object instanceof ObjectHandlable) {
            throw new \InvalidArgumentException('Object needs to implement ObjectHandlable');
        }

        unset($this->__data[$object->getHandle()]);
        return $this;
    }
1264971
public static function reset($object)
	{
		if (!($object instanceof MessageOptions)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\MessageOptions.');
		}
		$object->messageSetWireFormat = NULL;
		$object->noStandardDescriptorAccessor = NULL;
		$object->deprecated = NULL;
		$object->mapEntry = NULL;
		$object->uninterpretedOption = NULL;
	}
1262545
private function initRouter(): App
    {
        $request = $this->container('request');
        $response = $this->container('response');
        $router = new Router($request, $response);
        $router->error(Error::class);

        $this->containers()->set('router', $router);
        return $this;
    }
1434
public function dispatch($dispatcher = null, $path = null, $method = null)
    {
        if (!$dispatcher) {
            $dispatcher = new Dispatcher;
        } elseif (\is_array($dispatcher)) {
            $dispatcher = new Dispatcher($dispatcher);
        }

        if (!$dispatcher instanceof DispatcherInterface) {
            throw new \InvalidArgumentException(
                'The first argument is must an array OR an object instanceof the DispatcherInterface'
            );
        }

        if (!$dispatcher->hasRouter()) {
            $dispatcher->setRouter($this);
        }

        return $dispatcher->dispatchUri($path, $method);
    }
58629
private function isExpectedObject($object)
    {
        $className = $this->getClass();
        if (!is_object($object) || !$object instanceof $className) {
            throw new InvalidArgumentException();
        }

        return true;
    }
902053
public function setObject($object)
    {
        if (! is_object($object)) {
            throw new InvalidArgumentException(
                sprintf('The parameter given to setObject method of %s class is not an object', get_called_class())
            );
        }

        $this->object = $object;
        return $this;
    }
1071491
public function setObject($object)
    {
        if (!($object instanceof IRI) && !($object instanceof Value)) {
            throw new \InvalidArgumentException('Object must be an IRI or Value object');
        }

        $this->object = $object;
    }
1207699
public function setMainOperator($operator)
    {
        switch ($operator) {
            case self::OPERATOR_AND :
                $this->mainOperator = self::OPERATOR_AND;
                break;
            case self::OPERATOR_OR :
                $this->mainOperator = self::OPERATOR_OR;
                break;
            default :
                throw new \InvalidArgumentException(__CLASS__ . '::' . __FUNCTION__ . '() First argument should be ' . __CLASS__ . '::OPERATOR_AND or ' . __CLASS__ . '::OPERATOR_OR constant');
                break;
        }
        $this->rootOperation->setOperator($this->mainOperator);
    }
952956
public function router($Router = [])
    {
        /**
         * 'Controller'=> 'Home',
         * 'Mothed'    => 'Mothed',
         * 'Params'    => 'Params',
         */
        $this->_controller = $Router['controller'] ? ucfirst($Router['controller']) : 'Home';
        $this->_mothed = $Router['mothed'] ? ucfirst($Router['mothed']) : 'Index';
        $this->_params = $Router['params'] ? ucfirst($Router['params']) : '';
        return $this;
    }
961016
public function isProvider($instance)
    {
        $interfaces = class_implements($instance);

        if (isset($interfaces[AbstractProviderInterface::class])) {
            return true;
        }

        return false;
    }
623708
public function build() : RouterInterface
    {
        $router = $this->router;
        try{
            // call bootstrap code
            $startup = $this->bootstrap;
            
            $startup($router);
        }
        catch(\Throwable $e)
        {
            throw new RouterBuildingException($e);
        }
        return $router;
    }