Apply conditions to the query

@param array|null $conditions The conditions to apply
@param array|null $types Not used
@param bool $overwrite Whether to overwrite the current conditions
@return $this|array
502870
public function where($conditions = null, $types = [], $overwrite = false)
    {
        if ($conditions === null) {
            return $this->clause('where');
        }

        $this->_parts['where'] = (!$overwrite) ? Hash::merge($this->clause('where'), $conditions) : $conditions;

        return $this;
    }
629547
public function where($conditions): self
    {
        if ($conditions[0] instanceof Closure) {
            $this->addClauseCondClosure('where', 'AND', $conditions[0]);

            return $this;
        }
        $this->where[] = ['and', $conditions];

        return $this;
    }
176019
public void generateQueries(Boolean overwrite)
  {
    List<AnnisCorpus> corpora = queryDao.listCorpora();
    for (AnnisCorpus annisCorpus : corpora)
    {
      generateQueries(annisCorpus.getId(), overwrite);
    }
  }
1173661
public function setPermissionOverwritesAttribute($overwrites)
    {
        $this->attributes['permission_overwrites'] = $overwrites;

        if (! is_null($overwrites)) {
            foreach ($overwrites as $overwrite) {
                $overwrite               = (array) $overwrite;
                $overwrite['channel_id'] = $this->id;

                $this->overwrites->push($overwrite);
            }
        }
    }
1356885
public function where($conditions, $params = array())
    {
        $this->mergeParams($params);
        $this->query['where'] = $this->buildConditions($conditions);

        return $this;
    }
731804
public function orWith($condition, ...$values): self
    {
        if ($condition instanceof EasyStatement) {
            $condition = '(' . $condition . ')';
        }
        if (!\is_string($condition)) {
            throw new \TypeError('An EasyStatement or string is expected for argument 1');
        }
        return $this->orWithString($condition, ...$values);
    }
832177
public function copyFiles($files, $overwrite = null)
    {
        /*
         * To allow for manual override on the overwriting flag, we check to see if
         * the $overwrite flag was set and is a boolean value.  If not, use the object
         * allowOverwrite flag.
         */

        if (is_null($overwrite) || !is_bool($overwrite))
        {
            $overwrite = $this->overwrite;
        }

        $config = array();

        /*
         * $files must be an array of filenames.  Verify that it is an array with
         * at least one file to copy.
         */
        if (is_array($files) && count($files) > 0)
        {
            foreach ($files as $file)
            {
                // Get the source and destination paths
                $filesource = JPath::clean($file['src']);
                $filedest = JPath::clean($file['dest']);
                $filetype = array_key_exists('type', $file) ? $file['type'] : 'file';

                $config[$this->relativeTargetPath($filedest)] = $this->relativeJoomlaTargetPath($filedest);

                $filedestCopy = $this->rewriteTargetPath($filedest);
                $filedestCopyContainer = dirname($filedestCopy);

                if (!file_exists(dirname($filedest))) {
                    mkdir(dirname($filedest), 0777, true);
                }

                if (!file_exists($filesource))
                {
                    /*
                     * The source file does not exist.  Nothing to copy so set an error
                     * and return false.
                     */
                    JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_NO_FILE', $filesource), JLog::WARNING, 'jerror');

                    return false;
                }
                elseif (($exists = file_exists($filedest)) && !$overwrite)
                {
                    // It's okay if the manifest already exists
                    if ($this->getPath('manifest') == $filesource)
                    {
                        continue;
                    }

                    // The destination file already exists and the overwrite flag is false.
                    // Set an error and return false.
                    JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_FILE_EXISTS', $filedest), JLog::WARNING, 'jerror');

                    return false;
                }
                else
                {
                    // Copy the folder or file to the new location.
                    if ($filetype == 'folder')
                    {
                        if (!(JFolder::copy($filesource, $filedest, null, $overwrite))) {
                            JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_FAIL_COPY_FOLDER', $filesource, $filedest), JLog::WARNING, 'jerror');

                            return false;
                        }

                        if (!is_dir($filedestCopyContainer)) {
                            mkdir($filedestCopyContainer, 0775, true);
                        }

                        if (!(JFolder::copy($filedest, $filedestCopy, null, $overwrite))) {
                            JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_FAIL_COPY_FOLDER', $filedest, $filedestCopy), JLog::WARNING, 'jerror');

                            return false;
                        }

                        $step = array('type' => 'folder', 'path' => $filedest);
                    }
                    else
                    {
                        if (!(JFile::copy($filesource, $filedest, null))) {
                            JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_FAIL_COPY_FILE', $filesource, $filedest), JLog::WARNING, 'jerror');

                            // In 3.2, TinyMCE language handling changed.  Display a special notice in case an older language pack is installed.
                            if (strpos($filedest, 'media/editors/tinymce/jscripts/tiny_mce/langs'))
                            {
                                JLog::add(JText::_('JLIB_INSTALLER_NOT_ERROR'), JLog::WARNING, 'jerror');
                            }

                            return false;
                        }

                        if (!is_dir($filedestCopyContainer)) {
                            mkdir($filedestCopyContainer, 0775, true);
                        }

                        if (!(JFile::copy($filedest, $filedestCopy, null))) {
                            JLog::add(JText::sprintf('JLIB_INSTALLER_ERROR_FAIL_COPY_FILE', $filedest, $filedestCopy), JLog::WARNING, 'jerror');

                            return false;
                        }

                        $step = array('type' => 'file', 'path' => $filedest);
                    }

                    /*
                     * Since we copied a file/folder, we want to add it to the installation step stack so that
                     * in case we have to roll back the installation we can remove the files copied.
                     */
                    if (!$exists)
                    {
                        $this->stepStack[] = $step;
                    }
                }
            }
        }
        else
        {
            // The $files variable was either not an array or an empty array
            return false;
        }

        self::$assetInstaller->addToConfig($config);
        self::$assetInstaller->install();

        return count($files);
    }
1011526
public function where($conditions, $values=null) {
		if(!$conditions)
			return $this;
		if($values !== null)
			$this->where[] = [$conditions => $values];
		else
			$this->where[] = $conditions;

		return $this;
	}
230731
protected function bindCondition($type, $key, $values = [])
    {
        $conditionHolder = "{$type}Conditions";
        if (!is_array($values)) {
            $values = [$values];
        }

        array_push($this->$conditionHolder, [$key, $values]);

        return $this;
    }
1221924
public function addParameters(array $parameters, $overwrite = true)
    {
        $this->parameters = ArrayUtils::merge($this->parameters, $parameters, $overwrite);
        $this->links      = [];
    }
1273952
public function addConditions( $conditions )
	{
		if( !is_array( $conditions ) )
			throw new InvalidArgumentException( 'An Array should be given.' );
		foreach( $conditions as $condition )
			$this->addCondition( $condition );
	}
1140484
protected function makeConditions(array $conditions): ?\SplObjectStorage
    {
        if (empty($conditions)) {
            return null;
        }

        $storage = new \SplObjectStorage();
        foreach ($conditions as $condition => $options) {
            $condition = $this->config->resolveAlias($condition);

            if ($this->config->hasCondition($condition)) {
                $autowire = $this->config->getCondition($condition);
            } else {
                $autowire = new Autowire($condition);
            }

            $storage->attach($autowire->resolve($this->factory), $options);
        }

        return $storage;
    }
16925
public function alias($type, $alias = null, $override = false)
    {
        if (is_array($type)) {
            foreach ($type as $alias => $asset) {
                $this->setParam('aliases', $alias, $asset, $override);
            }
        } else if (is_array($alias)) {
            foreach ($alias as $a) {
                $this->setParam('aliases', $a, $type, $override);
            }
        } else {
            $this->setParam('aliases', $alias, $type, $override);
        }

        return $this;
    }
1191460
public function andWhere(...$conditions) : self
    {
        $this->conditionalQueryBuilder->andWhere(
            ...$this->createConditionExpressions($conditions)
        );

        return $this;
    }
747301
private function applyConditions($matches)
    {
        foreach ($this->conditions as $condition) {
            $matches = $this->filter($matches, $condition);
        }

        return $matches;
    }
955616
public function options($options, bool $overwrite = false)
    {
        if (!empty($options['plugins'])) {
            $options['plugins'] = new Raw(trim(preg_replace('/\s\s+/', ' ', $options['plugins'])));
        }

        if ($options instanceof Collection) {
            $options = $options->toArray();
        }
        if ($overwrite) {
            $this->options = $options;
        } else {
            $this->options = array_replace_recursive($this->options, $options);
        }

        return $this;
    }
963089
public function setAllowedMimeTypes($types = '*')
        {
            if(is_string($types))
            {
                if ('*' !== $types) {
                    $types = (array) $types;
                }else{
                    $this->allowedTypes = $types;
                    return $this;
                }
            }

            if(is_array($types))
            {
                $this->allowedTypes = $types;
                return $this;
            }else{
                return false;
            }
        }