public function messages(string $type)
    {
        if ('' === $type) {
            throw new \InvalidArgumentException('The type of messages must be a non-empty string');
        }
        if (! array_key_exists($type, $this->messages)) {
            $this->messages[$type] = new Messages();
        }
        return $this->messages[$type];
    }
public function messages(string $type)
    {
        if ('' === $type) {
            throw new \InvalidArgumentException('The type of messages must be a non-empty string');
        }
        if (! array_key_exists($type, $this->messages)) {
            $this->messages[$type] = new Messages();
        }
        return $this->messages[$type];
    }
public function messages ( string $ type ) { if ( '' === $ type ) { throw new \ InvalidArgumentException ( 'The type of messages must be a non-empty string' ) ; } if ( ! array_key_exists ( $ type , $ this -> messages ) ) { $ this -> messages [ $ type ] = new Messages ( ) ; } return $ this -> messages [ $ type ] ; }
Return a message collection of the selected type
If the type does not exists the object is created
@param string $type
@return Messages
Return a message collection of the selected type If the type does not exists the object is created