Get the name for a given resource.

@param  string  $resource
@param  string  $method
@param  array   $options
@return string
966607
protected function getResourceName($resource, $method, $options)
    {
        if (isset($options['names'][$method])) {
            return $options['names'][$method];
        }

        // If a global prefix has been assigned to all names for this resource, we will
        // grab that so we can prepend it onto the name when we create this name for
        // the resource action. Otherwise we'll just use an empty string for here.
        $prefix = isset($options['as']) ? $options['as'] .'.' : '';

        if (! $this->router->hasGroupStack()) {
            return $prefix .$resource .'.' .$method;
        }

        return $this->getGroupResourceName($prefix, $resource, $method);
    }
385795
public function getIdNameMap( $options = [] ) {

		$map = parent::getIdNameMap( $options );

		if( isset( $options[ 'default' ] ) && $options[ 'default' ] ) {

			unset( $options[ 'default' ] );

			$map = ArrayHelper::merge( [ '0' => 'Choose Theme' ], $map );
		}

		return $map;
	}
1214074
public function getId($resource): ?string
    {
        assert(get_class($resource) === static::MODEL);
        assert($this->classImplements(static::MODEL, ModelInterface::class) === true);

        /** @var ModelInterface $modelClass */
        $modelClass = static::MODEL;

        $pkName = $modelClass::getPrimaryKeyName();

        return $resource->{$pkName};
    }
205836
protected function _getFileName($entity, $field, $options = [])
    {
        $_options = [
        ];

        $options = Hash::merge($_options, $options);

        $config = $this->config($field);

        $_upload = $this->_uploads[$field];

        $fileInfo = explode('.', $_upload['name']);
        $extension = end($fileInfo);

        $fileName = $config['fileName'];

        $replacements = [
            '{ORIGINAL}' => $_upload['name'],
            '{field}' => $entity->get($config['field']),
            '{extension}' => $extension,
            '{DS}' => DIRECTORY_SEPARATOR,
            '//' => DIRECTORY_SEPARATOR,
            '/' => DIRECTORY_SEPARATOR,
            '\\' => DIRECTORY_SEPARATOR,
        ];

        $builtFileName = str_replace(array_keys($replacements), array_values($replacements), $fileName);

        return $builtFileName;
    }
1042895
public function get_formatted_name($options = array()) {
        if ($this->id) {
            $context = $this->get_context();
            return format_string($this->name, true, array('context' => $context) + $options);
        } else {
            return get_string('top');
        }
    }
893732
private function generateCacheKey($method, $uri, array $options = [])
    {
        return sha1(sprintf('%s.%s.%s.%s', get_class($this), $method, $uri, json_encode($options)));
    }
1248891
public function getPk($options = '')
    {
        if (!empty($this->pk)) {
            $pk = $this->pk;
        } else {
            $pk = $this->getTableInfo(is_array($options) ? $options['table'] : $options, 'pk');
        }
        return $pk;
    }
360934
private function sendRequest($method, $url, array $options = [])
    {
        $response = $this->httpClient->request((string)$method, $url, $options);

        return json_decode($response->getBody(), true);
    }
421978
public function renderName($table, string $field, array $options = []) : string
    {
        $handler = self::getByTableField($table, $field, $options, $this->cakeView);

        return $handler->renderName();
    }
1146618
public static function toJson($resource, $options = 0) {
        if ($resource instanceof JsonSerializable) {
            // pass-through

        } else if ($resource instanceof Jsonable) {
            return $resource->toJson($options);

        } else if (static::isJson($resource)) {
            return $resource;

        } else if (static::isObject($resource)) {
            $resource = static::buildArray($resource);

        } else if (static::isXml($resource)) {
            $resource = static::xmlToArray(simplexml_load_string($resource));

        } else if (static::isSerialized($resource)) {
            $resource = unserialize($resource);
        }

        return json_encode($resource, $options);
    }
1120136
public function get($method, array $params, array $options = array())
    {
        $this->parseOptions($options);

        $params = array_merge($params, $this->apiKeys);

        $response = $this->httpAdapter->getContent(
            sprintf(self::API_ENDPOINT, $this->scheme, $this->outputFormat, $method .'?'. http_build_query($params)),
            $this->headers
        );

        return $this->responseHandler($response);
    }
1356102
public static function get($name, $options = [])
    {
        $default = isset($options["default"]) ? $options["default"] : null;

        return isset($_REQUEST[$name]) ? $_REQUEST[$name]: $default;
    }
1203640
public function findAllByResourceAndNames($resource, array $params)
    {
        $where = $this->getWhere(['resource' => $resource]);
        $model = $this->makeModel()->getModel()->widgetParams()->getModel()->newQuery();
        return $model->where($where)->whereIn('name', $params)->get()->toArray();
    }
531991
public function request($method, $url, $token, array $options = [])
    {
        $request = $this->getAuthenticatedRequest(
            $method, $url, $token, $options
        );

        return $this->getResponse($request);
    }
851153
public function resource($name, $controller, array $options = array())
	{
		// If the resource name contains a slash, we will assume the developer wishes to
		// register these resource routes with a prefix so we will set that up out of
		// the box so they don't have to mess with it. Otherwise, we will continue.
		if (str_contains($name, '/'))
		{
			$this->prefixedResource($name, $controller, $options);

			return;
		}

		// We need to extract the base resource from the resource name. Nested resources
		// are supported in the framework, but we need to know what name to use for a
		// place-holder on the route wildcards, which should be the base resources.
		$base = $this->getResourceWildcard(last(explode('.', $name)));

		$defaults = $this->resourceDefaults;

		foreach ($this->getResourceMethods($defaults, $options) as $m)
		{
			$this->{'addResource'.ucfirst($m)}($name, $base, $controller, $options);
		}
	}
667809
private function performRequest($method, $url, $options) {

        try {
            switch ($method) {
                case 'GET':
                    return json_decode($this->client->get($url, $options)->getBody(), true);
                case 'POST':
                    return json_decode($this->client->post($url, $options)->getBody(), true);
                case 'PUT':
                    return json_decode($this->client->put($url, $options)->getBody(), true);
                case 'DELETE':
                    return json_decode($this->client->delete($url, $options)->getBody(), true);
                default:
                    return null;
            }
        } catch (RequestException $e) {
            throw ApiException::create($e);
        }
    }
31779
public function callMethod($methodName, $options)
    {
        $this->error = false;
        if (null === ($options = $this->getMethodParameters($methodName, $options))) {
            $this->error = true;
            return null;
        }

        return call_user_func_array(array($this, $methodName), $options);
    }