Получает id highload-блока
@param $hlblockName - id, имя или фильтр
@return int|mixed
@throws \Bitrix\Main\ArgumentException
196515
public function getHlblockId($hlblockName) {
        $item = $this->getHlblock($hlblockName);
        return ($item && isset($item['ID'])) ? $item['ID'] : 0;
    }
124387
protected function getItemsIblockShard()
    {
        $items = [];

        $rsIblocks = IblockTable::query()
            ->setFilter(['ID' => $this->id])
            ->setSelect(['IBLOCK_TYPE_ID', 'CODE'])
            ->exec();

        if ($iblock = $rsIblocks->fetch()) {
            if ($iblock['CODE']) {
                $items['CODE'] = $iblock['CODE'];
            }

            $items['TYPE'] = $iblock['IBLOCK_TYPE_ID'];
        }

        if (empty($items)) {
            throw new ValueNotFoundException('Iblock', 'ID #' . $this->id);
        }

        $propIds = [];

        $rsProps = PropertyTable::query()
            ->setFilter(['IBLOCK_ID' => $this->id])
            ->setSelect(['ID', 'CODE', 'IBLOCK_ID'])
            ->exec();

        while ($prop = $rsProps->fetch()) {
            $propIds[] = $prop['ID'];
            $items['PROPS_ID'][$prop['CODE']] = $prop['ID'];
        }

        if (!empty($propIds)) {
            $rsPropsEnum = PropertyEnumerationTable::query()
                ->setFilter(['PROPERTY_ID' => $propIds])
                ->setSelect(['ID', 'XML_ID', 'PROPERTY_ID', 'PROPERTY_CODE' => 'PROPERTY.CODE'])
                ->exec();

            while ($propEnum = $rsPropsEnum->fetch()) {
                if ($propEnum['PROPERTY_CODE']) {
                    $items['PROPS_ENUM_ID'][$propEnum['PROPERTY_CODE']][$propEnum['XML_ID']] = $propEnum['ID'];
                }
            }
        }

        $this->registerCacheTag('bex_iblock_' . $this->id);

        return $items;
    }
166593
protected function HLGetIdByCode($entity)
    {
        $filter = [
            'filter' => ['=NAME' => $entity],
        ];
        $hlblock = HighloadBlockTable::getRow($filter);

        return !empty($hlblock['ID']) ? $hlblock['ID'] : null;
    }
1250297
protected function getIblockPropIdByCode($code, $iblockId)
    {
        $filter = [
            'CODE'      => $code,
            'IBLOCK_ID' => $iblockId,
        ];

        $prop = CIBlockProperty::getList(['sort' => 'asc', 'name' => 'asc'], $filter)->getNext();
        if (!$prop || !$prop['ID']) {
            throw new MigrationException("Не удалось найти свойство с кодом '{$code}'");
        }

        return $prop['ID'];
    }
993870
public function getHlblocks($filter = array()) {
        $dbres = HL\HighloadBlockTable::getList(
            array(
                'select' => array('*'),
                'filter' => $filter,
            )
        );

        $result = [];
        while ($hlblock = $dbres->fetch()) {
            $hlblock['LANG'] = $this->getHblockLangs($hlblock['ID']);
            $result[] = $hlblock;
        }

        return $result;
    }
399670
public function acquire($blocking = true)
    {
        if ($this->locked) {
            throw new \RuntimeException('already lock by yourself');
        }

        if ($blocking === false) {
            if (version_compare(PHP_VERSION, '5.6.0') < 0) {
                throw new \RuntimeException('php version is at least 5.6.0 for param blocking');
            }
            if (!sem_acquire($this->lock_id, true)) {
                return false;
            }
            $this->locked = true;

            return true;
        }

        if (!sem_acquire($this->lock_id)) {
            return false;
        }
        $this->locked = true;

        return true;
    }
217268
protected function IblockTypeUpdate($data)
    {
        $return = [];
        if (empty($data['ID'])) {
            throw new Exception('You must set iblock type ID');
        }
        $res = CIBlockType::GetList([], [
            '=ID' => $data['ID'],
        ]);
        if ($ob = $res->Fetch()) {
            $ib = new CIBlockType();
            $id = $ib->Update($ob['ID'], $data);
            if ($id) {
                $return[] = "Update {$data['ID']} iblock type";
            } else {
                throw new Exception("Can't create {$data['ID']} iblock type");
            }
        } else {
            throw new Exception("Iblock type {$data['ID']} doesn't exists");
        }

        return $return;
    }
897651
public function transformEntityId($entityId) {
        if (0 === strpos($entityId, 'HLBLOCK_')) {
            $hlblockId = substr($entityId, 8);
            $hlhelper = new HlblockHelper();
            $hlblock = $hlhelper->getHlblock($hlblockId);
            if (empty($hlblock)) {
                $this->throwException(__METHOD__, '%s not found', $entityId);
            }
            $entityId = 'HLBLOCK_' . $hlblock['NAME'];
        }
        return $entityId;
    }
205939
public function getIblocksStructure() {

        $structure = [];
        $iblockHelper = new IblockHelper();

        $iblockTypes = $iblockHelper->getIblockTypes();

        foreach ($iblockTypes as $iblockType) {
            $structure[$iblockType['ID']] = [
                'title' => '[' . $iblockType['ID'] . '] ' . $iblockType['LANG'][LANGUAGE_ID]['NAME'],
                'items' => array(),
            ];
        }

        $iblocks = $iblockHelper->getIblocks();
        foreach ($iblocks as $iblock) {
            $structure[$iblock['IBLOCK_TYPE_ID']]['items'][] = [
                'title' => '[' . $iblock['CODE'] . '] ' . $iblock['NAME'],
                'value' => $iblock['ID']
            ];
        }

        return $structure;
    }
1143265
public function find($id, $lockMode = null, $lockVersion = null)
    {
        $qb = $this->createQueryBuilder('n');

        if (preg_match('/^\d+$/', $id)) {
            $qb->where('n.id = :id');
        } else {
            $qb->where('n.uuid = :id');
        }

        return $qb
            ->getQuery()
            ->setParameter('id', $id)
            ->getOneOrNullResult();
    }
363649
public function getParsedDocBlock()
    {
        if (!$this->parsedDocblock) {
            if (\strlen($this->docBlock) > 0) {
                $parser = new DocblockParser('/'.$this->docBlock.'/');
                $this->parsedDocblock = $parser->parse();
            } else {
                return null;
            }
        }

        return $this->parsedDocblock;
    }
834028
protected function checkLockAndValidateName($name)
    {
        if ($this->locked) {
            throw new Exception\LockedContainerException();
        }

        if (!is_string($name) || trim($name) === '') {
            throw new Exception\InvalidNameException($name);
        }
    }
568861
public function deleteField($hlblockName, $fieldName) {
        $hlblockId = is_numeric($hlblockName) ? $hlblockName : $this->getHlblockId($hlblockName);

        $entityHelper = new UserTypeEntityHelper();
        $entityHelper->setMode($this);
        return $entityHelper->deleteUserTypeEntity('HLBLOCK_' . $hlblockId, $fieldName);
    }
422118
public LockTable getLockTable(String strDatabaseName, String strRecordName)
    {
        String strKey = strDatabaseName + ':' + strRecordName;
        LockTable lockTable = (LockTable)m_htLockTables.get(strKey);
        if (lockTable == null)
        {
            synchronized (m_htLockTables)
            {
                if ((lockTable = (LockTable)m_htLockTables.get(strKey)) == null)
                    m_htLockTables.put(strKey, lockTable = new LockTable());
            }
            m_hsMyLockTables.add(lockTable);   // Keep track of the lock tables that I used
        }
        return lockTable;
    }
312419
public function updateHlblockIfExists($hlblockName, $fields) {
        $item = $this->getHlblock($hlblockName);
        if (!$item) {
            return false;
        }

        return $this->updateHlblock($item['ID'], $fields);
    }
486837
public function checkedLock()
    {
        $isLocked = ! flock($this->handle, LOCK_EX | LOCK_NB);
        if ($isLocked) {
            $this->lock();

        }
        return $isLocked;
    }
751637
protected function secAdd($aBlock, $bBlock): int
    {
        $higha = ($aBlock >> 16) & 0xffff;
        $lowa = $aBlock & 0xffff;
        $highb = ($bBlock >> 16) & 0xffff;
        $lowb = $bBlock & 0xffff;

        $highsum = $higha + $highb;
        $lowsum = $lowa + $lowb;
        # overflow low-addition add high-addition
        $highsum += ($lowsum & 0x00010000) >> 16;

        $highsum &= 0xffff;
        $lowsum &= 0xffff;
        return ($highsum << 16) | $lowsum;
    }