Generate input id based on provided name

@return string
321838
protected function generateId()
    {
        $inputId = static::$idPrefix . $this->getName();
        if ($this->isMultiple()) {
            $inputId = "{$inputId}-{$this->instances}";
        }
        $this->setAttribute('id', $inputId);
        return $inputId;
    }
1021001
public function sampleId()
    {
        if (!$this->sampleId) {
            $this->sampleId = $this->inputId() ?: $this->generateSampleId();
        }

        return $this->sampleId;
    }
1165909
protected function generateIdentifier()
    {
        if ($this->identifier === null) {
            ++self::$nextIdentifier;
            self::$nextIdentifier &= 0xFFFF;

            $this->identifier = self::$nextIdentifier;
        }

        return $this->identifier;
    }
803561
public function generateID()
    {
        $id = $this->getID();
        $fmt_string = "%08s";
        if (is_array($id))
            $id = implode("-", $id);

        if (empty($id))
            throw new Exception("Cannot generate an ID for an empty object");

        $id = substr(sha1($id), 0, 10);
        $acl_class = $this->getACLClass();

        return $acl_class . "#" . $id;
    }
206863
public function generate()
    {
        return sprintf(
            '<input type="hidden" id="ctrl_%s" name="%s" value="%s" /><span>%s</span>',
            $this->strId,
            $this->strName,
            StringUtil::specialchars($this->varValue),
            $this->label
        );
    }
700691
private function generateRequestId()
    {
        static $pid = -1;
        static $addr = -1;

        if ($pid == -1) {
            $pid = getmypid();
        }

        if ($addr == -1) {
            if (array_key_exists('SERVER_ADDR', $_SERVER)) {
                $addr = ip2long($_SERVER['SERVER_ADDR']);
            } else {
                $addr = php_uname('n');
            }
        }

        return $addr . $pid . $_SERVER['REQUEST_TIME'] . mt_rand(0, 0xffff);
    }
672113
public function id($name)
    {
        $keepIdx = preg_replace('/\[(\d+)\]/', "_$1", $name);
        $unbracketted = $this->removeBrackets($keepIdx, '_');
        $nothingWeird = preg_replace('/[^\w\d\_]+?/', "", $unbracketted);
        $noTrail = preg_replace('/_$/', "", $nothingWeird);

        $clean = $noTrail;

        if (!is_null($this->associatedEntity) && $this->associatedEntity->isSupportedAttribute($name)) {
            $clean = $this->associatedEntity->getInputName() . "_" . $clean;
        }

        return $this->keys['POST_WRAP'] . "_" . $clean;
    }
671723
public function getUid()
    {
        $session_user_id = $this->user->getId();

        if (!empty($session_user_id)) {
            return (string) $session_user_id;
        }

        $cookie_name = $this->getCookieUserName();
        $cookie_user_id = $this->request->cookie($cookie_name, '', 'string');

        if (!empty($cookie_user_id)) {
            return $cookie_user_id;
        }

        $generated_user_id = '_' . gplcart_string_random(6);
        $this->request->setCookie($cookie_name, $generated_user_id, $this->getCookieLifespan());
        return $generated_user_id;
    }
667798
public function generateUsername()
    {
        // try to use username part of email
        $this->username = explode('@', $this->email)[0];
        if ($this->validate(['username'])) {
            return $this->username;
        }

        // generate name like "user1", "user2", etc...
        while (!$this->validate(['username'])) {
            $row = (new Query())->from('{{%user}}')->select('MAX(id) as id')->one();
            $this->username = 'user' . ++$row['id'];
        }
        return $this->username;
    }
1372105
public function getKeyName()
	{
		if (isset($this->primaryKey)) return $this->primaryKey;
		
		return 'id_' . str_replace('\\', '', snake_case(class_basename($this)));
	}
302903
public function getInputName()
    {
        $key = $this->grid->getInputProcessor()->getKey();
        $name = $this->config->getId();
        return "{$key}[filters][{$name}]";
    }
778367
public function getId()
    {
        if (!isset($this->attributes['id'])) {
            $this->buildIdAttr(Container::getRequest()->getParam(self::AI_KEY));
        }
        return $this->attributes['id'];
    }
12899
public function input($name, $value = '', $id = '', $class = '', array $attrs = array())
    {
        return '<input id="' . $id . '" class="' . $class . '" type="' . $this->_type . '" name="' . $name . '"
                          value="' . $value . '" ' . $this->buildAttrs($attrs) . '/>';
    }
336272
public static function generateId()
    {
        while ($rand = rand(1, PHP_INT_MAX)) {
            if (!in_array($rand, static::$generatedIds, true)) {
                static::$generatedIds[] = $rand;
                return $rand;
            }
        }
    }
406903
public function getNameIdFormat()
    {
        $nameIdFormat = null;
        $nameIdData = $this->getNameIdData();
        if (!empty($nameIdData) && isset($nameIdData['Format'])) {
            $nameIdFormat = $nameIdData['Format'];
        }
        return $nameIdFormat;
    }
111207
public function generateElementId(Element $element) : string
    {
        preg_match('/^([a-zA-Z0-9]*)/', $element->getName(), $matches);
        $name = $matches[0];

        if (! isset($this->ids[$name])) {
            $this->ids[$name] = 0;
        }

        return $this->getId() . '-' . $name . '-' . $this->ids[$name]++;
    }
258972
public function generatePadID(): string
    {
        $chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        $length = 16;
        $padID = "";

        for ($i = 0; $i < $length; $i++) {
            $padID .= $chars[rand() % strlen($chars)];
        }

        return $padID;
    }