Find common give names of unknown sexes.

@param int $threshold
@param int $maxtoshow

@return string
327552
public function commonGivenUnknown(int $threshold = 1, int $maxtoshow = 10): string
    {
        return $this->commonGivenQuery('U', 'nolist', false, $threshold, $maxtoshow);
    }
183294
function getThreshold(threshold) {
			if (min > threshold) {
				threshold = min;
			} else if (max < threshold) {
				threshold = max;
			}

			return translate(threshold, 0, 1);
		}
684427
public function setThreshold($threshold)
    {

        // need to return << true
        if (is_array($threshold) === true) {
            $threshold = array_map('intval', array_splice($threshold, 0, 2));
        }

        else {
            $threshold = intval($threshold);
        }
        $this->validator->verify($threshold, [], 'threshold');

        return $this;
    }
231591
protected function can_view_fullnames($course, $forum, $discussion, $post, $cm, $context) {
        if (!isset($this->viewfullnames[$forum->id])) {
            $this->viewfullnames[$forum->id] = has_capability('moodle/site:viewfullnames', $context, $this->recipient->id);
        }

        return $this->viewfullnames[$forum->id];
    }
460936
protected function _suffix($reset = false) {
		static $_splitCount = 0;
		static $_splitCounter = 0;

		if ($reset) {
			$_splitCount = 0;
			$_splitCounter = 0;
		}
		extract($this->_config);
		if ($splitDepth || $splitCount) {
			if (!$splitDepth) {
				$_splitCount = $totalNodes / $splitCount;
				$rounded = (int)$_splitCount;
				if ($rounded < $_splitCount) {
					$_splitCount = $rounded + 1;
				}
			} elseif ($depth == $splitDepth - 1) {
				$total = $numberOfDirectChildren ? $numberOfDirectChildren : $numberOfTotalChildren;
				if ($total) {
					$_splitCounter = 0;
					$_splitCount = $total / $splitCount;
					$rounded = (int)$_splitCount;
					if ($rounded < $_splitCount) {
						$_splitCount = $rounded + 1;
					}
				}
			}
			if (!$splitDepth || $depth == $splitDepth) {
				$_splitCounter++;
				if ($type && ($_splitCounter % $_splitCount) === 0 && !$lastChild) {
					unset($this->_config['callback']);

					return '</' . $type . '><' . $type . '>';
				}
			}
		}
	}
549255
public function commonGivenUnknownTable(int $threshold = 1, int $maxtoshow = 10): string
    {
        return $this->commonGivenQuery('U', 'table', false, $threshold, $maxtoshow);
    }
1374016
public function commonGivenMaleTotals(int $threshold = 1, int $maxtoshow = 10): string
    {
        return $this->commonGivenQuery('M', 'nolist', true, $threshold, $maxtoshow);
    }
309281
public function commonGiven(int $threshold = 1, int $maxtoshow = 10): string
    {
        return $this->commonGivenQuery('B', 'nolist', false, $threshold, $maxtoshow);
    }
311120
public function getMostViewedProductCollection($from, $to, $limit, $catId, $catName)
    {
        $reportProductCollection = $this->reportProductCollection->create()
            ->addViewsCount($from, $to)
            ->setPageSize($limit);

        //filter collection by category by category_id
        if ($catId) {
            $category = $this->categoryFactory->create();
            $this->categoryResource->load($category, $catId);
            if ($category->getId()) {
                $reportProductCollection->getSelect()
                    ->joinLeft(
                        ['ccpi' => $this->getTable('catalog_category_product_index')],
                        'e.entity_id = ccpi.product_id',
                        ['category_id']
                    )
                    ->where('ccpi.category_id =?', $catId);
            } else {
                $this->helper->log(
                    'Most viewed. Category id ' . $catId
                    . ' is invalid. It does not exist.'
                );
            }
        }

        //filter collection by category by category_name
        if ($catName) {
            $category = $this->categoryFactory->create()
                ->loadByAttribute('name', $catName);
            if ($category->getId()) {
                $reportProductCollection->getSelect()
                    ->joinLeft(
                        ['ccpi' => $this->getTable('catalog_category_product_index')],
                        'e.entity_id  = ccpi.product_id',
                        ['category_id']
                    )
                    ->where('ccpi.category_id =?', $category->getId());
            } else {
                $this->helper->log(
                    'Most viewed. Category name ' . $catName
                    . ' is invalid. It does not exist.'
                );
            }
        }

        return $reportProductCollection;
    }
667126
private function getInstancesMaxAllowedDeclaration()
    {

        if( !$this->isMultiton() or !array_key_exists( 'instancesMaxAllowed', $this->entity->normalityTags ) ) {
            return array();
        }

        $instancesMaxAllowed = is_numeric( $this->entity->normalityTags['instancesMaxAllowed'] )
            ? (int) $this->entity->normalityTags['instancesMaxAllowed']
            : null
            ;

        $instancesMaxAllowed = Php::varExport( $instancesMaxAllowed, true );

        $this->class->classComponents[] = new VariableDeclaration(
            'instancesMaxAllowed',
            new SFormatf( <<<'PHP'
                /**
                 * Max number of instances stored by our multiton cache
                 * @var array
                 */
                protected $instancesMaxAllowed = %s;
PHP
                , $instancesMaxAllowed
            )
        );

    }
461710
public function drawContour($Threshold, array $Format = [])
    {
        $R = isset($Format["R"]) ? $Format["R"] : 0;
        $G = isset($Format["G"]) ? $Format["G"] : 0;
        $B = isset($Format["B"]) ? $Format["B"] : 0;
        $Alpha = isset($Format["Alpha"]) ? $Format["Alpha"] : 100;
        $Ticks = isset($Format["Ticks"]) ? $Format["Ticks"] : 3;
        $Padding = isset($Format["Padding"]) ? $Format["Padding"] : 0;

        $X0 = $this->pChartObject->GraphAreaX1;
        $Y0 = $this->pChartObject->GraphAreaY1;
        $XSize = ($this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1) / ($this->GridSizeX + 1);
        $YSize = ($this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1) / ($this->GridSizeY + 1);

        $Color = ["R" => $R, "G" => $G, "B" => $B, "Alpha" => $Alpha, "Ticks" => $Ticks];

        for ($X = 0; $X <= $this->GridSizeX; $X++) {
            for ($Y = 0; $Y <= $this->GridSizeY; $Y++) {
                $Value = $this->Points[$X][$Y];

                if ($Value != UNKNOWN && $Value != IGNORED && $Value >= $Threshold) {
                    $X1 = floor($X0 + $X * $XSize) + $Padding;
                    $Y1 = floor($Y0 + $Y * $YSize) + $Padding;
                    $X2 = floor($X0 + $X * $XSize + $XSize);
                    $Y2 = floor($Y0 + $Y * $YSize + $YSize);

                    if ($X > 0 && $this->Points[$X - 1][$Y] != UNKNOWN
                        && $this->Points[$X - 1][$Y] != IGNORED
                        && $this->Points[$X - 1][$Y] < $Threshold
                    ) {
                        $this->pChartObject->drawLine($X1, $Y1, $X1, $Y2, $Color);
                    }
                    if ($Y > 0 && $this->Points[$X][$Y - 1] != UNKNOWN
                        && $this->Points[$X][$Y - 1] != IGNORED
                        && $this->Points[$X][$Y - 1] < $Threshold
                    ) {
                        $this->pChartObject->drawLine($X1, $Y1, $X2, $Y1, $Color);
                    }
                    if ($X < $this->GridSizeX
                        && $this->Points[$X + 1][$Y] != UNKNOWN
                        && $this->Points[$X + 1][$Y] != IGNORED
                        && $this->Points[$X + 1][$Y] < $Threshold
                    ) {
                        $this->pChartObject->drawLine($X2, $Y1, $X2, $Y2, $Color);
                    }
                    if ($Y < $this->GridSizeY
                        && $this->Points[$X][$Y + 1] != UNKNOWN
                        && $this->Points[$X][$Y + 1] != IGNORED
                        && $this->Points[$X][$Y + 1] < $Threshold
                    ) {
                        $this->pChartObject->drawLine($X1, $Y2, $X2, $Y2, $Color);
                    }
                }
            }
        }
    }
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;
        }
    }
737613
public function topTenOldestFemaleList(int $total = 10): string
    {
        $records = $this->topTenOldestQuery('F', $total);

        return view('statistics/individuals/top10-list', [
            'records' => $records,
        ]);
    }
118064
public function findUsersOwnersOfMostWorkspaces($max, $organizations = null)
    {
        $orgasJoin = '';
        $orgasCondition = '';
        if (null !== $organizations) {
            $orgasJoin = 'JOIN ws.organizations orgas';
            $orgasCondition = 'AND orgas IN (:organizations)';
        }

        $dql = "
            SELECT CONCAT(CONCAT(u.firstName,' '), u.lastName) AS name, u.username, COUNT(DISTINCT ws.id) AS total
            FROM Claroline\CoreBundle\Entity\Workspace\Workspace ws
            JOIN ws.creator u
            ${orgasJoin}
            WHERE u.isRemoved = false
            ${orgasCondition}
            GROUP BY u.id
            ORDER BY total DESC
        ";
        $query = $this->_em->createQuery($dql);

        if (null !== $organizations) {
            $query->setParameter('organizations', $organizations);
        }

        if ($max > 1) {
            $query->setMaxResults($max);
        }

        return $query->getResult();
    }
614820
static public function radio_gender($name, $value=null, $settings=[])
    {
        if (!isset($settings['data_source'])) {
            $settings['data_source'] = Constants::getGenders();
        }
        $settings['class'] = (isset($settings['class']) ? $settings['class'] : '' ) . ' list-inline';
        $value = Constants::getGenderValue($value);
        
        return static::radio_group($name, $value, $settings);
    }
502740
private function topTenOldestAliveQuery(string $sex, int $total): array
    {
        $query = DB::table('dates')
            ->join('individuals', static function (JoinClause $join): void {
                $join
                    ->on('i_id', '=', 'd_gid')
                    ->on('i_file', '=', 'd_file');
            })
            ->where('d_file', '=', $this->tree->id())
            ->where('d_julianday1', '<>', 0)
            ->where('d_fact', '=', 'BIRT')
            ->where('i_gedcom', 'NOT LIKE', "%\n1 DEAT%")
            ->where('i_gedcom', 'NOT LIKE', "%\n1 BURI%")
            ->where('i_gedcom', 'NOT LIKE', "%\n1 CREM%");

        if ($sex === 'F' || $sex === 'M') {
            $query->where('i_sex', '=', $sex);
        }

        return $query
            ->groupBy(['i_id', 'i_file'])
            ->orderBy(DB::raw('MIN(d_julianday1)'))
            ->select('individuals.*')
            ->take($total)
            ->get()
            ->map(Individual::rowMapper())
            ->filter(GedcomRecord::accessFilter())
            ->map(function (Individual $individual): array {
                return [
                    'person' => $individual,
                    'age'    => $this->calculateAge(Carbon::now()->julianDay() - $individual->getBirthDate()->minimumJulianDay()),
                ];
            })
            ->all();
    }
721664
public function fullName(): string
    {
        if ($this->canShowName()) {
            $tmp = $this->getAllNames();

            return $tmp[$this->getPrimaryName()]['full'];
        }

        return I18N::translate('Private');
    }