You are here

public function EmailConfirmation::getProperty in Email confirmer 8

Returns a property value or an array with all defined properties.

Parameters

string $key: Property key to get. Leave empty to get all defined properties.

Return value

mixed The value of the given key, NULL if none set. Array of all available properties if no key specified.

Overrides EmailConfirmationInterface::getProperty

File

src/Entity/EmailConfirmation.php, line 368

Class

EmailConfirmation
Defines the email confirmation entity class.

Namespace

Drupal\email_confirmer\Entity

Code

public function getProperty($key = NULL) {
  $data_field = $this
    ->get('data');
  $values = $data_field
    ->isEmpty() ? [] : $data_field
    ->first()
    ->toArray();
  if ($key) {
    return isset($values[$key]) ? $values[$key] : NULL;
  }
  return $values;
}