Add action to a URL.

@since 160608 ReST utils.

@param string      $action Action identifier.
@param mixed|null  $data   Action data (optional).
@param string|null $url    Input URL (optional).

@return string URL w/ an action.
3779
public function urlAdd(string $action, $data = null, string $url = null): string
    {
        if ($this->viaApi($action)) {
            $action = $this->addApiVersion($action);
        }
        $url = $this->urlRemove($url ?: $this->bestUrl($action));

        // $url = $this->c::removeUrlQueryArgs(['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term'], $url);
        // `utm_*` variables are stripped to avoid duplicate sessions as a result of reposting to a URL that included them.
        // Duplicated sessions occur in GA; i.e., a new set of `utm_*` vars triggers a new GA session. Need to avoid this.
        // @TODO ↑ Instead of stripping these away, convert them to `utm-*` internal variables.

        $url = $this->c::addUrlQueryArgs([$this->var => $action, $this->data_var => $data], $url);
        // NOTE: If `$data` is null, it will simply not be included in the URL.

        if (!empty($this->registered_actions[$action]['requires_valid_nonce'])) {
            $url = $this->s::addUrlNonce($url, $action);
        }
        return $url;
    }
123158
public function put(String $url = NULL, $data = NULL)
    {
        return $this->_customRequest($url, URL::buildQuery($this->data ?? $data), __FUNCTION__);
    }
891024
public function removeAction($fullURL, $action = null)
    {
        if (!$action) {
            $action = $this->getAction();    //default to current action
        }
        $returnURL = $fullURL;

        if (($pos = strpos($fullURL, $action)) !== false) {
            $returnURL = substr($fullURL, 0, $pos);
        }

        return $returnURL;
    }
159769
protected function _event($action, $data = [])
    {
        $_event = new Event('Controller.PostTypes.' . $this->type['name'] . '.' . $action, $this, $data);
        $this->eventManager()->dispatch($_event);
    }
349555
public EntityBuilder addAction(Action action) {
    	if(action == null) {
    		throw new IllegalArgumentException("action cannot be null.");
    	}
    	addStep("_addAction", new Object[] { action }, true);
        return this;
    }
581621
public function Link($action = null)
    {
        /** @skipUpgrade */
        $link = Controller::join_links(Director::baseURL(), "Security", $action);
        $this->extend('updateLink', $link, $action);
        return $link;
    }
579758
public function action($action = null)
    {
        if (!is_null($action)) {
            $this->action = $action;
            return $this;
        } else {
            return $this->action ?: '';
        }
    }
767624
public function add($url, $method, $action)
	{	
		$route = $this->factory->create($url, $method, $action);

		$this->routes[] = $route;

		foreach ($route->getMethod() as $method) {
			$this->routesByMethod[$method][] = $route;
		}
	}
81535
public function createUrl(string $action, ?DataMap $params = null, bool $isFullUrl = false, array $fullUrlInfo = []): string
    {
        list ($moduleName, $controllerName, $actionName) = Application::$app->getFullAction($action);
        $resourcePath = $this->routeHandler->createUrl($moduleName, $controllerName, $actionName, $params);
        return $this->getPublicUrl($resourcePath, $isFullUrl, $fullUrlInfo);
    }
1293157
public function Link($action = null)
    {
        return Controller::join_links(parent::Link(), $this->stat('url_segment'), $action);
    }
1102054
public function put($uri, $action)
    {
        $uri = $this->buildUri($uri);

        return $this->addResponseType(Route::put($uri, $action));
    }
773966
public function write($action, $data)
    {
        $message = http_build_query($data);

        $resource = $this->getResource();
        $length = strlen($message);
        $sent = 0;

        $content = $this->getHeader($action, $length) . $message;

        while ($this->isConnected() && $sent < $length) {
            $chunk = fwrite($resource, substr($content, $sent));

            if (false === $chunk) {
                throw new \RuntimeException('Could not write to socket');
            }

            $sent += $chunk;
        }
    }
748552
public function Link($action = null)
    {
        if ($this->data()->virtualOwner) {
            $controller = ElementController::create($this->data()->virtualOwner);

            return $controller->Link($action);
        }

        return parent::Link($action);
    }
1018967
public function insertGetId($data, $action = 'insert') {
        if ($result = $this->insert($data, $action)) {
            return $this->connection->getInsertId();
        } else {
            return false;
        }
    }
74794
public function Link($action = null)
    {
        return Controller::join_links(Director::absoluteURL($this->link), $action);
    }
162479
public function post($url, $data)
    {
        $request = $this->webclient->createRequest('POST', $url, array(
            'body' => $data,
        ));
        return $this->sendRequest($request);
    }
836017
public function url($action, $params=[]) {
		if(is_array($action))
			return $this->resolver->url($action, $params);
		else
			return $this->resolver->url([get_called_class(), $action], $params);
	}