Sets the request HTTP target.

@param string|\Psr\Http\Message\UriInterface $target The target

@throws \InvalidArgumentException If invalid target provided

@return self
17379
protected function setTarget($target)
    {
        if ('*' == $target) {
            $this->target = $target;

            return $this;
        }
        if (is_string($target)) {
            $target = new Uri($target);
        }

        if (! $target instanceof UriInterface) {
            throw new InvalidArgumentException(sprintf(
                'Invalid target provided; must be an string or instance of '
                . '"%s", "%s" received.',
                'Psr\\Http\\Message\\UriInterface',
                is_object($target) ? get_class($target) : gettype($target)
            ));
        }
        $this->target = (string) $target->withFragment('');

        return $this;
    }
157620
public function addOrReplaceTarget($targetName, &$target)
    {
        $this->log("  +Target: $targetName", Project::MSG_DEBUG);
        $target->setProject($this);
        $this->targets[$targetName] = $target;

        $ctx = $this->getReference(ProjectConfigurator::PARSING_CONTEXT_REFERENCE);
        $current = $ctx->getCurrentTargets();
        $current[$targetName] = $target;
    }
513573
public function addProxyInstance($alias, $proxy, $target, $namespace = null)
    {
        $proxy = Input::checkNamespace($proxy);

        if (!is_object($target)) {
            throw new \InvalidArgumentException('Target must be an instance or closure.');
        }

        $this->addProxy($proxy, null, $target);
        $this->aliasManager->add($proxy, $alias);

        if ($namespace) {
            $this->addNamespace($alias, $namespace);
        }
    }
270947
public function setResponse($response)
    {
        $allowedValues = $this->getResponseAllowableValues();
        if (!in_array($response, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'response', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['response'] = $response;

        return $this;
    }
365409
public function updateTarget(Target $target): void
    {
        $query = $this->connection->createQueryBuilder();
        $query
            ->update('ngbm_rule_target')
            ->set('rule_id', ':rule_id')
            ->set('type', ':type')
            ->set('value', ':value')
            ->where(
                $query->expr()->eq('id', ':id')
            )
            ->setParameter('id', $target->id, Type::INTEGER)
            ->setParameter('rule_id', $target->ruleId, Type::INTEGER)
            ->setParameter('type', $target->type, Type::STRING)
            ->setParameter('value', $target->value, is_array($target->value) ? Type::JSON_ARRAY : Type::STRING);

        $this->applyStatusCondition($query, $target->status);

        $query->execute();
    }
1044901
public function setTargetUseURI(string $target_use_uri = "N") : CNabuDataObject
    {
        if ($target_use_uri === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$target_use_uri")
            );
        }
        $this->setValue('nb_site_target_cta_target_use_uri', $target_use_uri);
        
        return $this;
    }
377870
protected function setPort($port)
    {
        $this->uriString = null;

        if (null === $port) {
            $this->port = null;

            return $this;
        }

        if (! $this->isPortValid($port)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid port "%s" provided.',
                (is_object($port) ? get_class($port) : gettype($port))
            ));
        }
        $this->port = (int) $port;

        return $this;
    }
774635
public function setAction($action)
    {
        $allowedValues = $this->getActionAllowableValues();
        if (!in_array($action, $allowedValues)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'action', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['action'] = $action;

        return $this;
    }
405641
public function setTarget($target): self
    {
        if (!\is_object($target)) {
            throw new \InvalidArgumentException('The $target should be an object, '.\gettype($target).' given');
        }

        $this->target = $target;

        return $this;
    }
319940
private function doGetRequest($target, $parameters)
	{
		// Execute the GET request to the given target, along with the given parameters.
		$guzzle = $this->client->getGuzzle();
		$response = $guzzle->get($target, ['query' => $parameters]);
		return $response;
	}
111553
protected function setAjaxTarget($target)
    {
        if (!empty($this->ajax_cmd)) {
            $this->ajax_cmd->setSelector($target);
        }

        return $this;
    }
583434
public function setMethod($method)
    {
        $method = strtoupper($method);
        if (!defined('static::METHOD_' . $method) && !$this->getAllowCustomMethods()) {
            throw new \InvalidArgumentException('Invalid HTTP method passed');
        }
        $this->method = $method;
        return $this;
    }
717427
public function setLocation($location): self
    {
        if ($location instanceof LocationResponse) {
            $this->setLocationResponse($location);

            return $this;
        }

        if ($location instanceof StopLocationResponse) {
            $this->setStopResponse($location);

            return $this;
        }

        if (\is_int($location) || \is_string($location)) {
            $this->setLocationId($location);

            return $this;
        }

        throw new \InvalidArgumentException(
            'The location must be either a LocationResponse object, StopLocationResponse object, string or integer'
        );
    }
386640
public function setHit($hit)
    {
        if (false === is_bool($hit)) {
            throw InvalidArgumentException::typeMismatch($hit, 'Boolean');
        }

        $this->hit = $hit;

        return $this;
    }
1226609
public function setDefaultTargetUseURI(string $default_target_use_uri = "N") : CNabuDataObject
    {
        if ($default_target_use_uri === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$default_target_use_uri")
            );
        }
        $this->setValue('nb_site_default_target_use_uri', $default_target_use_uri);
        
        return $this;
    }
937170
public function setLink($link)
    {
        if (strlen($link) == 0) {
            throw new \InvalidArgumentException(sprintf('TextInput link should not be empty'));
        }

        if (!preg_match('@^https?://@', $link)) {
            throw new \InvalidArgumentException(sprintf('Invalid url: %s', $link));
        }

        $this->link = $link;

        return $this;
    }
164867
protected function makeDir($target)
    {
        if (!file_exists(dirname($target))) {
            mkdir(dirname($target), 0777, true);
        }

        return $this;
    }