Get a reduced and normalized set of query params for a mutation based on the given options

@param array $options Array of request options
@return array Array of normalized query params
776763
private function getMutationQueryParams($options = [])
    {
        $query = ['returnIds' => 'true'];

        if (!isset($options['returnDocuments']) || $options['returnDocuments']) {
            $query['returnDocuments'] = 'true';
        }

        if (isset($options['visibility']) && $options['visibility'] !== 'sync') {
            $query['visibility'] = $options['visibility'];
        }

        return $query;
    }
1177920
protected function mergeOptions(array $options)
    {
        $defaults = $options + $this->_default_options;
        $flip_request_params = array_flip($defaults['request_param']);
        $request = array_intersect_key($this->application->input->get(), $flip_request_params);

        if ($defaults['save'] !== false) {
            $last_request = $this->application->session->userdata($defaults['save']);
            if (!empty($last_request)) {
                $request = array_merge($last_request, $request);
            }
            $this->application->session->set_userdata($defaults['save'], $request);
        }

        foreach ($request as $key => $value) {
            if (isset($defaults[$flip_request_params[$key]])) {
                $defaults[$flip_request_params[$key]] = $value;
            }
        }
        return array_merge($defaults, $request);
    }
375932
private function resolveOptions(array $options = array())
    {
        $this->options["seo"] = $this->seo;

        if (!$this->seo->getTitle() && $options['defaultTitle']) {
            $this->seo->setTitle($options['defaultTitle']);
        }

        if (!$this->seo->getTitle() && $options['defaultKeywords']) {
            $this->seo->setTitle($options['defaultKeywords']);
        }

        if (!$this->seo->getTitle() && $options['defaultDescription']) {
            $this->seo->setTitle($options['defaultDescription']);
        }

        return array_merge($this->options, $options);
    }
1132597
protected function normalizeOptions(array $options): array
    {
        $options = array_replace($this->getDefaultOptions(), $options);

        $options['cacheDir'] = PathResolver::realpath($options['cacheDir']);

        if (!$options['cacheDir']) {
            throw new \RuntimeException('You need to provide valid cache directory for Go! AOP framework.');
        }

        $options['excludePaths'][] = $options['cacheDir'];
        $options['excludePaths'][] = __DIR__ . '/../';
        $options['appDir']         = PathResolver::realpath($options['appDir']);
        $options['cacheFileMode']  = (int) $options['cacheFileMode'];
        $options['includePaths']   = PathResolver::realpath($options['includePaths']);
        $options['excludePaths']   = PathResolver::realpath($options['excludePaths']);

        return $options;
    }
1322756
protected function getPrestaShopOptions(array $options)
    {
        $result = array(
            'query' => array(),
            'id' => 'id',
            'name' => 'name',
        );

        foreach ($options as $value => $label) {
            $result['query'][] = array(
                'id' => $value,
                'name' => $label,
            );
        }

        return $result;
    }
1050622
protected function getAuthorizationParameters(array $options)
    {
        $options = parent::getAuthorizationParameters($options);
        $options['purpose'] = $this->purpose;
        return $options;
    }
1196875
public static function query($options = array())
	{
		$timestamp_start_name = static::temporal_property('start_column');
		$timestamp_end_name = static::temporal_property('end_column');
		$max_timestamp = static::temporal_property('max_timestamp');

		$query = Query_Temporal::forge(get_called_class(), static::connection(), $options)
			->set_temporal_properties($max_timestamp, $timestamp_end_name, $timestamp_start_name);

		//Check if we need to add filtering
		$class = get_called_class();
		$timestamp = \Arr::get(static::$_lazy_filtered_classes, $class, null);

		if( ! is_null($timestamp))
		{
			$query->where($timestamp_start_name, '<=', $timestamp)
				->where($timestamp_end_name, '>', $timestamp);
		}
		elseif(static::get_primary_key_status() and ! static::get_primary_key_id_only_status())
		{
			$query->where($timestamp_end_name, $max_timestamp);
		}

		return $query;
	}
612143
protected function getOptions(array  $options): array
    {
        $options['format'] = array_get($options, 'format', $this->format);
        $options['locale'] = array_get($options, 'locale', config('app.locale'));

        return $options;
    }
527556
protected function getFilteredOptions(array $options)
    {
        $default = $this->getDefaultOptions();
        $options = \array_merge($default, $options);

        $uses = \array_unique(\array_merge([
            'path', 'filename', 'extension', 'format',
        ], \array_keys($default)));

        $data = Arr::only($options, $uses);

        return $data;
    }
644732
public function getChangeLogQuery(array $options)
    {
        $qb = $this->createQueryBuilder();
        $qb->select('*');

        $this->setLimitOrder($qb, $options);

        return $qb;
    }
1172905
static protected function normalizeOptions($options) {
		if ($options instanceof Traversable) {
			$options = iterator_to_array($options);
		}
		
		if (! is_array($options)) {
			throw new InvalidOptions('Options must be an array or a Traversable implementation');
		}
		
		return $options;
	}
247937
protected function resolvePageOptions(array $options = array())
    {
        $resolver = new OptionsResolver;
        $this->setDefaultPageOptions($resolver);

        if (!empty($this->pageOptions)) {
            $resolver->setDefaults($this->pageOptions);
        }

        return $resolver->resolve($options);
    }
201730
protected function getAuthorizationParameters(array $options)
    {
//        I removed this from application authorization flow
//        if (empty($options['state'])) {
//            $options['state'] = $this->getRandomState();
//        }

//        if (empty($options['scope'])) {
//            $options['scope'] = $this->getDefaultScopes();
//        }

        if (empty($options['entity_id'])) {
            $options['entity_id'] = '';
        }

        $options += [
            'response_type' => 'code',
            'approval_prompt' => 'auto'
        ];

//        if (is_array($options['scope'])) {
//            $separator = $this->getScopeSeparator();
//            $options['scope'] = implode($separator, $options['scope']);
//        }

        // Store the state as it may need to be accessed later on.
//        $this->state = $options['state'];

        return [
            'client_id' => $this->clientId,
            'redirect_uri' => $this->redirectUri,
            'entity_id' => $options['entity_id'],
//            'state' => $this->state,
//            'scope' => $options['scope'],
            'response_type' => $options['response_type'],
            'approval_prompt' => $options['approval_prompt'],
        ];
    }
1266048
protected function getTreeOptionsFromRequest($options = [])
    {
        $options = array_merge([
            'subclasses' => true,
            'instances' => true,
            'highlightUri' => '',
            'chunk' => false,
            'offset' => 0,
            'limit' => 0
        ], $options);

        if ($this->hasRequestParameter('loadNode')) {
            $options['uniqueNode'] = $this->getRequestParameter('loadNode');
        }

        if ($this->hasRequestParameter("selected")) {
            $options['browse'] = array($this->getRequestParameter("selected"));
        }

        if ($this->hasRequestParameter('hideInstances')) {
            if((bool) $this->getRequestParameter('hideInstances')) {
                $options['instances'] = false;
            }
        }
        if ($this->hasRequestParameter('classUri')) {
            $options['class'] = $this->getCurrentClass();
            $options['chunk'] = !$options['class']->equals($this->getRootClass());
        } else {
            $options['class'] = $this->getRootClass();
        }

        if ($this->hasRequestParameter('offset')) {
            $options['offset'] = $this->getRequestParameter('offset');
        }

        if ($this->hasRequestParameter('limit')) {
            $options['limit'] = $this->getRequestParameter('limit');
        }

        if ($this->hasRequestParameter('order')) {
            $options['order'] = tao_helpers_Uri::decode($this->getRequestParameter('order'));
        }

        if ($this->hasRequestParameter('orderdir')) {
            $options['orderdir'] = $this->getRequestParameter('orderdir');
        }
        return $options;
    }
71832
private function renameQueryOptions(array $options, array $rename) : array
    {
        if (empty($options)) {
            return $options;
        }

        $options = array_combine(
            array_map(
                static function ($key) use ($rename) {
                    return $rename[$key] ?? $key;
                },
                array_keys($options)
            ),
            array_values($options)
        );

        // Necessary because of https://github.com/phpstan/phpstan/issues/1580
        assert($options !== false);

        return $options;
    }
852758
protected function processOptions(array $options)
    {
        $resolver = new OptionsResolver();
        $this->setDefaultOptions($resolver);

        return $resolver->resolve($options);
    }
851946
public function getData(Options $options = null)
    {
        if ($options === null) {
            // Take store global/default options
            $options = $this->store->getOptions();
            // By default formatters are disabled in JSON
            $options->getHydrationOptions()->disableFormatters();
        }

        $data = $this->store->getData($options);
        $d = [
            'success' => true,
            'total' => $data->getTotalRows(),
            'start' => $data->getSource()->getOptions()->getOffset(),
            'limit' => $data->getSource()->getOptions()->getLimit(),
            'data' => $data->toArray()
        ];

        if ($this->options['debug']) {
            $source = $data->getSource();
            if ($source instanceof QueryableSourceInterface) {
                $d['query'] = $source->getQueryString();
            }
        }

        return Encoder::encode($d);
    }