Returns the first row

@throws Exception
@return \stdClass|string|null
974691
public function first()
    {
        $result = $this->limit(1)->get();

        return ($result !== null && \count($result) !== 0) ? $result[0] : null;
    }
471460
public function first()
    {
        try {
            $query = (clone $this)->limit(1)->apply($this->database->getTablePrefixer());
            $compiled = $this->database->getGrammar()->compileSelect($query);
            return $this->database->selectFirst($compiled->getSQL(), $compiled->getBindings());
        } catch (\Throwable $exception) {
            return $this->handleException($exception);
        }
    }
1287094
public function firstElementGet()
    {
        $keys = array_keys( $this->collection );
        if( $keys ) {
            return $this->collection[array_shift($keys)];
        }
        return null;
    }
240651
public function getRow() : ?int 
    {
        if ( ! $this->hasRow()) {
            $this->setRow($this->getDefaultRow());
        }
        return $this->row;
    }
1317620
public function first()
    {
        foreach ($this->dataQuery->firstRow()->execute() as $row) {
            return $this->createDataObject($row);
        }
        return null;
    }
1218796
public function loadAssocRow()
    {
        if ($this->stmt === null) {
            return null;
        }

        return $this->stmt->fetch(\PDO::FETCH_ASSOC);
    }
227318
public function first()
    {
        $keys = array_keys($this->rows);
        return current($keys) === false ? null : $this->instanceRow($this->rows[current($keys)], $this->realRows ? : $this);
    }
681491
public function fetchSingleRow()
	{
		$result = $this->query();
		$row = $result->fetch(\PDO::FETCH_ASSOC);
		$result->closeCursor();
		return $row;
	}
116218
public function getIterator()
    {
        if (!file_exists($this->filepath)) {
            //TODO: throw exception instead?
            return null;
        }
        $header = $this->hasheader ? $this->getFirstRow() : null;
        $output = array();

        $config = new LexerConfig();
        $config->setDelimiter($this->delimiter);
        $config->setEnclosure($this->enclosure);
        $config->setIgnoreHeaderLine($this->hasheader);

        $interpreter = new Interpreter();
        // Ignore row column count consistency
        $interpreter->unstrict();
        $interpreter->addObserver(function (array $row) use (&$output, $header) {
            if ($header) {
                //create new row using headings as keys
                $newrow = array();
                foreach ($header as $k => $heading) {
                    if (isset($row[$k])) {
                        $newrow[$heading] = $row[$k];
                    }
                }
                $row = $newrow;
            }
            $output[] = $row;
        });

        $lexer = new Lexer($config);
        $lexer->parse($this->filepath, $interpreter);

        return new ArrayIterator($output);
    }
1297307
public function fetchRow()
    {
        $opts = $this->options;
        $opts['limit'] = 1;
        
        $sql = QueryBuilder::optionsToSql($opts);
        $row = $this->getDb()->getRow($sql);
        
        return $row;        
    }
370381
public function getFirst($sql = null)
    {
        if ($sql) {
            $this->setLastQuery($sql);

            try {
                $result = $this->db->query($sql);
            } catch (\PDOException $e) {
                throw new DatabaseException($e->getMessage() . '<br>' . $this->getLastQuery()[0]);
            }

            $data = $this->fetchAssoc($result);

            if (isset($data[0])) {
                return $data[0];
            }

            return null;
        }

        return $this->limit(1)->query()->fetchAssoc();
    }
208204
protected static function getFirstRow(array $data)
    {
        if (empty($data)) {
            throw new \InvalidArgumentException('Empty data.');
        }

        list($first) = $data;

        if (!is_array($first)) {
            throw new \InvalidArgumentException('$data is not an array of array.');
        }

        return $first;
    }
646637
public function first($throw = true)
	{
		$this->limit(1);

		$result = $this->offsetGet(0);

		if ($result) {
			return $result;
		} elseif ($throw) {
			throw new \PDOException(get_class($this) . ' "' . $this->table_name . '" not found (' . implode($this->where_scope, ', ') . ')');
		}

		return null;
	}
583504
public function next()
    {
        if (is_null($this->client)) {
            throw new \Exception('No client reference passed to response');
        }
        if (is_null($this->query)) {
            throw new \Exception('No query available');
        }
        if (is_null($this->nextRecordPosition)) {
            return null;
        }
        return $this->client->search($this->query, $this->nextRecordPosition, count($this->records));
    }
165111
public function first()
    {
        $this->executeBeforeCallback();

        return count($this->items) > 0 ? reset($this->items) : null;
    }
551599
protected function getInputRow()
    {
        $view = $this->getFirstAncestor('SwatTableView');
        if ($view === null) {
            return null;
        }

        $row = $view->getFirstRowByClass('SwatTableViewInputRow');

        return $row;
    }
6413
public function getRowsList()
    {
        //check whether workshett name is set or not
        if ($this->worksheetName == '')
            throw new Exception('Worksheet name not specified');
        $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
            '/worksheets/' . $this->worksheetName . '/cells/rows';
        $signedURI = Utils::sign($strURI);
        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');
        $json = json_decode($responseStream);
        $listRows = array();
        foreach ($json->Rows->RowsList as $row) {
            $strURI = Product::$baseProductUri . '/cells/' . $this->getFileName() .
                '/worksheets/' . $this->worksheetName . '/cells/rows' . $row->link->Href;
            $signedURI = Utils::sign($strURI);
            $responseStream = Utils::processCommand($signedURI, 'GET', '', '');
            $json = json_decode($responseStream);
            array_push($listRows, $json->Row);
        }
        return $listRows;

    }