Search migration files. If $exists = false search only not installed files, if true - only installed
@param string|null $query
@param bool $exist
@return array|false
11701
public function search(?string $query = null, bool $exist = false)
    {
        // initialize db migration record
        $records = new Migration();
        if ($this->connection !== null) {
            $records->setConnection($this->connection);
        }

        // get installed migrations
        $dbmigrations = Arr::pluck('migration', $records->get()->toArray());

        // list migrations
        $migrations = File::listFiles($this->dir, ['.php'], true);
        if (!Any::isArray($migrations) || count($migrations) < 1) {
            return false;
        }

        $found = false;
        foreach ($migrations as $migration) {
            // parse migration fullname
            $fullName = Str::cleanExtension($migration);
            // check if name contains search query conditions
            if (!Str::likeEmpty($query) && !Str::contains($query, $fullName)) {
                continue;
            }
            // check initialize conditions (equals to $exist)
            if (File::exist($this->dir . '/' . $migration)) {
                if (Arr::in($fullName, $dbmigrations) === $exist) {
                    $found[] = $migration;
                }
            }
        }

        return $found;
    }
639670
public function exists($model, $query)
    {
        //
        $params = [];

        //
        $whereArray = [];

        //
        if (isset($query['where'])) {
            $whereArray[] = $query['where'];
            unset($query['where']);
        }

        //
        $schema = $this->getFields($model);

        foreach ($schema as $field) {
            if (!isset($query[$field])) {
                continue;
            }
            $value = $query[$field];
            $token = ':'.$field;
            $params[$token] = $value;
            $whereArray[] = "`{$field}` = {$token}";
        }

        $where = count($whereArray) > 0
               ? 'WHERE '.implode(' AND ', $whereArray) : '';

        $table = $this->getPrefix($model);
        $sql = "SELECT * FROM `{$table}` {$where} LIMIT 1";
        $row = $this->getRow($sql, $params);

        return $row;
    }
1157012
@Override
	public boolean existSql(final String fileName) {
		return Thread.currentThread().getContextClassLoader().getResource(getFilePath(fileName)) != null;
	}
722845
protected function mergeOrReplaceQuery($query)
    {
        if (is_array($query)) {
            return array_merge($this->query, $query);
        }

        if (!is_string($query)) {
            throw new InvalidArgumentException('Query has to be array or string not '.gettype($query));
        }

        if ($query === '') {
            return [];
        }

        $normalized = ltrim($query, '?');

        $items = [];
        parse_str($normalized, $items);

        // If the query starts with a ? overwrite the complete url
        if ($query[0] == '?') {
            return $items;
        }

        return array_merge($this->query, $items);
    }
60268
private function _query($query)
    {
        $db = $this->_getConnection();
        if (is_resource($db)) {
            $res = @sqlite_query($db, $query);
            if ($res === false) {
                return false;
            } else {
                return $res;
            }
        }
        return false;
    }
675913
@Override
	public boolean existSql(final String sqlPath) {
		if (!cache) {
			return sqlLoader.existSql(sqlPath);
		} else {
			return sqlMap.get(sqlPath.replace(".", "/")) != null;
		}
	}
1135335
public function search($query = '', $options = null): ResultSet
    {
        return $this->getType()->search($query, $options = null);
    }
863179
public static function file( $name, & $exists = false )
	{
		if( !defined("APP_DIR") )
		{
			return [];
		}

		$file = APP_DIR . "config" . DIRECTORY_SEPARATOR . $name . '.php';
		if( file_exists( $file ) )
		{
			$data = Helper::includeImport($file);
			$exists = true;
		}

		if( ! isset( $data ) || ! is_array( $data ) )
		{
			$data = [];
		}

		return $data;
	}
827739
public function do_exists($key)
    {
        /** @var \ManaPHP\DbInterface $db */
        $db = $this->_di->getShared($this->_db);

        return $db->query($this->_source)->whereEq('hash', md5($key))->value('expired_time') >= time();
    }
160049
public function has(string $uri, string $query = ''): bool
    {

        return $this->memcached->get($this->buildCacheKey($uri, $query)) !== false;
    }
461650
public function search($query) {
        global $CFG, $DB;
        if ($result = parent::search($query)) {
            return $result;
        }

        $found = false;
        if ($processors = get_message_processors()) {
            foreach ($processors as $processor) {
                if (!$processor->available) {
                    continue;
                }
                if (strpos($processor->name, $query) !== false) {
                    $found = true;
                    break;
                }
                $strprocessorname = get_string('pluginname', 'message_'.$processor->name);
                if (strpos(core_text::strtolower($strprocessorname), $query) !== false) {
                    $found = true;
                    break;
                }
            }
        }
        if ($found) {
            $result = new stdClass();
            $result->page     = $this;
            $result->settings = array();
            return array($this->name => $result);
        } else {
            return array();
        }
    }
1227802
public function search($query) {
        $found = array();

        foreach ($this->settings as $setting) {
            if ($setting->is_related($query)) {
                $found[] = $setting;
            }
        }

        if ($found) {
            $result = new stdClass();
            $result->page     = $this;
            $result->settings = $found;
            return array($this->name => $result);
        }

        $found = false;
        if (strpos(strtolower($this->name), $query) !== false) {
            $found = true;
        } else if (strpos(core_text::strtolower($this->visiblename), $query) !== false) {
                $found = true;
            }
        if ($found) {
            $result = new stdClass();
            $result->page     = $this;
            $result->settings = array();
            return array($this->name => $result);
        } else {
            return array();
        }
    }
1001797
public function exist($where = false): bool
    {
        $this->statement->exist($where);
        $ret = self::query2();
        return $ret[0]['cnt'] ? true : false;
    }
1353785
function exists( $filename = false )
    {
        if ( !$filename )
            $filename = $this->FileName;
        return $this->doExists( $filename );
    }
461712
public function exists(): bool
    {
        $tableKey = $this->getKeyName();

        //If key isn't set we cant associate this record with DB
        if (! isset($this->$tableKey))
        {
            return false;
        }

        $sql = 'SELECT EXISTS(SELECT ' . $tableKey . ' FROM ' . $this->getTableName() . ' WHERE ' . $this->getKeyName() . ' = :key LIMIT 1)';
        $query = DB::getConnection()->prepare($sql);
        $query->execute(['key' => $this->getKey()]);

        return boolval($query->fetchColumn(0));
    }
384015
public static function execInsert($query)
    {
        $ret = false;

        $res = self::query($query);

        if ($res) {
            $ret = self::connection()->sql_insert_id();
            self::free($res);
        }

        return $ret;
    }
1340078
public function query($query)
	{
        Eresus_Kernel::log(__METHOD__, LOG_NOTICE, 'This method is deprecated');
		$db = Eresus_DB::getHandler();
        Eresus_Kernel::log(__METHOD__, LOG_DEBUG, $query);
		$db->exec($query);
		return true;
	}