Удаляет указанное пользовательское свойство инфоблока.

@param string $iblock
@param string $code

@return array

@throws \marvin255\bxmigrate\migrate\Exception
324524
protected function iblockPropertyDelete($iblock, $code)
    {
        $return = [];

        $iblock = $this->iblockLocate($iblock);

        $res = CIBlockProperty::getList([], [
            'CODE' => $code,
            'IBLOCK_ID' => $iblock['ID'],
            'CHECK_PERMISSIONS' => 'N',
        ]);
        if ($ob = $res->fetch()) {
            if (CIBlockProperty::delete($ob['ID'])) {
                $return[] = "Property {$code} for iblock {$iblock['CODE']}({$iblock['ID']}) deleted";
            } else {
                throw new Exception(
                    "Can't delete iblock property {$code} for iblock {$iblock['CODE']}({$iblock['ID']})"
                );
            }
        } else {
            throw new Exception(
                "Can't find property {$code} for iblock {$iblock['CODE']}({$iblock['ID']})"
            );
        }

        return $return;
    }
863890
public function getContainerByCode($code)
    {
        $block = null;

        foreach ($this->getBlocks() as $blockTmp) {
            if (\in_array($blockTmp->getType(), ['sonata.page.block.container', 'sonata.block.service.container'], true) && $blockTmp->getSetting('code') === $code) {
                $block = $blockTmp;

                break;
            }
        }

        return $block;
    }
313766
protected function iblockGetIdByCode($code, $siteId = null)
    {
        $siteId = $siteId ?: $this->iblockGetDefaultSiteId();
        $res = CIBlock::getList([], [
            'CODE' => $code,
            'CHECK_PERMISSIONS' => 'N',
            'SITE_ID' => $siteId,
        ]);
        $iblock = $res->fetch();

        return !empty($iblock['ID']) ? $iblock['ID'] : null;
    }
314198
public function saveElementList($iblockId, $columns = array(), $params = array()) {
        $this->initializeVars($iblockId);

        $opts = array();
        foreach ($columns as $columnCode) {
            $opts[] = $this->transformCode($columnCode);
        }
        $opts = implode(',', $opts);

        $params = array_merge(array(
            'name_prefix' => 'tbl_iblock_element_',
            'category' => 'list',
            'page_size' => 20,
            'order' => 'desc',
            'by' => 'id',
        ), $params);

        $name = $params['name_prefix'] . md5($this->iblock['IBLOCK_TYPE_ID'] . "." . $iblockId);
        $value = array(
            'columns' => $opts,
            'order' => $params['order'],
            'by' => $params['by'],
            'page_size' => $params['page_size']
        );

        \CUserOptions::DeleteOptionsByName($params['category'], $name);
        \CUserOptions::SetOption($params['category'], $name, $value, true);
    }
963741
public function execute($code = null) {

		if(null !== $code && false === ('-' . intval($code) == '-' . $code)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type integer, "%s" given', __METHOD__, gettype($code)), E_USER_ERROR);
		}

		$this -> setUrl();

		if(null !== $this -> seconds) {
			return Response :: addHeader('refresh', sprintf('%d;url=%s', $this -> seconds, $this -> url), $code);
		}

		Response :: addHeader('Location', $this -> url, $code);
	}
871942
protected static function validateCode($type, $code, $iblockId = null)
    {
        global $APPLICATION;

        if (is_null($code)) {
            // if code of info block is not updated
            return true;
        }

        try {
            $type = trim($type);
            $code = trim($code);

            if (strlen($code) <= 0) {
                throw new \Exception('EMPTY_CODE');
            }

            $rsSimilarIblock = IblockTable::query()
                ->setFilter(['IBLOCK_TYPE_ID' => $type, 'CODE' => $code, '!ID' => $iblockId])
                ->setSelect(['ID'])
                ->exec();

            if ($rsSimilarIblock->getSelectedRowsCount() > 0) {
                throw new \Exception('CODE_ALREDY_USED');
            }

            return true;
        } catch (\Exception $e) {
            Loc::loadMessages(__FILE__);

            $APPLICATION->ThrowException(Loc::getMessage('BEX_TOOLS_IBLOCK_' . $e->getMessage()));
            return false;
        }
    }
626202
protected function UFDelete($entity, $code)
    {
        $return = [];
        $id = $this->UFGetIdByCode($entity, $code);
        if ($id) {
            $group = new CUserTypeEntity();
            if ($group->Delete($id)) {
                $return[] = "Delete user field {$code}";
            } else {
                throw new Exception("Can't delete {$code} user field");
            }
        } else {
            throw new Exception("Can't find {$code} user field");
        }

        return $return;
    }
423441
public static function getReasonPhraseByCode($code)
    {
        if (isset(self::$codesDescription[$code])) {
            return self::$codesDescription[$code];
        }

        $group = self::getGroupFromCode($code);

        return self::getReasonPhraseByGroup($group);
    }
131021
public function getAuthorizationCode($code)
    {
        $sql  = sprintf('SELECT * from %s where authorization_code = :code', $this->config['code_table']);
        $code = $this->fetch($sql, compact('code'));
        if ($code) {
            // convert date string back to timestamp
            $code['expires'] = strtotime($code['expires']);
        }

        return $code;
    }
599912
public function getTokenForCode($code, $state)
    {
        if ($state != $_SESSION['oauth2_lockme_state']) {
            unset($_SESSION['oauth2_lockme_state']);
            throw new \Exception("Wrong state");
        }
        unset($_SESSION['oauth2_lockme_state']);

        $this->accessToken = $this->provider->getAccessToken('authorization_code', [
        'code' => $code
    ]);
        return $this->accessToken;
    }
482487
public function setExitCode($exitCode)
    {
        $this->exitCode = (int) $exitCode;

        $r = new \ReflectionProperty($this->error, 'code');
        $r->setAccessible(true);
        $r->setValue($this->error, $this->exitCode);
    }
1078676
public function getInfo(string $id, string $code): array
    {
        return $this->httpClient->postJson('card/invoice/reimburse/getinvoiceinfo', ['card_id' => $id, 'encrypt_code' => $code]);
    }
1316187
public function getException($code)
    {
        if (!isset($this->exceptions[$code])) {
            throw new Exceptions\ExceptionNotDefinedException($this, $code);
        }

        return $this->exceptions[$code];
    }
969436
public static function mapCode2InterfaceLanguage($code)
    {
        if (!empty($code)) {
            $languageService = tao_models_classes_LanguageService::singleton();
            $usage = new core_kernel_classes_Resource(tao_models_classes_LanguageService::INSTANCE_LANGUAGE_USAGE_GUI);
            if ($languageService->isLanguageAvailable($code, $usage)) {
                return $code;
            }
            \common_Logger::d('[Fallback] The provided launch language is unavailable: ' . $code);
        }

        return DEFAULT_LANG;
    }
1010148
public function readByCode(string $code, int $expirationInSeconds): ?TokenInterface
    {
        $schema = $this->getDatabaseSchema();
        return $this->readEnabledTokenByColumnWithExpirationCheck(
            $code,
            $schema->getTokensCodeColumn(),
            $expirationInSeconds,
            $schema->getTokensCodeCreatedAtColumn()
        );
    }
1346461
public static function sendResponseCode($code)
    {
        $messages = array(
            200 => 'Ok',
            204 => 'No Response',
            301 => 'Moved Permanently',
            302 => 'Found',
            304 => 'Not Modified',
            400 => 'Bad Request',
            401 => 'Unauthorized',
            403 => 'Forbidden',
            404 => 'Not Found',
            500 => 'Internal Server Error',
            503 => 'Service Unavailable',
        );

        if (!array_key_exists($code, $messages)) {
            throw new Exception('Response code not supported: ' . $code);
        }

        if (strpos(PHP_SAPI, '-fcgi') === false) {
            $key = 'HTTP/1.1';

            if (array_key_exists('SERVER_PROTOCOL', $_SERVER)
                && strlen($_SERVER['SERVER_PROTOCOL']) < 15
                && strlen($_SERVER['SERVER_PROTOCOL']) > 1) {
                $key = $_SERVER['SERVER_PROTOCOL'];
            }
        } else {
            // FastCGI
            $key = 'Status:';
        }

        $message = $messages[$code];
        Common::sendHeader($key . ' ' . $code . ' ' . $message);
    }
781774
public function add()
    {
        $obj = new \CIBlock();

        $iblockId = $obj->Add($this->getFieldsWithDefault());
        if (!$iblockId) {
            throw new \Exception($obj->LAST_ERROR);
        }

        Logger::log("Добавлен инфоблок {$this->fields['CODE']}", Logger::COLOR_GREEN);

        return $iblockId;
    }