added phpunit and composer stuff

This commit is contained in:
2019-10-07 10:55:12 +02:00
parent 3ad68e4078
commit ef2e25ef19
9 changed files with 1633 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace model\forum;
class Email{
private $email;
private $valid;
function __construct($email){
$sanitized_email = filter_var($email, FILTER_SANITIZE_EMAIL);
if(filter_var($sanitized_email, FILTER_VALIDATE_EMAIL)){
$this->email = $sanitized_email;
$this->valid = true;
}
else{
$this->email = 'invalid';
$this->valid = false;
}
}
public function getEmail(){
return $this->email;
}
public function getValid(){
return $this->valid;
}
public function __toString(): string
{
return $this->email;
}
}