<commit_before><?php
    /**
     * @author <NAME> <<EMAIL>>
     * @package Sarcoma\Email\Email
     */

    namespace Sarcoma\Email;

    use Twig_Loader_Filesystem;
    use Twig_Environment;

    class Email
    {

        protected $body_color = "#f1f1f1";
        protected $table_color = "#ffffff";
        protected $color;
        protected $base_font_size;
        protected $ratio;
        protected $styles;

        protected $email_title = "HTML Email";
        protected $message;

        /**
         * @param string $font_family
         * @param int $base_font_size
         * @param float $line_height
         * @param string $color
         * @param float $ratio
         */
        public function __construct(
            $font_family = 'Helvetica,Arial,sans-serif',
            $base_font_size = 12,
            $line_height = 1.3,
            $color = "#000000",
            $ratio = 1.618
        ) {
            $this->base_font_size = $base_font_size;
            $this->ratio          = $ratio;
            $this->line_height    = $line_height;
            $this->styles         = array(
                'font-family'    => $font_family,
                'font-size'     => $base_font_size."px",
                'line-height'    => $line_height,
                'color'          => $color,
                'margin-bottom' => ($line_height * $base_font_size)."px",
                'padding-bottom' => 0,
                'margin-top'     => 0,
                'padding-top'    => 0
            );
        }

        /**
         * @param string $email_title
         */
        public function setEmailTitle($email_title)
        {
            $this->email_title = $email_title;
        }

        /**
         * @param string $body_color
         */
        public function setBodyColor($body_color)
        {
            $this->body_color = $body_color;
        }

        /**
         * @param$table_color
         */
        public function setTableColor($table_color)
        {
            $this->table_color = $table_color;
        }

        /**
         * @param string $color
         */
        public function setColor($color)
        {
            $this->styles['color'] = $color;
        }

        /**
         * @param string $font_family
         */
        public function setFontFamily($font_family)
        {
            $this->styles['font-family'] = $font_family;
        }

        /**
         * @param string $font_size
         */
        public function setFontSize($font_size)
        {
            $this->styles['font-size'] = $font_size;
        }

        /**
         * @param string $line_height
         */
        public function setLineHeight($line_height)
        {
            $this->styles['line-height'] = $line_height;
        }

        /**
         * @param array $styles
         */
        public function setStyle($styles)
        {
            foreach ($styles as $property => $style) {
                $this->styles[$property] = $style;
            }
        }

        /**
         * @param string $text
         * @param string $tag
         * @param array $styles
         */
        public function setTag($text, $tag = 'p', $styles = array())
        {
            if (!empty($text)) {
                $text            = stripslashes($this->clean($text));
                $this->message[] = $this->makeTag($text, $tag, $styles);
            } else {
                $this->message[] = $this->makeTag('Not Provided', $tag, $styles);
            }
        }

        /**
         * @param string $text_area
         * @param string $tag
         * @param array $styles
         * @param mixed $text_wrap
         */
        public function setTextArea($text_area, $tag = 'p', $styles = array(), $text_wrap = null)
        {
            if (!empty($text_area)) {
                if ($text_wrap) {
                    $text_area = wordwrap($text_area, $text_wrap);
                }
                $text_area       = nl2br($text_area);
                $text_area       = stripslashes($this->clean($text_area));
                $text_area       = preg_replace('#&lt;((?:br) /?)&gt;#', '<\1>', $text_area);
                $this->message[] = $this->makeTag($text_area, $tag, $styles);
            } else {
                $this->message[] = $this->makeTag('Not Provided', $tag, $styles);
            }
        }

        /**
         * @param string $link_text
         * @param string $url
         * @param string $tag
         * @param array $styles
         */
        public function setLink($link_text, $url, $tag = 'p', $styles = array())
        {
            $this->message[] = $this->makeTag('<a href="'.$this->clean($url).'">'.$this->clean($link_text).'</a>', $tag,
                $styles);
        }

        public function getMessage()
        {
            $message = '';
            foreach ($this->message as $output) {
                $message .= $output;
            }

            return $message;
        }

        /**
         * @param array $content
         * @param null $template
         * @param null $directory


*
*@uses Twig_Loader_Filesystem()
         * @uses Twig_Environment()
         * @return string
         */
        public function getTwigTemplate($content = array(), $template = null, $directory = null)
        {
            if ($template && $directory) {
                $loader = new Twig_Loader_Filesystem($directory);
            } else {
                $loader   = new Twig_Loader_Filesystem(__DIR__."/../../views");
                $template = 'email.twig';
            }
            $twig = new Twig_Environment($loader);

            return $twig->render($template, array(
                'email_title' => $this->email_title,
                'body_color'  => $this->body_color,
                'table_color' => $this->table_color,
                'content' => $content
            ));
        }

        /**
         * @param array $array<commit_msg>Reformatted code<commit_after><?php
    /**
     * @author <NAME> <<EMAIL>>
     * @package Sarcoma\Email\Email
     */

    namespace Sarcoma\Email;

    use Twig_Loader_Filesystem;
    use Twig_Environment;

    class Email
    {

        protected $body_color = "#f1f1f1";
        protected $table_color = "#ffffff";
        protected $color;
        protected $base_font_size;
        protected $ratio;
        protected $styles;

        protected $email_title = "HTML Email";
        protected $message;

        /**
         * @param string $font_family
         * @param int $base_font_size
         * @param float $line_height
         * @param string $color
         * @param float $ratio
         */
        public function __construct(
            $font_family = 'Helvetica,Arial,sans-serif',
            $base_font_size = 12,
            $line_height = 1.3,
            $color = "#000000",
            $ratio = 1.618
        ) {
            $this->base_font_size = $base_font_size;
            $this->ratio          = $ratio;
            $this->line_height    = $line_height;
            $this->styles         = array(
                'font-family'    => $font_family,
                'font-size'     => $base_font_size."px",
                'line-height'    => $line_height,
                'color'          => $color,
                'margin-bottom' => ($line_height * $base_font_size)."px",
                'padding-bottom' => 0,
                'margin-top'     => 0,
                'padding-top'    => 0
            );
        }

        /**
         * @param string $email_title
         */
        public function setEmailTitle($email_title)
        {
            $this->email_title = $email_title;
        }

        /**
         * @param string $body_color
         */
        public function setBodyColor($body_color)
        {
            $this->body_color = $body_color;
        }

        /**
         * @param$table_color
         */
        public function setTableColor($table_color)
        {
            $this->table_color = $table_color;
        }

        /**
         * @param string $color
         */
        public function setColor($color)
        {
            $this->styles['color'] = $color;
        }

        /**
         * @param string $font_family
         */
        public function setFontFamily($font_family)
        {
            $this->styles['font-family'] = $font_family;
        }

        /**
         * @param string $font_size
         */
        public function setFontSize($font_size)
        {
            $this->styles['font-size'] = $font_size;
        }

        /**
         * @param string $line_height
         */
        public function setLineHeight($line_height)
        {
            $this->styles['line-height'] = $line_height;
        }

        /**
         * @param array $styles
         */
        public function setStyle($styles)
        {
            foreach ($styles as $property => $style) {
                $this->styles[$property] = $style;
            }
        }

        /**
         * @param string $text
         * @param string $tag
         * @param array $styles
         */
        public function setTag($text, $tag = 'p', $styles = array())
        {
            if (!empty($text)) {
                $text            = stripslashes($this->clean($text));
                $this->message[] = $this->makeTag($text, $tag, $styles);
            } else {
                $this->message[] = $this->makeTag('Not Provided', $tag, $styles);
            }
        }

        /**
         * @param string $text_area
         * @param string $tag
         * @param array $styles
         * @param mixed $text_wrap
         */
        public function setTextArea($text_area, $tag = 'p', $styles = array(), $text_wrap = null)
        {
            if (!empty($text_area)) {
                if ($text_wrap) {
                    $text_area = wordwrap($text_area, $text_wrap);
                }
                $text_area       = nl2br($text_area);
                $text_area       = stripslashes($this->clean($text_area));
                $text_area       = preg_replace('#&lt;((?:br) /?)&gt;#', '<\1>', $text_area);
                $this->message[] = $this->makeTag($text_area, $tag, $styles);
            } else {
                $this->message[] = $this->makeTag('Not Provided', $tag, $styles);
            }
        }

        /**
         * @param string $link_text
         * @param string $url
         * @param string $tag
         * @param array $styles
         */
        public function setLink($link_text, $url, $tag = 'p', $styles = array())
        {
            $this->message[] = $this->makeTag('<a href="'.$this->clean($url).'">'.$this->clean($link_text).'</a>', $tag,
                $styles);
        }

        public function getMessage()
        {
            $message = '';
            foreach ($this->message as $output) {
                $message .= $output;
            }

            return $message;
        }

        /**
         * @param array $content
         * @param null $template
         * @param null $directory
         *
         * @uses Twig_Loader_Filesystem()
         * @uses Twig_Environment()
         * @return string
         */
        public function getTwigTemplate($content = array(), $template = null, $directory = null)
        {
            if ($template && $directory) {
                $loader = new Twig_Loader_Filesystem($directory);
            } else {
                $loader   = new Twig_Loader_Filesystem(__DIR__."/../../views");
                $template = 'email.twig';
            }
            $twig = new Twig_Environment($loader);

            return $twig->render($template, array(
                'email_title' => $this->email_title,
                'body_color'  => $this->body_color,
                'table_color' => $this->table_color,
                'content' => $content
            ));
        }

        /**
         * @param array $array
{'fraction_non_alphanumeric': 0.1379425517702071, 'fraction_numerical': 0.003674014696058784, 'mean_word_length': 1.36, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 103, 'https://': 0, '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': '468430', 'n_tokens_mistral': 3416, 'n_tokens_neox': 3280, 'n_words': 640}