select all
@param  mixed $options string|array, auto guess where clause
@param  bool  $format  if format output
@return array|null
776018
public function fetchAll($options=null, $format=false)
    {
        if ($options) {
            $this->getQuery()->set($this->formatQueryOptions($options));
        }
        $this->getQuery()->type('select');
        
        $model = static::getQueryModel();
        
        $data = $this->query();
        if ($format && $data) {
            $data = static::formatOutput($data, $model);
        }
        
        return $data;
    }
1341719
public static function all($filters = [], $options = null, $fields = null)
    {
        return static::query()->select($fields)->where($filters)->options($options)->fetch();
    }
1211136
public function select($options = [])
    {
        $useClosure = false;

        if ($options instanceof \Closure) {
            $useClosure = true;
            $options = $options->call($this, $this->row);
        }

        $source = [];

        foreach ($options as $value => $text) {
            $source[] = compact('value', 'text');
        }

        if ($useClosure) {
            $this->addAttributes(['data-source' => json_encode($source)]);
        } else {
            $this->addOptions(compact('source'));
        }
    }
1099052
public function getFormatOption($format, $options = [])
  {
    $format = isset($this->format[$format]) ?  $this->format[$format] : Format::create($format, $options);
    if (isset($options['output']) && empty($format->getOutput())) {
      $format->setOutput($options['output']);
    }
    return $format;
  }
459612
public function loadString($data, $format='Json', array $options=[])
  {
    $handler = Format::getInstance($format);
    
    $obj = $handler->stringToObject($data, $options);
    $this->loadObject($obj);

    return true;
  }
1322307
public function setFormat($format)
    {
        if (!is_null($format)) {
            $this->format = $format;
            $this->useFormat(false);
        }

        return $this;
    }
1059463
public function queryString($params = [], $format = null) {
		$result = [];
		$query = [];

		foreach (array_filter([$this->query, $params]) as $querySet) {
			if (is_string($querySet)) {
				$result[] = $querySet;
				continue;
			}
			$query = array_merge($query, $querySet);
		}
		$query = array_filter($query);

		if ($format) {
			$q = null;
			foreach ($query as $key => $value) {
				if (!is_array($value)) {
					$q .= Text::insert($format, [
						'key' => urlencode($key),
						'value' => urlencode($value)
					]);
					continue;
				}
				foreach ($value as $val) {
					$q .= Text::insert($format, [
						'key' => urlencode("{$key}[]"),
						'value' => urlencode($val)
					]);
				}
			}
			$result[] = substr($q, 0, -1);
		} else {
			$result[] = http_build_query($query);
		}

		$result = array_filter($result);
		return $result ? "?" . join("&", $result) : null;
	}
183545
public function in($format = '')
    {
        if (empty($format)) {
            $line = fgets(STDIN);
        } else {
            $line = fscanf(STDIN, $format . PHP_EOL, $line);
        }

        return trim($line);
    }
47651
public function media($media, $format, $options = [])
    {
        if (!$media) {
            return '';
        }

        $provider = $this->getProvider($media);

        $format = $provider->getFormatName($media, $format);

        $options = $provider->getHelperProperties($media, $format, $options);

        return $this->templating->render($provider->getTemplate('helper_view'), [
             'media' => $media,
             'format' => $format,
             'options' => $options,
        ]);
    }
1139427
public function getAllSectionRouteRules(string $format = 'Craft', $siteId = null): array
    {
        return RouteMap::$plugin->routes->getAllSectionRouteRules($format, $siteId);
    }
1352291
public function select(array $filter = [], array $options = [])
    {
        // Create query object from filter and option arrays
        $query = $this->getQuery($filter, $options);

        try {
            $cursor = $this->getInstance()->executeQuery(
                $this->getParam('database') . '.' . $this->getCollection(),
                $query
            );
            $response = $cursor->toArray();

        } catch (MongoException $e) {
            new Exception('Unable to execute query');
        }

        return $response ?? false;
    }
750162
public function findOne(array $filter = [], array $options = [])
    {
        $cursor = $this->find($filter, ['limit' => 1] + $options);

        return ($document = $cursor->current()) ? $document : null;
    }
941196
public static function getTemplate($template, $format = 'html5')
	{
		$templates = static::getTemplates($template, $format = 'html5');

		return isset($templates[0]) ? $templates[0] : null;
	}
267231
function select($fields,$filter=NULL,array $options=NULL,$ttl=0) {
		list($sql,$args)=$this->stringify($fields,$filter,$options);
		$result=$this->db->exec($sql,$args,$ttl);
		$out=[];
		foreach ($result as &$row) {
			foreach ($row as $field=>&$val) {
				if (array_key_exists($field,$this->fields)) {
					if (!is_null($val) || !$this->fields[$field]['nullable'])
						$val=$this->db->value(
							$this->fields[$field]['pdo_type'],$val);
				}
				unset($val);
			}
			$out[]=$this->factory($row);
			unset($row);
		}
		return $out;
	}
927008
private function ffprobeFormat($format)
	{
		$this->ffprobe();

		if (count($this->formats) > 0)
		{
			$args = func_get_args();

			foreach ($args as $arg)
			{
				if (in_array($arg, $this->formats))
				{
					return true;
				}
			}

			return null;
		}

		return false;
	}
721339
public function toString($format='Json', array $options=[])
  {
    $handler = Format::getInstance($format);
    return $handler->objectToString($this->data, $options);
  }
131055
public function select($options = []){
        if (is_string($options)) {
            $options = ['class' => $options];
        }

        return new Select($this->expression('select'), $options, $this);
    }