<commit_before><?php
/**
 * Kenjis.Contact
 *
 * @author     <NAME> <https://github.com/kenjis>
 * @license    MIT License
 * @copyright  2014 <NAME>
 * @link       https://github.com/kenjis/Kenjis.Contact
 */

namespace Kenjis\Contact\Resource\App\Contact;

use BEAR\Resource\ResourceObject;
use BEAR\Resource\Code;
use Kenjis\Contact\Service\SwiftMailerFactory;
use Ray\Di\Di\Inject;

class Form extends ResourceObject
{
    private $mailer;

    // Email account info to receive posted data
    private $adminEmail = '<EMAIL>';
    private $adminName = 'Administrator';

    /**
     * @Inject
     */
    public function __construct(SwiftMailerFactory $mailer)
    {
        $this->mailer = $mailer;
    }

    /**
     * @BEAR\Sunday\Annotation\Form
     */
    public function onGet()
    {
        return $this;
    }

    /**
     * @BEAR\Sunday\Annotation\Form
     */
    public function onPost($name, $email, $comment)
    {
        $this->sendmail($name, $email, $comment);

        $this['code'] = $this->code = Code::CREATED;
        $this['name']    = $name;
        $this['email']   = $email;
        $this['comment'] = $comment;

        return $this;
    }

    private function sendmail($name, $email, $comment)
    {
        $data = [
            'name'    => $name,
            'email'   => $email,
            'comment' => $comment,
        ];

        $mailer = $this->mailer->create();
        $mailer->setSubject('Contact Form')
            ->setFrom($data['email'], $data['name'])
            ->setTo($this->adminEmail, $this->adminName)
            ->setTemplate('mailer/contact_form.twig', $data);

//        echo '<pre>'
//            . htmlspecialchars($mailer, ENT_QUOTES, 'UTF-8')
//            . '</pre>';

        $result = $mailer->send();
        return $result;
    }
}<commit_msg>Refactor: fix variable names<commit_after><?php
/**
 * Kenjis.Contact
 *
 * @author     <NAME> <https://github.com/kenjis>
 * @license    MIT License
 * @copyright  2014 <NAME>
 * @link       https://github.com/kenjis/Kenjis.Contact
 */

namespace Kenjis\Contact\Resource\App\Contact;

use BEAR\Resource\ResourceObject;
use BEAR\Resource\Code;
use Kenjis\Contact\Service\SwiftMailerFactory;
use Ray\Di\Di\Inject;

class Form extends ResourceObject
{
    private $mailerFactory;

    // Email account info to receive posted data
    private $adminEmail = '<EMAIL>';
    private $adminName = 'Administrator';

    /**
     * @Inject
     */
    public function __construct(SwiftMailerFactory $mailerFactory)
    {
        $this->mailerFactory = $mailerFactory;
    }

    /**
     * @BEAR\Sunday\Annotation\Form
     */
    public function onGet()
    {
        return $this;
    }

    /**
     * @BEAR\Sunday\Annotation\Form
     */
    public function onPost($name, $email, $comment)
    {
        $this->sendmail($name, $email, $comment);

        $this['code'] = $this->code = Code::CREATED;
        $this['name']    = $name;
        $this['email']   = $email;
        $this['comment'] = $comment;

        return $this;
    }

    private function sendmail($name, $email, $comment)
    {
        $data = [
            'name'    => $name,
            'email'   => $email,
            'comment' => $comment,
        ];

        $mailer = $this->mailerFactory->create();
        $mailer->setSubject('Contact Form')
            ->setFrom($data['email'], $data['name'])
            ->setTo($this->adminEmail, $this->adminName)
            ->setTemplate('mailer/contact_form.twig', $data);

//        echo '<pre>'
//            . htmlspecialchars($mailer, ENT_QUOTES, 'UTF-8')
//            . '</pre>';

        $result = $mailer->send();
        return $result;
    }
}
{'fraction_non_alphanumeric': 0.16359196961475855, 'fraction_numerical': 0.0027129679869777536, 'mean_word_length': 2.151282051282051, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 45, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6119597', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1161, 'n_words': 217}