Max Record
@return  StdClass
437596
public static function max($column)
    {
        $self      = self::getInstance();
        
        if (empty($self->optionSelect)) {
            $self->optionSelect = "MAX({$column})";
        } else {
            $self->optionSelect .= ",MAX({$column})";
        }
        

        $statement = $self->makeSelect();
        $execute   = $self->exec($statement, []);

        return $execute->fetchObject();
    }
165183
private function maxLength()
	{
		$max = mb_strlen($this->value);
		if (!$ret = $max <= $this->options->max) {
			$this->error(1);
		}

		return $ret;
	}
329832
public function getMaxChunks()
	{
		return ceil(($this->name !== null ? filesize($this->name) : 0) / $this->size);
	}
450559
public function next() {
        global $DB;
        $result = new stdClass();

        while ($record = $this->csvreader->next()) {
            $idstr = $record[$this->idindex];
            // Strip the integer from the end of the participant string.
            $id = substr($idstr, strlen(get_string('hiddenuser', 'assign')));
            if ($userid = $this->assignment->get_user_id_for_uniqueid($id)) {
                if (array_key_exists($userid, $this->validusers)) {
                    $result->grade = $record[$this->gradeindex];
                    $result->modified = strtotime($record[$this->modifiedindex]);
                    $result->user = $this->validusers[$userid];
                    $result->feedback = array();
                    foreach ($this->feedbackcolumnindexes as $description => $details) {
                        if (!empty($details['index'])) {
                            $details['value'] = $record[$details['index']];
                            $result->feedback[] = $details;
                        }
                    }

                    return $result;
                }
            }
        }

        // If we got here the csvreader had no more rows.
        return false;
    }
719607
public function getMaxValue()
	{
		$retour = 0;
		foreach($this->listeValues as $indice => $value)
		{
			if(is_array($value))
			{
				for($i=0 ; $i<count($value) ; $i++)
				{
					if($value[$i]>$retour)
						$retour = $value[$i];
				}
			}
			else
			{
				if($value>$retour)
					$retour = $value;
			}
		}
		
		return $retour;
	}
191332
public function maxRole()
    {
        $roles = $this->roles;
        $r = $roles->first();

        foreach ($roles as $role){
            if($role->order > $r->order)
                $r = $role;
        }

        return $r;
    }
570631
public function getMaxDateToReprocess()
    {
        $query  = $this->getEntityManager()->getConnection()->createQueryBuilder()
            ->select('date_added')
            ->from(MAUTIC_TABLE_PREFIX.'contact_ledger_campaign_client_stats', 'clccs')
            ->where('clccs.reprocess_flag = 1')
            ->setMaxResults(1)
            ->orderBy('date_added', 'DESC');
        $result = $query->execute()->fetchAll();

        return $result;
    }
1243015
final public function from_record(stdClass $record) {
        $record = (array) $record;
        foreach ($record as $property => $value) {
            $this->raw_set($property, $value);
        }
        return $this;
    }
609016
public function toStdClass()
    {
        $this->_prepareData();
        $data = new stdClass();

        foreach ($this->toArray() as $key => $val) {
            $data->$key = $val;
        }

        return $data;
    }
3102
public function getMaxDepth()
    {
        if (0 === func_num_args() || func_get_arg(0)) {
            @trigger_error(sprintf('%s is deprecated since version 2.1 and will be removed in 3.0. Use %s::isMaxDepthEnabled() instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED);
        }

        return $this->maxDepth;
    }
828764
protected function get_grade_min_and_max() {
        global $CFG;
        $this->load_grade_item();

        // When the following setting is turned on we use the grade_grade raw min and max values.
        $minmaxtouse = grade_get_setting($this->grade_item->courseid, 'minmaxtouse', $CFG->grade_minmaxtouse);

        // Check to see if the gradebook is frozen. This allows grades to not be altered at all until a user verifies that they
        // wish to update the grades.
        $gradebookcalculationsfreeze = 'gradebook_calculations_freeze_' . $this->grade_item->courseid;
        // Gradebook is frozen, run through old code.
        if (isset($CFG->$gradebookcalculationsfreeze) && (int)$CFG->$gradebookcalculationsfreeze <= 20150627) {
            // Only aggregate items use separate min grades.
            if ($minmaxtouse == GRADE_MIN_MAX_FROM_GRADE_GRADE || $this->grade_item->is_aggregate_item()) {
                return array($this->rawgrademin, $this->rawgrademax);
            } else {
                return array($this->grade_item->grademin, $this->grade_item->grademax);
            }
        } else {
            // Only aggregate items use separate min grades, unless they are calculated grade items.
            if (($this->grade_item->is_aggregate_item() && !$this->grade_item->is_calculated())
                    || $minmaxtouse == GRADE_MIN_MAX_FROM_GRADE_GRADE) {
                return array($this->rawgrademin, $this->rawgrademax);
            } else {
                return array($this->grade_item->grademin, $this->grade_item->grademax);
            }
        }
    }
60610
public function getTotalRecords()
    {
        $qb = clone $this->queryBuilder;
        $this->_addSearch($qb);
        $qb->resetDQLPart('orderBy');

        $gb = $qb->getDQLPart('groupBy');
        if (empty($gb) || !in_array($this->fields['_identifier_'], $gb))
        {
            $qb->select(" count({$this->fields['_identifier_']}) ");
            return $qb->getQuery()->getSingleScalarResult();
        }
        else
        {
            $qb->resetDQLPart('groupBy');
            $qb->select(" count(distinct {$this->fields['_identifier_']}) ");
            return $qb->getQuery()->getSingleScalarResult();
        }
    }
662758
public function mostUsedOS()
    {
        $max = 0;
        $max_os = null;

        foreach ($this->usedOSs() as $os => $count) {
            if ($count >= $max) {
                $max = $count;
                $max_os = $os;
            }
        }

        return $max_os;
    }
659452
public function getLastPage()
    {
        return (int) \max(self::MIN_PAGE, \ceil($this->getTotal() / $this->getLimit()));
    }
571423
public function getMax($raw = false)
    {
        $max = $this->_max;
        if (!$raw && $this->useByteString()) {
            $max = $this->_toByteString($max);
        }

        return $max;
    }
795439
private function getTopNestingLevel()
    {
        $highestLevel = $this->getNestingLevel();
        foreach ($this->getChildren() as $child) {
            $childLevel = $child->getNestingLevel();
            if ($highestLevel < $childLevel) {
                $highestLevel = $childLevel;
            }
        }

        return $highestLevel;
    }
484009
protected function getMaxOrdering()
    {
        $table  = $this->getTable();
        $db     = $table->getDriver();

        $query = $this->getObject('lib:database.query.select')
            ->columns('MAX(ordering)')
            ->table($table->getName());

        $this->_buildQueryWhere($query);

        return (int) $db->select($query, Database::FETCH_FIELD);
    }