Code Duplication    Length = 6-6 lines in 2 locations

src/Drupal/Driver/Cores/Drupal7.php 2 locations

@@ 111-116 (lines=6) @@
108
109
    // Attempt to decipher any fields that may be specified.
110
    $this->expandEntityFields('node', $values);
111
    foreach ($values as $k => $v) {
112
      if (!property_exists($node, $k)) {
113
        throw new \Exception(sprintf("%s::%s line %s: Attempt to modify an invalid field: %s", get_class($this), __LINE__, __FUNCTION__, $k));
114
      }
115
      $node->{$k} = $v;
116
    }
117
    node_save($node);
118
  }
119
@@ 176-181 (lines=6) @@
173
    $user = user_load($user->uid, TRUE);
174
    // Attempt to decipher any fields that may be specified in values.
175
    $this->expandEntityFields('user', $values);
176
    foreach ($values as $k => $v) {
177
      if (!property_exists($user, $k)) {
178
        throw new \Exception(sprintf("%s::%s line %s: Attempt to modify an invalid field: %s", get_class($this), __LINE__, __FUNCTION__, $k));
179
      }
180
      $user->{$k} = $v;
181
    }
182
    user_save($user);
183
  }
184