/** * {@inheritdoc} Best place to ensure the logic is encapsulated in a single place */ public function offsetSet($offset, $value) { if ($offset === 'X509Certificate') { $value = preg_replace('~\\s+~', '', $value); } parent::offsetSet($offset, $value); }