public function checkEmail() {
    if ($this->email === '') {
      return ['result' => true, 'message' => ''];
    }
    if (empty($this->email)) {
      return ['result' => false, 'message' => 'Please specify a valid email.'];
    }
    if (!preg_match(
        '/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i',
        $this->email
    )) {
      return [
        'result' => false,
        'message' => 'Email must be a correctly formatted address.'
      ];
    }
    $selector = ['&',
      'ilike' => [
        'email',
        str_replace(['\\', '%', '_'], ['\\\\\\\\', '\%', '\_'], $this->email)
      ]
    ];
    if (isset($this->guid)) {
      $selector['!guid'] = $this->guid;
    }
    $test = Nymph::getEntity(
        ['class' => '\Tilmeld\Entities\Group', 'skip_ac' => true],
        $selector
    );
    if (isset($test->guid)) {
      return [
        'result' => false,
        'message' => 'That email address is already registered.'
      ];
    }

    return [
      'result' => true,
      'message' => (
        isset($this->guid) ? 'Email is valid.' : 'Email address is valid!'
      )
    ];
  }
public function checkEmail() {
    if ($this->email === '') {
      return ['result' => true, 'message' => ''];
    }
    if (empty($this->email)) {
      return ['result' => false, 'message' => 'Please specify a valid email.'];
    }
    if (!preg_match(
        '/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i',
        $this->email
    )) {
      return [
        'result' => false,
        'message' => 'Email must be a correctly formatted address.'
      ];
    }
    $selector = ['&',
      'ilike' => [
        'email',
        str_replace(['\\', '%', '_'], ['\\\\\\\\', '\%', '\_'], $this->email)
      ]
    ];
    if (isset($this->guid)) {
      $selector['!guid'] = $this->guid;
    }
    $test = Nymph::getEntity(
        ['class' => '\Tilmeld\Entities\Group', 'skip_ac' => true],
        $selector
    );
    if (isset($test->guid)) {
      return [
        'result' => false,
        'message' => 'That email address is already registered.'
      ];
    }

    return [
      'result' => true,
      'message' => (
        isset($this->guid) ? 'Email is valid.' : 'Email address is valid!'
      )
    ];
  }
public function checkEmail ( ) { if ( $ this -> email === '' ) { return [ 'result' => true , 'message' => '' ] ; } if ( empty ( $ this -> email ) ) { return [ 'result' => false , 'message' => 'Please specify a valid email.' ] ; } if ( ! preg_match ( '/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i' , $ this -> email ) ) { return [ 'result' => false , 'message' => 'Email must be a correctly formatted address.' ] ; } $ selector = [ '&' , 'ilike' => [ 'email' , str_replace ( [ '\\' , '%' , '_' ] , [ '\\\\\\\\' , '\%' , '\_' ] , $ this -> email ) ] ] ; if ( isset ( $ this -> guid ) ) { $ selector [ '!guid' ] = $ this -> guid ; } $ test = Nymph :: getEntity ( [ 'class' => '\Tilmeld\Entities\Group' , 'skip_ac' => true ] , $ selector ) ; if ( isset ( $ test -> guid ) ) { return [ 'result' => false , 'message' => 'That email address is already registered.' ] ; } return [ 'result' => true , 'message' => ( isset ( $ this -> guid ) ? 'Email is valid.' : 'Email address is valid!' ) ] ; }
Check that an email is unique.

@return array An associative array with a boolean 'result' entry and a
'message' entry.
Check that an email is unique .