Best URL for the action.

@since 160608 ReST utils.

@param string $action Action identifier.

@return string Best URL for the action.
193407
public function bestUrl(string $action): string
    {
        if ($this->viaAjax($action) || $this->viaApi($action)) {
            return home_url('/'); // Both ride on index.
        } elseif ($this->Wp->is_admin && ($this->s::isOwnMenuPage() || $this->s::isOwnMenuPageTab())) {
            return $this->urlRemove($this->c::currentUrl());
        } elseif ($this->Wp->is_admin && $action === '§dismiss-notice') {
            return $this->urlRemove($this->c::currentUrl());
        } elseif ($this->Wp->is_admin) {
            return self_admin_url('/');
        }
        return home_url('/'); // Fallback (default).
    }
940156
public function Link($action = null)
    {
        return Controller::join_links(
            parent::Link(),
            $this->config()->url_segment,
            $action
        );
    }
1179266
public function urlAction($action, array $query = [])
    {
        $query['action'] = $action;
        $query = array_replace($this->query(), $query);

        return $this->url() . '?' . http_build_query($query);
    }
975798
public function toRoute($action, $params=[])
    {
        $params = (array)$params;
        $url = URL::route($this->routePrefix . '.' . $action, $params);

        if ($passThruParams = $this->getPassThruParams()) {
            $url .= '?' . http_build_query($passThruParams);
        }

        return $url;

    }
325440
protected function getActionPath(string $action): string
    {
        $modelName = $this->getModelName();
        $viewName  = $modelName.ucfirst($action).'.js';

        return resource_path('assets/admin/src/views/'.pluralize($modelName).'/'.$viewName);
    }
263211
public function getSuggestStatus($action)
    {
        if (is_null($this->getOrder())) {
            return;
        }

        $status = $this->getOrderPaymentStatusPaymentValid();
        if (is_null($status)) {
            $status = $this->getStatusByAction($action);
        }

        return $status;
    }
1048694
public function getActionUrl($action)
    {
        if (is_array($action->urlData) && $this->isOpenNewWindow)
        {
            $action->url = BackendUrlHelper::createByParams($action->urlData)
                ->enableEmptyLayout()
                ->enableNoActions()
                ->params
            ;
        };

        return $action->url;
    }
299686
public function httpAction($action)
    {
        $request     = $this->getRequestData();
        $names       = array_reverse(explode('/', $action));
        $namesLength = count($names);
        for ($i = 1; $i < $namesLength; $i++) {
            $names[ $i ][0] = strtoupper($names[ $i ][0]);
        }
        $action     = implode($names);
        $methodName = preg_replace('/[^a-z]+/si', null, $action) . 'Action';
        $result     = $this->{$methodName}($request);

        if (is_array($result)) {
            $serializer = new JsonSerializer();
            $responseBody = $serializer->serialize($result);
            $result     = new Response($responseBody, 200, array('Content-Type' => 'application/json'));
        }

        return $result;
    }
300384
public static function appUrl($action = null, $params = array(), $useIndex = true)
    {
        return self::url($action, $params, $useIndex, false);
    }
499993
protected function routingToController($action)
	{
		if ($action instanceof Closure) return false;

		return is_string($action) || is_string(array_get($action, 'uses'));
	}
996246
protected function parseApiVersion(string $action): string
    {
        if (mb_strpos($action, 'api-v') === 0) {
            $version = preg_replace('/^api\-v([0-9]+[0-9.]*)\..+$/u', '${1}', $action);
        }
        return $version ?? ''; // API version from action identifier.
    }
460841
protected function normalizeAction(string $action): string
    {
        $action = strtolower($action);
        $action = str_replace(['_', '-', '.'], ' ', $action);
        $action = ucwords($action);
        $action = str_replace(' ', '', $action);
        $action = lcfirst($action);

        return $action;
    }
560692
public function actionClass(string $action): string
    {
        switch ($action) {
            case ModelHistory::ACTION_CREATE:
                $class = 'success';
                break;
            case ModelHistory::ACTION_DELETE:
                $class = 'danger';
                break;
            case ModelHistory::ACTION_COMMENT:
                $class = 'active';
                break;
            case ModelHistory::ACTION_UPDATE:
            default:
                $class = 'info';
                break;
        }

        return $class;
    }
74794
public function Link($action = null)
    {
        return Controller::join_links(Director::absoluteURL($this->link), $action);
    }
930149
public function getActionRoute($action = null)
    {
        if (null === $action) {
            $action = $this->getEvent()
                ->getRouteMatch()
                ->getParam('action');
        }

        return $this->getRouteName().'/'.$action;
    }
491559
protected function action($action)
    {
        $action = in_array($action, $this->actions) ? $action : null;
        $action = array_key_exists($action, $this->aliases) ? $this->aliases[$action] : $action;

        return $action;
    }
566196
public function getFilterKey($action = null)
    {
        // controller.action
        $controller = $this->getName();
        return $action ? $controller . '.' . $action : $controller;
    }