Validates a HTMLPurifier_ConfigSchema_Interchange_Id object.
@param HTMLPurifier_ConfigSchema_Interchange_Id $id
512133
public function validateId($id)
    {
        $id_string = $id->toString();
        $this->context[] = "id '$id_string'";
        if (!$id instanceof HTMLPurifier_ConfigSchema_Interchange_Id) {
            // handled by InterchangeBuilder
            $this->error(false, 'is not an instance of HTMLPurifier_ConfigSchema_Interchange_Id');
        }
        // keys are now unconstrained (we might want to narrow down to A-Za-z0-9.)
        // we probably should check that it has at least one namespace
        $this->with($id, 'key')
            ->assertNotEmpty()
            ->assertIsString(); // implicit assertIsString handled by InterchangeBuilder
        array_pop($this->context);
    }
907846
public function switchToUser($id)
    {
        if ($this->service->switchToUser($id)) {
            return redirect('dashboard')->with('message', 'You\'ve switched users.');
        }

        return redirect('dashboard')->with('errors', ['Could not switch users']);
    }
1050833
public function validate($interchange)
    {
        $this->interchange = $interchange;
        $this->aliases = array();
        // PHP is a bit lax with integer <=> string conversions in
        // arrays, so we don't use the identical !== comparison
        foreach ($interchange->directives as $i => $directive) {
            $id = $directive->id->toString();
            if ($i != $id) {
                $this->error(false, "Integrity violation: key '$i' does not match internal id '$id'");
            }
            $this->validateDirective($directive);
        }
        return true;
    }
626956
public function isDefined($id)
    {
        return isset($this->typemap[$id]) ? $this->typemap[$id] : false;
    }
885333
public function isValidId(?string $id): bool
    {
        if ($id == '') {
            return false;
        }

        if ($this->saveHandler != null && method_exists($this->saveHandler, 'isValidId')) {
            return $this->saveHandler->isValidId($id);
        }

        static $idPattern;
        if ($idPattern == null) {
            if ($this->options['hash']) {
                $idPattern = '~^[A-F0-9]{'. $this->options['hashLength'] .'}$~';
            } else {
                // @see http://php.net/manual/en/session.configuration.php#ini.session.sid-length
                // @see http://php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character
                // @see https://github.com/php/php-src/blob/PHP-7.1/UPGRADING#L114
                $idLength = ini_get('session.sid_length') ?: self::SID_LENGTH;
                $idBitsPerCharacter = ini_get('session.sid_bits_per_character');
                if ($idBitsPerCharacter == '') { // never happens, but obsession..
                    ini_set('session.sid_length', (string) self::SID_LENGTH);
                    ini_set('session.sid_bits_per_character', (string) ($idBitsPerCharacter = self::SID_BITSPERCHARACTER));
                }

                $idCharacters = '';
                switch ((int) $idBitsPerCharacter) {
                    case 4: $idCharacters = '0-9a-f'; break;
                    case 5: $idCharacters = '0-9a-v'; break;
                    case 6: $idCharacters = '0-9a-zA-Z-,'; break;
                }

                $idPattern = '~^['. $idCharacters .']{'. $idLength .'}$~';
            }
        }

        return (bool) preg_match($idPattern, $id);
    }
1072588
protected function getValidationMessage($id)
    {
        switch ($id) {
            case 'scheme-required':
                $text = sprintf(
                    Swat::_('“%s” must include a prefix (i.e. %s).'),
                    $this->value,
                    $this->default_scheme
                );

                break;
            case 'invalid-uri':
                $text = sprintf(
                    Swat::_('“%s” is not a properly formatted address.'),
                    $this->value
                );

                break;
            default:
                return parent::getValidationMessage($id);
        }

        $message = new SwatMessage($text, 'error');
        return $message;
    }
590222
public function registerClientScript($id)
	{
        $booster = Booster::getBooster();
        $booster->registerAssetCss('markdown.editor.css');
        $booster->registerAssetJs('markdown.converter.js', CClientScript::POS_HEAD);
        $booster->registerAssetJs('markdown.sanitizer.js', CClientScript::POS_HEAD);
        $booster->registerAssetJs('markdown.editor.js', CClientScript::POS_HEAD);
		Yii::app()->clientScript->registerScript(
			$id,
			"var converter = Markdown.getSanitizingConverter();
			var editor = new Markdown.Editor(converter, '" . $id . "');
			editor.run();",
			CClientScript::POS_END
		);
	}
508748
public function define($id, $type)
    {
        $id = (string) $id;

        $this->validateName($id);

        if ($type[0] == ':') {
            $expectedType = substr($type, 1);
            $allowedTypes = (array) $this->getAllowedTypes();
            if (!in_array($expectedType, $allowedTypes)) {
                throw new InvalidArgumentException(sprintf('Cannot use type %s to define item "%s" in %s container. Allowed types are: %s.',
                    $expectedType, $id, $this->name, join(', ', $allowedTypes)));
            }
        } else {
            if (!class_exists($type)) {
                throw new InvalidArgumentException(sprintf('Cannot use non-existing class %s as type to define item "%s" in %s container.',
                    $type, $id, $this->name));
            }
        }

        $this->typemap[$id] = $type;
    }
161527
public function setId($id)
    {
        $this->getTabs()->each(function (TabInterface $tab) use ($id) {
            if ($tab instanceof FormInterface) {
                $tab->setId($id);
            }
        });

        return $this;
    }
887177
public function change($id = null)
    {
        if ($id === null || !$this->Languages->exists(['id' => $id])) {
            $this->Flash->error($this->invalidRequestMessage);
            $this->redirect($this->referer());
            return;
        }
        $this->request->session()->write('contentLanguageId', (int)$id);
        $this->redirect($this->referer());
    }
158901
public function assignId(int $id): void
    {
        if (isset($this->values[$this->primaryKeyColumn])) {
            return; // This is not an auto-generated key
        }

        $this->values[$this->primaryKeyColumn] = $id;
    }
1110357
public function isValidCurrencyId($id) {
        $this->sError = FALSE;

        if (!$this->getCurrencyId2Code($id)) {
            $this->sError = 'Incorect currency id: ' . $id;
            return FALSE;
        }

        return TRUE;
    }
108518
public function outputColumnContent($id)
    {
        $meta = get_post_meta($id, $this->id, true);

        if (! empty($meta) && $this->isRepeatable()) {
            echo implode($meta, ', ');
        } else {
            echo $meta;
        }
    }
1036136
public function setId($id)
    {
        $id = (string) $id;

        if (!preg_match('#^[a-zA-Z0-9_.]+$#', $id)) {
            throw new InvalidAlgorithmIdException($id);
        }

        $this->id = mb_strtolower($id);
    }
1000818
public function setAttributeId( $id )
	{
		if ( $id == $this->getAttributeId() ) { return; }

		$this->_values['attrid'] = (string) $id;
		$this->setModified();
	}
1373954
public function updateIDValue(&$id)
    {
        $owner = $this->owner;
        if ($owner->Title) {
            $id = Convert::raw2url($owner->Title);
        }
    }
1198009
public function bind($id, $definition = [], $replace = true)
    {
        $container = Container::$instance;
        if (!$replace && $container->has($id)) {
            throw new InvalidParamException("Can not bind service, service '$id' is already exists.");
        }

        if (is_array($definition) && !isset($definition['class'])) {
            throw new InvalidConfigException("The configuration for the \"$id\" service must contain a \"class\" element.");
        }

        $container->setSingleton($id, $definition);
    }