protected function parse($uuid) {
    // The UUID as a standard string was passed in.
    if (is_string($uuid)) {
      if (substr($uuid, 0, 1) === '{' && substr($uuid, -1, 1) === '}') {
        $string = substr($uuid, 1, strlen($uuid) - 2);
        $this->parseStringToParts($string);
      }
      // The case where a URL was supplied.
      elseif (substr($uuid, 0, 9) === 'urn:uuid:') {
        $string = substr($uuid, 9);
        $this->parseStringToParts($string);
      }
      else {
        throw new Exception('The UUID string supplied could not be parsed.');
      }
    }
    elseif (is_array($uuid)) {

      if (count($uuid) != 6) {
        throw new Exception('The UUID array supplied could not be parsed.');
      }

      // For the case where a UUID is passed in via the format:
      // array('35e872b4', '190a', '5faa', 'a0', 'f6', '09da0d4f9c01');
      if (isset($uuid[0]) && !empty($uuid[0])) {
        $this->time_low = $uuid[0];
        $this->time_mid = $uuid[1];
        $this->time_hi_version =$uuid[2];
        $this->clock_seq_hi_variant = $uuid[3];
        $this->clock_seq_low =$uuid[4];
        $this->node = $uuid[5];
      }
      // For the case where the UUID is passed in via the format:
      // array(
      //  'time_low' => '35e872b4',
      //  'time_mid' => '190a',
      //  'time_hi_version' => '5faa',
      //  'clock_seq_hi_variant' => 'a0',
      //  'clock_seq_low' => 'f6',
      //  'node' => '09da0d4f9c01',
      // );
      elseif (isset($uuid['time_low']) && !empty($uuid['time_low'])) {
        $this->time_low = $uuid['time_low'];
        $this->time_mid = $uuid['time_mid'];
        $this->time_hi_version =$uuid['time_hi_version'];
        $this->clock_seq_hi_variant = $uuid['clock_seq_hi_variant'];
        $this->clock_seq_low =$uuid['clock_seq_low'];
        $this->node = $uuid['node'];
      }
      else {
        throw new Exception('The UUID array supplied could not be parsed.');
      }
    }
    else {
      throw new Exception('The UUID supplied could not be parsed.');
    }
  }