You are here

public function SFID::__construct in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 src/SFID.php \Drupal\salesforce\SFID::__construct()
  2. 8.3 src/SFID.php \Drupal\salesforce\SFID::__construct()

SFID constructor.

Parameters

string $id: The SFID.

Throws

\Exception

File

src/SFID.php, line 29

Class

SFID
Class SFID.

Namespace

Drupal\salesforce

Code

public function __construct($id) {
  if (strlen($id) != 15 && strlen($id) != self::MAX_LENGTH) {
    throw new \Exception('Invalid sfid ' . strlen($id));
  }
  $this->id = $id;
  if (strlen($this->id) == 15) {
    $this->id = static::convertId($id);
  }
}