Method used internally for shortening object names.

@param string $desired Desired name of new object.

@return string Shortened name of new object.
502413
protected function _shorten($desired)
    {
        if (
            isset($this->_appScopeTrait) &&
            isset($this->app->max_name_length) &&
            strlen($desired) > $this->app->max_name_length
        ) {

            /*
             * Basic rules: hash is 10 character long (8+2 for separator)
             * We need at least 5 characters on the right side. Total must not exceed
             * max_name_length. First chop will be max-10, then chop size will increase by
             * max-15
             */
            $len = strlen($desired);
            $left = $len - ($len - 10) % ($this->app->max_name_length - 15) - 5;

            $key = substr($desired, 0, $left);
            $rest = substr($desired, $left);

            if (!isset($this->app->unique_hashes[$key])) {
                $this->app->unique_hashes[$key] = '_'.dechex(crc32($key));
            }
            $desired = $this->app->unique_hashes[$key].'__'.$rest;
        }

        return $desired;
    }
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;
        }
    }
712272
public function shorten($url)
    {
        $link = new Link;
        $link->setLongUrl($url);
        $this->provider->shorten($link);
        return $link->getShortUrl();
    }
211820
public function rename($short_name)
    {
        unset($this->owner->elements[$this->short_name]);
        $this->name = $this->name.'_'.$short_name;
        $this->short_name = $short_name;

        if (!$this->auto_track_element) {
            $this->owner->elements[$short_name] = true;
        } else {
            $this->owner->elements[$short_name] = $this;
        }

        return $this;
    }
306400
public function getShortDescriptor()
    {
        if ($this->shortDescriptorField === false) {
            $value = $this->descriptor;
        } else {
            $value = $this->parseDescriptorField($this->shortDescriptorField);
        }
        if ($this->shortDescriptorLength) {
            if (strlen($value) > $this->shortDescriptorLength) {
                $value = substr($value, 0, $this->shortDescriptorLength) . '…';
            }
        }

        return $value;
    }
1371314
private function useShortGetterName($field_name)
    {
        return substr($field_name, 0, 3) === 'is_' || in_array(substr($field_name, 0, 4), ['has_', 'had_', 'was_']) || in_array(substr($field_name, 0, 5), ['were_', 'have_']);
    }
1129243
public static function extractShortNameFromFullyQualifiedName($name)
    {
        if (($pos = strrpos($name, '\\')) !== false) {
            return substr($name, $pos + 1);
        } else {
            return $name;
        }
    }
1130706
public function getLongName($name)
    {
        if (!$this->isParsed) {
            $this->parseDefinitions();
        } //if

        if (isset($this->shortNames[$name])) {
            return $this->shortNames[$name];
        } else {
            return null;
        } //if
    }
787457
protected function shortName($name)
    {
        $name = str_replace('_', ' ', $name);
        $name = ucwords($name);

        return str_replace(' ', '', $name);
    }
688608
protected function shorten_path( string $path ): string {
		$path = wp_normalize_path( $path );
		$path = str_replace( $this->truncate_paths, '', $path );
		if ( ':' === $path[1] ) {
			$path = substr( $path, 2 );
		}
		$path = ltrim( $path, '/' );

		return $path;
	}
415100
protected function getNameWithoutPrefix()
    {
        if ($this->isObjectAccessorMode()) {
            $propertySegments = explode('.', $this->arguments['property']);
            $formObjectName = $this->viewHelperVariableContainer->get(\TYPO3\Fluid\ViewHelpers\FormViewHelper::class, 'formObjectName');
            if (!empty($formObjectName)) {
                array_unshift($propertySegments, $formObjectName);
            }
            $name = array_shift($propertySegments);
            foreach ($propertySegments as $segment) {
                $name .= '[' . $segment . ']';
            }
        } else {
            $name = $this->arguments['name'];
        }
        if ($this->hasArgument('value')) {
            /** @var object $value */
            $value = $this->arguments['value'];
            $multiple = $this->hasArgument('multiple') && $this->arguments['multiple'] === true;
            if (!$multiple
                && is_object($value)
                && $this->persistenceManager->getIdentifierByObject($value) !== null
                && (!$this->persistenceManager->isNewObject($value))) {
                $name .= '[__identity]';
            }
        }

        return $name;
    }
186025
public function length($min = null, $max = null)
	{
		$lastSegmentKey = $this->getLastSegmentKey();

		if (!is_null($min) && !is_null($max) && $max > $min)
		{
			$lengthPattern = sprintf('{%d,%d}', (int) $min, (int) $max);
		}
		elseif (!is_null($min) && !$max)
		{
			$lengthPattern = sprintf('{%d}', (int) $min);
		}
		else
		{
			$lengthPattern = '{1}';
		}

		return $this->replaceQuantifierByKey($lastSegmentKey, $lengthPattern);
	}
1310537
protected function helper_fullname_format() {
        $fake = new stdClass();
        $fake->lastname = 'LLLL';
        $fake->firstname = 'FFFF';
        $fullname = get_string('fullnamedisplay', '', $fake);
        if (strpos($fullname, 'LLLL') < strpos($fullname, 'FFFF')) {
            return 'lf';
        } else {
            return 'fl';
        }
    }
115870
public function shortenPath()
    {
        if ($this->scheme !== 'file'
            || !(count($this->path) === 1 && preg_match(static::NORMALIZED_WINDOWS_DRIVE_LETTER, $this->path[0]) === 1)) {
            array_pop($this->path);
        }
    }
469026
private function _getShortClassname()
    {
        if( $this->_shortClassName )
            return $this->_shortClassName;

        $this->_shortClassName = substr( $this->_getFullClassname(), strrpos( $this->_getFullClassname(), '\\' ) + 1 );

        return $this->_shortClassName;
    }
10530
public function shortName()
    {
        if ($this->isAce()) {
            return self::ACE_SYMBOL;
        }
        if ($this->isKing()) {
            return self::KING_SYMBOL;
        }
        if ($this->isQueen()) {
            return self::QUEEN_SYMBOL;
        }
        if ($this->isJack()) {
            return self::JACK_SYMBOL;
        }
        if ($this->value() === 10) {
            return self::TEN_SYMBOL;
        }

        return (string) $this->value();
    }
1192682
public static function format($name)
    {
        if (false !== ($pos = strrpos($name, '__'))) {
            $name = substr($name, 0, $pos);
        }

        return $name;
    }