Set the unique identifier of the body element.

@param string $id A QTI Identifier.
@throws \InvalidArgumentException If $id is not a valid QTI identifier.
344678
public function setId($id = '')
    {
        if (is_string($id) && (empty($id) === true || Format::isIdentifier($id, false) === true)) {
            $this->id = $id;
        } else {
            $msg = "The 'id' argument of a body element must be a valid identifier or an empty string";
            throw new InvalidArgumentException($msg);
        }
    }
505951
public function setIdentifier($identifier)
    {
        if (is_string($identifier) === false || empty($identifier) === true) {
            throw new InvalidArgumentException(
                "The 'identifier' argument must be a non-empty string."
            );
        }
        
        $this->identifier = $identifier;
    }
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;
    }
883583
public function setIdentifier($entity, array $id) : void
    {
        foreach ($id as $idField => $idValue) {
            $property = $this->class->getProperty($idField);

            $property->setValue($entity, $idValue);
        }
    }
166710
public function setId($id)
    {
        if ($this->id) {
            return;
        }
        if (strlen($id) >= 20) {
            $this->id = $id;

            return;
        }
        list($a, $b) = explode(' ', microtime());
        $this->id = preg_replace("/[^\d]/", '', $b.$a.$id);
    }
1360968
protected function setIdentifier($identifier)
    {
        if (Utils::isValidVariableIdentifier($identifier)) {
            $this->identifier = $identifier;
        } else {
            $msg = "The identifier '${identifier}' is not a valid QTI Variable Name Identifier.";
            throw new InvalidArgumentException($msg);
        }
    }
459490
public function setDocumentId($documentId)
    {
        if (preg_match($this->getDocumentIdRegex(), $documentId)) {
            $this->document_id = $documentId;

            return $this;
        }

        throw new InvalidArgument(
            'document_id must be a string with 10 alphanumeric letters.' .
                     '5 letters, followed by 4 numbers, followed by 1 letter or number. Example: ABCDE1234F'
        );
    }
90942
public function id($id = null)
    {
        if ($id) {
            if (!$this->isValidId($id)) {
                throw new \InvalidArgumentException('$id may contain only [a-zA-Z0-9-_]');
            }
            if ($this->id) {
                throw new Exception('Cannot set id while session is active');
            }
            $this->requestedId = $id;
        }
        return $this->id;
    }
592966
public function setID($id)
    {
        if($id !== null && substr($id, 0, 1) !== '/')
            throw new Exception("invalid file id, must start with a /");
        $this->id = $id;
    }
25031
private function _validateCustomerId($id = null)
    {
        if (empty($id) || trim($id) == "") {
            throw new InvalidArgumentException(
            'expected customer id to be set'
            );
        }
        if (!preg_match('/^[0-9A-Za-z_-]+$/', $id)) {
            throw new InvalidArgumentException(
            $id . ' is an invalid customer id.'
            );
        }

    }
1141902
public static function setIdActiveMenu ( $id )
    {
        self::$_idActiveMenu = $id;
        self::$_activeMenu = Menu::find($id);
    }
1218891
public function setId( $id )
	{
		if ( ( $this->_values['id'] = MShop_Common_Item_Abstract::checkId($this->getId(), $id) ) === null ) {
			$this->_modified = true;
		} else {
			$this->_modified = false;
		}
	}
139192
public void setId(String id) {
      if (StringUtils.isNullOrBlank(id)) {
         this.id = UUID.randomUUID().toString();
      } else {
         this.id = id;
      }
   }
1179971
public function setId($id)
    {
        // blacklist
        if (!(is_string($id) and filter_var($id, \FILTER_VALIDATE_INT) !== false)
        and !is_int($id)) {
            throw new \InvalidArgumentException( "Integer ID expected." );
        }

        $this->id = (int) trim($id);

        return $this;
    }
413964
public function set($id, $value)
    {
        if (!is_numeric($id) && !is_string($id)) {
            throw new InvalidServiceIdentifierException($id);
        }

        $this->offsetSet($id, $value);
    }
1009848
public function setId(?int $id): User
    {
        Assert::greaterThan($id, 0);

        $this->id = $id;

        return $this;
    }
1276723
public function setId($id)
    {
        $this->id = (integer)$id;
        $this->hasId = true;

        return $this;
    }