Returns the formatted type of the first/last occuring event.

@param string $direction The sorting direction

@return string
546999
private function getFirstLastEventType(string $direction): string
    {
        $row = $this->eventQuery($direction);

        if ($row) {
            $event_types = [
                self::EVENT_BIRTH    => I18N::translate('birth'),
                self::EVENT_DEATH    => I18N::translate('death'),
                self::EVENT_MARRIAGE => I18N::translate('marriage'),
                self::EVENT_ADOPTION => I18N::translate('adoption'),
                self::EVENT_BURIAL   => I18N::translate('burial'),
                self::EVENT_CENSUS   => I18N::translate('census added'),
            ];

            return $event_types[$row->fact] ?? GedcomTag::getLabel($row->fact);
        }

        return '';
    }
981742
function( useComputed ) {
			if ( useComputed ) {
				return this.getComputedStyle( 'direction' ) ||
						this.getDirection() ||
						this.getParent() && this.getParent().getDirection( 1 ) ||
						this.getDocument().$.dir ||
						'ltr';
			}
			else {
				return this.getStyle( 'direction' ) || this.getAttribute( 'dir' );
			}
		}
419068
public function getForJsonFacet($sorting, $direction)
    {
        $isMetricSorting = strpos($sorting, 'metrics_') === 0;
        $expression = $isMetricSorting ? $sorting : $this->getForFacet($sorting);
        $direction = strtolower($direction);
        if (!empty($direction) && in_array($direction, ['asc', 'desc'])) {
            $expression .= ' ' . $direction;
        }
        return $expression;
    }
571029
function getFirstLastDate($dateA, $dFormat = "Y/m/d") {

//    $fDate = $lDate = date("m/d/y",time());
        $fDate = $lDate = date($dFormat, time());
        asort($dateA); // TODO
        $i = 0;
        $maxItem = count($dateA);
        foreach ($dateA as $k => $one) {
            if ($i == 0)
                $firstDate = $k;
            if ($i == $maxItem - 1)
                $lastDate = $k;
            $i++;
        }
        $fDate = date($dFormat, strtotime($firstDate));
        $lDate = date($dFormat, strtotime($lastDate));
        return array($fDate, $lDate);
    }
99871
private function getSequentialStage(string $direction): ?StageInterface
    {
        $dir = in_array($direction, ['prev', 'next']) ? $direction : 'next';
        ksort($this->stageOrder);
        // forward the array pointer to the current index
        while (current($this->stageOrder) !== $this->currentStageName && null !== key($this->stageOrder)) {
            next($this->stageOrder);
        }
        $key = $dir($this->stageOrder);
        if (null !== $key && false !== $key) {
            return $this->getStageInstance($this->stagesByName[$key]);
        }

        return null;
    }
1198596
public function getSortURL($direction = false)
    {
        if (!$direction) {
            // No direction indicated, determine automatically from defaults.
            $direction = $this->getDirection();

            if ($this->isSorted()) {
                // If we are already sorting by this column, swap the direction
                $direction = $direction == 'asc' ? 'desc' : 'asc';
            }
        }

        // Generate and return a URL which may be used to sort this column
        return $this->generateUrl(array_filter([
            config('gbrock-tables.key_field')     => $this->getField(),
            config('gbrock-tables.key_direction') => $direction,
        ]));
    }
284037
public function getExclusiveTokenString($direction = self::NEXT, $allowedTokensBetween = array(), $useDefaultIgnores = true)
    {

        $token = $this->getExclusiveToken($direction, $allowedTokensBetween, $useDefaultIgnores);

        if (is_array($token)) {
            if (is_int($token[0]) || $token[0] instanceof Enum) {
                return $token[1];
            } else {
                return (string)$token[0];
            }
        } else {
            return (string)$token;
        }
    }
1026781
public static function format(FSEvent $event): string
    {
        $item = is_dir($event->getPath()) ? 'Directory' : 'File';
        $events = implode(', ', $event->getTypes());
        $time = $event->getWhen()->format('Y.m.d H:i:s');

        return sprintf('%s: %s %s at %s', $item, $event->getPath(), $events, $time);
    }
1092115
public static function arrow(string $direction) : string
    {
        switch ($direction) {
            case "up": 	  $output = '<span class="arrow">&uarr;</span>'; break;
            case "down":  $output = '<span class="arrow">&darr;</span>'; break;
            case "left":  $output = '<span class="arrow">&larr;</span>'; break;
            case "right": $output = '<span class="arrow">&rarr;</span>'; break;
        }

        return $output;
    }
1312248
public function order($direction = null)
    {
        if (is_null($direction)) {
            $direction = $this->getOrderDirection();
        } else {
            $this->setOrderDirection($direction);
        }

        // if a direction is set
        if (!empty($direction)) {
            if (!is_string($this->order) && is_callable($this->order)) {
                call_user_func_array($this->order, $this);
            } else {

                $table = $this->getTable();

                // verify that source is a query
                if (!$table->isSourceQueryBuilder()) {
                    throw new \Exception('Table source is not an instance of query builder');
                }

                $table->getSource()->orderBy($this->order, $direction);
            }
        }

        return $this;
    }
243724
protected function getSortDirections($order)
	{
		$segs=explode(',',$order);
		$directions=array();
		foreach($segs as $seg)
		{
			if(preg_match('/(.*?)(\s+(desc|asc))?$/i',trim($seg),$matches))
				$directions[$matches[1]]=isset($matches[3]) && !strcasecmp($matches[3],'desc');
			else
				$directions[trim($seg)]=false;
		}
		return $directions;
	}
539487
private function getFormatFor($dateElement)
    {
        if ($this->dateTimeFormat->keyExists($dateElement)) {
            return $this->dateTimeFormat->key($dateElement);
        }

        return self::$formatters->key($dateElement)->first();
    }
803828
public static function fromString(string $direction): Direction
    {
        if($direction == self::IN ) {
            return self::in();
        } else if($direction == self::OUT) {
            return self::out();
        } else {
            throw new Exceptions\InvalidDirectionException($direction);
        }
    }
1250835
static function GetType($num)
	{
		$firstOne = substr($num,0,1);

		if (strlen($num) < 4) return "";
		if ($firstOne == 4) return "Visa";

		$firstTwo = substr($num,0,2);
		if ($firstTwo == 34 || $firstTwo == 37) return "AmEx";
		if ($firstTwo >= 51 && $firstTwo <= 55) return "MasterCard";
		if ($firstTwo == 36 || $firstTwo == 38 || $firstTwo == 54 || $firstTwo == 55) return "Diners Club";

		$firstThree = substr($num,0,3);
		if ($firstThree >= 300 && $firstThree <= 305) return "Carte Blanche";
		if ($firstThree >= 644 && $firstThree <= 649) return "Discover";

		$firstFour = substr($num,0,4);
		if ($firstFour == 6011) return "Discover";
		if ($firstFour == 2014 || $firstFour == 2149) return "enRoute";
		if ($firstFour == 6011) return "Discover";

		$firstSix = substr($num,0,6);
		if ($firstSix >= 622126 && $firstSix <= 622925) return "Discover";

		if ($firstOne == 3) return "JCB";
		if ($firstFour == 2131 || $firstFour == 1800) return "JCB";
		return "Other";
	}
1186262
public function getDirection()
    {
        if ($this->isSorted()) {
            // If the column is currently being sorted, grab the direction from the query string
            $this->direction = Request::input(config('gbrock-tables.key_direction'));
        }

        if (!$this->direction) {
            $this->direction = config('gbrock-tables.default_direction');
        }

        return $this->direction;
    }
1073745
public function occurred_at_formatted()
    {
        return ucfirst($this->dates->make($this->wrappedObject->occurred_at)->format($this->incidentDateFormat()));
    }
876707
public function FirstLast()
    {
        if ($this->First() && $this->Last()) {
            return 'first last';
        }
        if ($this->First()) {
            return 'first';
        }
        if ($this->Last()) {
            return 'last';
        }
        return null;
    }