You are here

public function BusinessRulesItemObject::setWeight in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/BusinessRulesItemObject.php \Drupal\business_rules\BusinessRulesItemObject::setWeight()

Set the item weight.

Parameters

int $weight: The item weight.

Throws

\Exception

1 call to BusinessRulesItemObject::setWeight()
BusinessRulesItemObject::__construct in src/BusinessRulesItemObject.php
BusinessRulesItemObject constructor.

File

src/BusinessRulesItemObject.php, line 184

Class

BusinessRulesItemObject
Class BusinessRulesItemObject.

Namespace

Drupal\business_rules

Code

public function setWeight($weight) {
  if (is_numeric($weight)) {
    $this->weight = $weight;
  }
  else {
    throw new \Exception("Only integers are permitted for weight. {$weight} given. ");
  }
}