Find common give names of males.

@param int $threshold
@param int $maxtoshow

@return string
513112
public function commonGivenMaleListTotals(int $threshold = 1, int $maxtoshow = 10): string
    {
        return $this->commonGivenQuery('M', 'list', true, $threshold, $maxtoshow);
    }
1027043
public function getName()
    {
        /** @var Attendee $attendee */
        if (($mainContact = $this->MainContact()) && $mainContact->exists() && $name = $mainContact->getName()) {
            return $name;
        } else {
            return 'new reservation';
        }
    }
591155
public function get_short_question_name($stringtoshorten, $characterlimit)
    {
        if (!empty($stringtoshorten)) {
            $returnstring = format_string($stringtoshorten);
            if (strlen($returnstring) > $characterlimit) {
                $returnstring = shorten_text($returnstring, $characterlimit, true);
            }
            return $returnstring;
        } else {
            return '';
        }
    }
262700
private function commonSurnamesQuery(
        string $type,
        bool $show_tot,
        int $threshold,
        int $number_of_surnames,
        string $sorting
    ): string {
        $surnames = $this->topSurnames($number_of_surnames, $threshold);

        switch ($sorting) {
            default:
            case 'alpha':
                uksort($surnames, [I18N::class, 'strcasecmp']);
                break;
            case 'count':
                break;
            case 'rcount':
                $surnames = array_reverse($surnames, true);
                break;
        }

        //find a module providing individual lists
        $module = app(ModuleService::class)->findByComponent(ModuleListInterface::class, $this->tree, Auth::user())->first(static function (ModuleInterface $module): bool {
            return $module instanceof IndividualListModule;
        });
        
        return FunctionsPrintLists::surnameList(
            $surnames,
            ($type === 'list' ? 1 : 2),
            $show_tot,
            $module,
            $this->tree
        );
    }
1373385
public static function isLengthGte($value, $max)
    {
        is_array($max) && $max = $max[0];
        return self::isLength($value, $max);
    }
836929
public function getTtl(): ?int
    {
        $maxAge = $this->getMaxAge();

        return null !== $maxAge ? $maxAge - $this->getAge() : null;
    }
671796
public function commonGivenUnknownTotals(int $threshold = 1, int $maxtoshow = 10): string
    {
        return $this->commonGivenQuery('U', 'nolist', true, $threshold, $maxtoshow);
    }
134699
private function topSurnames(int $number_of_surnames, int $threshold): array
    {
        // Use the count of base surnames.
        $top_surnames = DB::table('name')
            ->where('n_file', '=', $this->tree->id())
            ->where('n_type', '<>', '_MARNM')
            ->whereNotIn('n_surn', ['', '@N.N.'])
            ->select('n_surn')
            ->groupBy('n_surn')
            ->orderByRaw('count(n_surn) desc')
            ->take($number_of_surnames)
            ->get()
            ->pluck('n_surn')
            ->all();

        $surnames = [];
        foreach ($top_surnames as $top_surname) {
            $variants = DB::table('name')
                ->where('n_file', '=', $this->tree->id())
                ->where(DB::raw('n_surn /* COLLATE ' . I18N::collation() . ' */'), '=', $top_surname)
                ->select('n_surn', DB::raw('COUNT(*) AS count'))
                ->groupBy('n_surn')
                ->get()
                ->pluck('count', 'n_surn')
                ->all();

            if (array_sum($variants) > $threshold) {
                $surnames[$top_surname] = $variants;
            }
        }

        return $surnames;
    }
471024
public function isPorn($threshold = FALSE) {
        return $threshold === FALSE
            ? $this->quantifyYCbCr() >= $this->threshold
            : $this->quantifyYCbCr() >= $threshold;
    }
215093
public function countByScore($min, $max){
        return $this->getConnection()->getSlave()->zCount($this->name, $min, $max);
    }
815449
public function getGroupsByWorkspaceAndName(Workspace $workspace, $search, $page, $max = 50)
    {
        $query = $this->groupRepo->findByWorkspaceAndName($workspace, $search, false);

        return $this->pagerFactory->createPager($query, $page, $max);
    }
709902
public function commonGivenList(int $threshold = 1, int $maxtoshow = 10): string
    {
        return $this->commonGivenQuery('B', 'list', false, $threshold, $maxtoshow);
    }
346225
public function getEstimatedNbColumns($maxTotalWidth)
    {
        $i = 0;
        $rowWidth = 0;

        while (isset($this->cells[$i])) {
            $rowWidth += StringUtil::getLength($this->cells[$i]);

            if ($rowWidth > $maxTotalWidth) {
                // Return previous number of columns
                return $i;
            }

            ++$i;
        }

        return $i;
    }
253015
public function get_short_filename($str, $maxlength) {
        if (core_text::strlen($str) >= $maxlength) {
            return trim(core_text::substr($str, 0, $maxlength)).'...';
        } else {
            return $str;
        }
    }
816682
public function commonGivenUnknownList(int $threshold = 1, int $maxtoshow = 10): string
    {
        return $this->commonGivenQuery('U', 'list', false, $threshold, $maxtoshow);
    }
804116
public static function smrtr($haystack, $aMatch, $aDelimiter = array("{","}")) {
        $aCleaned = array();

        foreach ($aMatch as $key => $v) {
            $aCleaned[$aDelimiter[0].$key.$aDelimiter[1]] = $v;
        }

        return strtr($haystack, $aCleaned);
    }
183294
function getThreshold(threshold) {
			if (min > threshold) {
				threshold = min;
			} else if (max < threshold) {
				threshold = max;
			}

			return translate(threshold, 0, 1);
		}