You are here

public function BusinessRulesItemObject::setType in Business Rules 8

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

Set the item type.

Parameters

string $type: The item type.

Throws

\Exception

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

File

src/BusinessRulesItemObject.php, line 118

Class

BusinessRulesItemObject
Class BusinessRulesItemObject.

Namespace

Drupal\business_rules

Code

public function setType($type) {
  if (in_array($type, [
    self::ACTION,
    self::CONDITION,
  ])) {
    $this->type = $type;
  }
  else {
    throw new \Exception("The only Business Rule item type available are 'action' and 'condition'. {$type} given.");
  }
}