Checks if provided order configuration (from GET) is valid

@param array $params
@return bool
762193
private function _validSort(array $params)
    {
        if (!isset($params['order_by']) || !isset($params['order_dir'])) {
            return false;
        }

        if (!in_array(strtoupper($params['order_dir']), ['ASC', 'DESC'])) {
            return false;
        }

        foreach ($this->_columns as $data) {
            $column = new Column($data);
            if ($column->index() == $params['order_by']) {
                return true;
            }
        }

        return false;
    }
257826
static public function exists($params)
    {
        $query = self::none();
        
        if (ctype_digit((string)$params)) {
            $query->where(['id' => $params]);
        } else {
            if (is_array($params))
                $query->where('id IN (?)', $params);
            else
                $query->where('id IN (?)', func_get_args());
        }
        
        return $query->exists();
    }
1048038
public function hasMany(array $params)
    {
        foreach ($params as $param) {
            if (!$this->has($param)) {
                return false;
            }
        }

        return true;
    }
1274106
public function requireIfAvailableAnd(Configuration $configuration, array $params)
  {
    $requiredIfAvailable = $configuration->getOptions()->getRequiredIfAvailable();
    if (is_array($requiredIfAvailable->getAnd()) && count($requiredIfAvailable->getAnd()) > 0)
    {
      foreach ($requiredIfAvailable->getAnd() as $key)
      {
        if (!array_key_exists(strtolower($key), $params))
        {
          return false;
          break;
        }
      }

      return true;
    }

    return false;
  }
823612
private function validateParameters(array $params) {
        if (empty($params['width']) || empty($params['height'])) {
            throw new TransformationException('Both width and height needs to be specified', 400);
        }

        // Get POI from transformation params
        $poi = empty($params['poi']) ? null : explode(',', $params['poi']);

        // Check if we have the POI in metadata
        if (!$poi) {
            $metadataPoi = $this->getPoiFromMetadata();

            if ($metadataPoi) {
                $poi = $metadataPoi;
            }
        }

        if ($poi) {
            if (!isset($poi[0]) || !isset($poi[1])) {
                throw new TransformationException('Invalid POI format, expected format `<x>,<y>`', 400);
            }

            if (!empty($params['crop']) && in_array($params['crop'], ['close', 'medium', 'wide']) === false) {
                throw new TransformationException('Invalid crop value. Valid values are: close,medium,wide', 400);
            }
        }

        $params['closeness'] = (isset($params['crop']) ? $params['crop'] : 'medium');
        $params['poi'] = $poi;

        return $params;
    }
350750
public function verifyDomain(array $params)
	{
		if (!isset($params['provider'])) {
			throw new MissingArgumentException('provider');
		}

		if (!isset($params['code'])) {
			throw new MissingArgumentException('code');
		}

		if (!isset($params['filename'])) {
			throw new MissingArgumentException('filename');
		}

		return $this->post('app/verify_domain', $params);
	}
248948
private function loadConfiguration($params)
	{
		if (!is_null(self::$jConfig))
		{
			return true;
		}

		// Load config as object
		$jConfig = json_decode(json_encode(parse_ini_file(JPATH_BASE . '/jorobo.ini', true)), false);

		if (!$jConfig)
		{
			$this->say('Error: Config file jorobo.ini not available');

			throw new FileNotFoundException('Config file jorobo.ini not available');
		}

		// Are we building a git / dev release?
		if ($this->isDevelopmentVersion($params))
		{
			$res = $this->_exec('git rev-parse --short HEAD');

			$version = "git" . trim($res->getMessage());

			if ($version)
			{
				$this->say("Changing version to development version " . $version);
				$jConfig->version = $version;
			}
		}

		$jConfig->buildFolder = JPATH_BASE . $this->determineTarget($jConfig);
		$jConfig->params      = $params;

		self::$jConfig = $jConfig;

		// Date set
		date_default_timezone_set('UTC');
	}
88296
public function is1DArray(array $params): bool
    {
        return (
            \count($params) === \count($params, COUNT_RECURSIVE) &&
            \count(\array_filter($params, 'is_array')) < 1
        );
    }
1187496
public static function orderBy($params) {
        $orderCriterias = array_flip($params['args'][0]);
        $ormObject = !is_null($params['ormObject']) ? $params['ormObject'] : ORM::for_table($params['table']);
        
        foreach ($orderCriterias as $direction => $column) {
            if(strtolower($direction) == 'asc') {
                $ormObject->order_by_asc($column);
            } elseif(strtolower($direction) == 'desc') {
                $ormObject->order_by_desc($column);
            }
        }
        return $ormObject;
    }
94638
private function check($value, $params) {

		if(true === is_string($value)) {
			return true === in_array($value, $params[0]);
		}

		return false;
	}
1036190
public function matchParams(array $params)
    {
        $result = [];
        foreach ($this->explodedParams as $name => list($default, $pattern, $patternName)) {
            if (!\array_key_exists($name, $params)) {
                if (\is_null($default)) {
                    return false;
                }
                $currentParam = $default;
            } else {
                $currentParam = $params[$name];
            }

            if (!\is_null($patternName)) {
                $patternObj = $this->patterns[$patternName];

                try {
                    $result[$name] = $patternObj->toUrl($currentParam);
                } catch (PatternException $exception) {
                    return false;
                }
            } else {
                if (\is_object($currentParam) && \method_exists($currentParam, '__toString')) {
                    $currentParam = (string) $currentParam;
                }
                if (!$this->pregMatchMultiType($pattern, $currentParam)) {
                    return false;
                }
                $result[$name] = $currentParam;
            }
        }

        return $result;
    }
869782
public function delete($params)
    {
        if (is_array($params)) {
            if (!empty($params['wheres'])) {
                $wheres = $this->prepareWhere($params['wheres']);
            } else {
                return false;
            }
            $query = "DELETE FROM `{$params['table']}` {$wheres};";
            if (isset($params['debug']) and strtolower($params['debug']) === 'on') {
                var_dump($query);
            }

            return $query;
        } else {
            return false;
        }
    }
1000663
protected function hasNewConnectionParams(array $params)
    {
        if (!$this->getSession()->has(self::SESSION_CONNECTION_KEY)) {
            return true;
        }

        $currentParams = $this->getSession()->get(self::SESSION_CONNECTION_KEY);

        foreach ($this->getParamsKey() as $key) {
            if (isset($currentParams[$key]) && $params[$key] !== $currentParams[$key]) {
                return true;
            }
        }

        return false;
    }
776839
public function validate($params)
    {
        $params = $this->boolParams($params);

        if (!empty($params['html']) && (!empty($params['url']) || !empty($params['file'])))
            throw new InvalidParameterException("Only one of [html, url, file] parameters can be set!");

        if (!empty($params['url']) && !empty($params['file']))
            throw new InvalidParameterException("Only one of [html, url, file] parameters can be set!");

        if ((!empty($params['page_width']) && empty($params['page_height']))
            ||(empty($params['page_width']) && !empty($params['page_height'])))
        {
            throw new InvalidParameterException('Page width and page height must both be set or unset!');
        }
        if (!empty($params['filename']) && !is_string($params['filename']))
            throw new InvalidParameterException('Filename must be a string.');

        if (!empty($params['footer']) && !is_string($params['footer']))
            throw new InvalidParameterException('Footer must be a string.');

        if (!empty($params['header']) && !is_string($params['header']))
            throw new InvalidParameterException('Header must be a string.');

        if (!empty($params['header_spacing']) && !is_int($params['header_spacing']))
            throw new InvalidParameterException('Header spacing parameter must be an integer.');

        if (!empty($params['footer_spacing']) && !is_int($params['footer_spacing']))
            throw new InvalidParameterException('Footer spacing parameter must be an integer.');

        if (!empty($params['page_size']) && !is_string($params['page_size']))
            throw new InvalidParameterException('Page size must be a string of some standard page size.');

        if (!empty($params['dpi']) && (!is_int($params['dpi']) || $params['dpi']<75))
            throw new InvalidParameterException('DPI must be an integer larger than 75.');

        if (!empty($params['image_dpi']) && !is_int($params['image_dpi']))
            throw new InvalidParameterException('Image DPI must be an integer.');

        if (!empty($params['lowquality']) && (!is_int($params['lowquality']) || !in_array($params['lowquality'], array(
                    0, 1 ) )))
            throw new InvalidParameterException(
                'Lowquality must be either 0 or 1 (alternative: use bool values');

        if (!empty($params['orientation']) && (!is_string($params['orientation']) || !in_array($params['orientation'],
                array("landscape", "portrait"))))
            throw new InvalidParameterException('Orientation must be set to either "landscape" or "portrait"');

        if (!empty($params['margin_top']) && !is_int($params['margin_top']))
            throw new InvalidParameterException('Margin top must be an integer.');

        if (!empty($params['margin_bottom']) && !is_int($params['margin_bottom']))
            throw new InvalidParameterException('Margin top must be an integer.');

        if (!empty($params['margin_left']) && !is_int($params['margin_left']))
            throw new InvalidParameterException('Margin top must be an integer.');

        if (!empty($params['margin_right']) && !is_int($params['margin_right']))
            throw new InvalidParameterException('Margin top must be an integer.');

        if (!empty($params['background']) && (!is_int($params['background']) || !in_array($params['background'], array(
                    0, 1 ) )))
            throw new InvalidParameterException(
                'Background must be either 0 or 1 (alternative: use bool values');

        if (!empty($params['images']) && (!is_int($params['images']) || !in_array($params['images'], array(
                    0, 1 ) )))
            throw new InvalidParameterException(
                'Images must be either 0 or 1 (alternative: use bool values');

        if (!empty($params['page_width']) && !is_int($params['page_width']))
            throw new InvalidParameterException('Page width must be an integer.');

        if (!empty($params['page_height']) && !is_int($params['page_height']))
            throw new InvalidParameterException('Page height must be an integer.');

        if (!empty($params['disposition']) && (!is_string($params['disposition']) || !in_array($params['disposition'],
                    array("attachment", "inline"))))
            throw new InvalidParameterException('Disposition can only be "attachment or "inline"');

        if (!empty($params['group']) && !is_string($params['group']))
            throw new InvalidParameterException('Group must be a string.');

        if (!empty($params['engine_version']) && (!is_int($params['engine_version']) || !in_array($params['engine_version'],
        array( 11, 12 ) )))
            throw new InvalidParameterException(
                'Engine version can be integer 11 or 12');

        if (!empty($params['title']) && !is_string($params['title']))
            throw new InvalidParameterException('Title must be a string.');

        if (!empty($params['outline']) && (!is_int($params['outline']) || !in_array($params['outline'], array(
                    0, 1 ) )))
            throw new InvalidParameterException(
                'Outline must be either 0 or 1 (alternative: use bool values');

        if (!empty($params['outline_depth']) && !is_int($params['outline_depth']))
            throw new InvalidParameterException('Outline depth must be an integer.');

        if (!empty($params['encoding']) && !is_string($params['encoding']))
            throw new InvalidParameterException('Encoding must be a string.');

        if (!empty($params['javascript']) && (!is_int($params['javascript']) || !in_array($params['javascript'], array(
                    0, 1 ) )))
            throw new InvalidParameterException(
                'Javascript must be either 0 or 1 (alternative: use bool values');

        if (!empty($params['javascript_delay']) &&
            (!is_int($params['javascript_delay']) || $params['javascript_delay']<1 || $params['javascript_delay']>800))
            throw new InvalidParameterException('Javascript delay must be an integer larger than 1, but smaller than 800.');

        if (!empty($params['internal_links']) &&
            (!is_int($params['internal_links']) || !in_array($params['internal_links'], array( 0, 1 ) )))
            throw new InvalidParameterException(
                'Internal links must be either 0 or 1 (alternative: use bool values');

        if (!empty($params['external_links']) &&
            (!is_int($params['external_links']) || !in_array($params['external_links'], array( 0, 1 ) )))
            throw new InvalidParameterException(
                'External links must be either 0 or 1 (alternative: use bool values');

        if (!empty($params['page_offset']) && !is_int($params['page_offset']))
            throw new InvalidParameterException('Page offset must be an integer.');

        if (!empty($params['username']) && !is_string($params['username']))
            throw new InvalidParameterException('Username must be a string.');

        if (!empty($params['password']) && !is_string($params['password']))
            throw new InvalidParameterException('Password must be a string.');

        if (!empty($params['use_print_media']) &&
            (!is_int($params['use_print_media']) || !in_array($params['use_print_media'], array(
                    0, 1 ) )))
            throw new InvalidParameterException(
                'Use print media must be either 0 or 1 (alternative: use bool values');

        if (!empty($params['zoom']) && !is_numeric($params['zoom']))
            throw new InvalidParameterException('Zoom must be an integer.');

        if (!empty($params['viewport_size']) &&
            (!is_string($params['viewport_size'] || preg_match("^\\d+x\\d+$", $params['viewport_size']))))
            throw new InvalidParameterException('Viewport must be a string of a following format: [width]x[height].');

        if (!empty($params['id']) && !is_string($params['id']))
            throw new InvalidParameterException('ID must be a string.');

        /*if (!empty($params['file']))
            $this->validateFile($params['file']);*/

        return $params;
    }
99642
protected function compareOrderToParams(OrderInterface $order, array $params)
    {
        return $order->getReference() === $params['orderID']
            && $order->getCurrency() === $params['currency']
            && (float) ($order->getTotalInc()) === (float) ($params['amount']);
    }
1113133
public function supports($url, array $params = array())
    {
        $params = array_merge($this->defaults, $params);
        if (empty($this->scheme)) {
            return false;
        }

        $patterns = array_map(function ($scheme) {
            return str_replace('\*', '.*', preg_quote($scheme, '#'));
        }, $this->scheme);

        $pattern = '#'.implode('|', $patterns).'#i';

        return preg_match($pattern, $url) && !array_diff_key($this->requirements, $params);
    }
1315639
private function validateAndSetBotParamsExtra(array $params)
    {
        foreach (self::$valid_extra_bot_params as $extra_key) {
            if (!array_key_exists($extra_key, $params)) {
                continue;
            }

            $this->bot_params[$extra_key] = $params[$extra_key];
        }
    }