Is it possible to get the number of \Phalcon\Flash per message category

I would like to know if it's possible to get the total number of \Phalcon\Flash message per category Something like



No, Phalcon\Flash does not have such functionality. Perphaps you can create your own Flash class implementing that functionality:

class Flash extends Phalcon\Flash\Direct
    public function totalError()


I think I found the answer I was seeking

It's possible to do it via the Phalcon\Flash\Session (I think, haven't tested yet, I'm going to edit this comment as soon as I will)

In the doc :

public has (unknown $type)
    bool \Phalcon\Flash\Session::has(string $type)


public array getMessages ([string $type], [boolean $remove])
    Returns the messages in the session flasher

So it would be possible to do :

if(count($this->flashSession->getMessages("error", false)) >= $myVar){