Custom date validator

Hello everyone. I am trying to implement a custom validator in Phalcon to check if a date is of a correct format but also to check if the day actually existed (for example I am not allowing the 30th of Feb). But I am kind of stuck. I need this validator to validate a form field. Which methods should I implement to make it work as a usual Phalcon validator (it has to display a message passed, cancel other validators to validate if it fails and so on).
This is what I currently have

This was mostly copied from here.
I don't quite understand how the the validate method has to work, what are these params ($validator, $attribute) for ? Which methods should I also impement to make it work as a normal phalcon validator. Thanks in advance.

Phalcon will execute your validate() method. First argument ($validator) is object of Phalcon\Validation class from here http://docs.phalconphp.com/en/latest/api/Phalcon_Validation.html. One of its method is getValue(). You will need this method to obtain the date value. Second argument ($attribute) is the name of the field from your form.

So my implementation would be:

use Phalcon\Validation\Validator,
Phalcon\Validation\ValidatorInterface,
Phalcon\Validation\Message;
class AwesomeDateValidator extends Validator implements ValidatorInterface {
// constructor is defined only because you wanted to have "cancelOnFail" true,
// If you don't want this, then the implementation of constructor is not necessary
public function __construct($options = null) {
//pass options to original constructor
parent::__construct($options);
$this->setOption("cancelOnFail",true);
}
public function validate($validator, $attribute) {
var_dump($validator);//delete this line, it's for you to see what it is
var_dump($attribute);//delete this line, it's for you to see what it is
//obtain date value
$date = $validator->getValue($attribute);
if($date === "awesomedate"){
return true;
}
//if we are here it means that date is wrong
//first, check if message was provided with options
$message = $this->getOption('message');
if (!$message) {
//message was not provided, so set some default
$message = "This date is not awesome!";
}
//add message object
$validator->appendMessage(new Message($message, $attribute, 'IsAwesomeDate'));
return false;
}
}