Bristol SU Support Package
UserEmailIs.php
Go to the documentation of this file.
1 <?php
2 
4 
8 
12 class UserEmailIs extends UserFilter
13 {
14 
24  public function options(): Form
25  {
26  return \FormSchema\Generator\Form::make()->withField(
27  Field::input('email')->inputType('email')->label('User Email')
28  ->required(true)->placeholder('Email of the user')
29  )->getSchema();
30  }
31 
39  public function evaluate($settings): bool
40  {
41  try {
42  return $this->user()->data()->email() === $settings['email'];
43  } catch (\Exception $e) {
44  return false;
45  }
46  }
47 
53  public function name()
54  {
55  return 'User has Email';
56  }
57 
63  public function description()
64  {
65  return 'User has a given email address';
66  }
67 
73  public function alias()
74  {
75  return 'user_email_is';
76  }
77 }