Snowair\Debugbar\PhalconDebugbar::attachMailer PHP Method

attachMailer() public method

public attachMailer ( $mailer )
    public function attachMailer($mailer)
    {
        if (!$this->shouldCollect('mail', false)) {
            return;
        }
        static $started;
        if (!$started) {
            $started = true;
            if (is_string($mailer)) {
                $mailer = $this->di[$mailer];
            }
            try {
                if (class_exists('\\Swifit_Mailer') && $mailer instanceof \Swift_Mailer) {
                    $this->addCollector(new SwiftMailCollector($mailer));
                    if ($this->config->options->mail->get('full_log', false) and $this->hasCollector('messages')) {
                        $this['messages']->aggregate(new SwiftLogCollector($mailer));
                    }
                }
            } catch (\Exception $e) {
                $this->addException(new Exception('Cannot add MailCollector to Phalcon Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
            }
        }
    }