{@inheritdoc}

@param \Ems\Contracts\Mail\MailConfig
@param aray $data

@return string
184332
public function html(MailConfig $config, array $data)
    {
        return $this->views->make($config->template(), $data)->render();
    }
593152
function name_data($data){
		if ($data=="tr_pid")
			return $this->config->relation_id["db_name"];
		if ($data=="tr_text")
			return $this->config->text[0]["db_name"];
		return $data;
	}
1087463
private function normalizeArrayForNewLines(array $data) {
		foreach($data as $k => $item) {
			if(is_string($item)) {
				$data[$k] = str_replace(["\r\n", "\n\r", "\r"], "\n", $item);
			} elseif(is_array($item)) {
				$data[$k] = $this->normalizeArrayForNewLines($item);
			}
		}
		return $data;
	}
948555
public function getSignText($data, $partnerId)
    {
        foreach ($data as $key=>$value) {
            if ($value === '' or $value === null) {
                unset($data[$key]);
            }
        }
        ksort($data);

        $str = Helper::setParams($data);
        $str .= "&key=".$partnerId;
        $key = strtoupper(md5($str));

        return $key;
    }
235947
protected function create(array $data)
    {
        if (!isset($data['name']) || trim($data['name']) == '') {
            $data['name'] = $data['email'];
        }
        $user = User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
            ]);
        return $user;
    }
120230
public function write_setting($data) {
        $data = $this->validate($data);
        if ($data === false) {
            return  get_string('validateerror', 'admin');
        }
        return ($this->config_write($this->name, $data) ? '' : get_string('errorsetting', 'admin'));
    }
1304043
protected function _prepareMessage($data, array $options)
    {
        $attributes = [];

        $options += [
            'silent' => false,
            'compress' => true,
            'serializer' => extension_loaded('msgpack') ? 'msgpack' : 'json',
            'delivery_mode' => 1
        ];

        switch ($options['serializer']) {
            case 'json':
                $data = json_encode($data);
                $attributes['content_type'] = 'application/json';
                break;

            case 'text':
                $attributes['content_type'] = 'application/text';
                break;

            default:
                throw new RuntimeException('Unknown serializer: ' . $options['serializer']);
        }

        if (!empty($options['compress'])) {
            $data = gzcompress($data);
            $attributes += ['content_encoding' => 'gzip'];
        }

        if (!empty($options['delivery_mode'])) {
            $attributes['delivery_mode'] = $options['delivery_mode'];
        }

        return [$data, $attributes, $options];
    }
821115
public function get_foreach_const($data)
    {
        $Config =[];
        foreach($data as $key=>$value){
            $reflect = new \ReflectionClass('pizepei\config\\'.$value);
            $Config = array_merge_recursive($Config, $reflect->getConstants());
        }
        return $Config;
    }
451372
public function data($data)
    {
        // Ensure recipients have been set
        if ($this->_rcpt !== true) {
            /**
             * @see Zend_Mail_Protocol_Exception
             */
            // require_once 'Zend/Mail/Protocol/Exception.php';
            throw new Zend_Mail_Protocol_Exception('No recipient forward path has been supplied');
        }

        $this->_send('DATA');
        $this->_expect(354, 120); // Timeout set for 2 minutes as per RFC 2821 4.5.3.2

        foreach (explode(Zend_Mime::LINEEND, $data) as $line) {
            if (strpos($line, '.') === 0) {
                // Escape lines prefixed with a '.'
                $line = '.' . $line;
            }
            $this->_send($line);
        }

        $this->_send('.');
        $this->_expect(250, 600); // Timeout set for 10 minutes as per RFC 2821 4.5.3.2
        $this->_data = true;
    }
1127147
public function insertNewRecord($data) {

        $emailAttachment = new Email_attachment;

        $emailAttachment->email_messages_id          = $data['email_messages_id'];
        $emailAttachment->attachment_path            = $data['attachment_path'];
        $emailAttachment->attachment_filename        = $data['attachment_filename'];
        $emailAttachment->alternate_sort_string1     = $data['alternate_sort_string1'];
        $emailAttachment->alternate_sort_string2     = $data['alternate_sort_string2'];
        $emailAttachment->comments                   = $data['comments'];

        return $emailAttachment->save();
    }
497073
public function replace(string $text, Array $data): string {
    $replaceText = $text;
    if (!empty($text) && count($data)) {
      foreach ($data as $key => $value) {
        $replaceText = preg_replace("#(\{data\:{$key}\})#i", $value, $replaceText);
      }
    }
    return $replaceText;
  }
419474
public static function validateEmail($paramName, array $data)
    {
        $result = false;
        if (isset($data[$paramName])) {
            $result = filter_var($data[$paramName], FILTER_VALIDATE_EMAIL) !== false;
        } else {
            throw new \Exception('Parameter is not set');
        }
        return $result;
    }
190734
public function write_setting($data) {
        if (!is_array($data)) {
            return ''; // ignore it
        }
        if (!$this->load_choices() or empty($this->choices)) {
            return '';
        }
        $result = '';
        foreach ($this->choices as $key=>$unused) {
            if (!empty($data[$key])) {
                $result .= '1';
            } else {
                $result .= '0';
            }
        }
        return $this->config_write($this->name, $result) ? '' : get_string('errorsetting', 'admin');
    }
860505
public static function config_get_configuration_array($data) {
        $config = array();

        if (isset($data->path)) {
            $config['path'] = $data->path;
        }
        if (isset($data->autocreate)) {
            $config['autocreate'] = $data->autocreate;
        }
        if (isset($data->singledirectory)) {
            $config['singledirectory'] = $data->singledirectory;
        }
        if (isset($data->prescan)) {
            $config['prescan'] = $data->prescan;
        }

        return $config;
    }
240747
public function encrypt(string $data): string
    {
        $this->clearErrors();

        $isAddIvToOutput = false;
        $vector          = $this->getIV();
        if (empty($vector) === true) {
            $vector          = $this->generateIV();
            $isAddIvToOutput = true;
        }

        if ($this->isUseAuthentication() === true) {
            $encrypted = $this->openSslEncryptAuthenticated(
                $data,
                $this->getMethod(),
                $this->getPassword(),
                $this->getOptions(),
                $vector,
                $this->getAdditionalAuthenticationData(),
                $tag,
                $this->getTagLength()
            );

            // Tag/Message authentication code should be sent with the encrypted message
            // otherwise it won't be possible to validate and encrypt the message.
            // Though https://tools.ietf.org/html/rfc5084 do not directly says it should
            // be passed along with the encrypted message adding it is one of the possible
            // solutions.
            $encrypted = $tag . $encrypted;
        } else {
            $encrypted = $this->openSslEncrypt(
                $data,
                $this->getMethod(),
                $this->getPassword(),
                $this->getOptions(),
                $vector
            );
        }

        // Add initialization vector (IV) if it was generated otherwise it won't be possible to encrypt the message.
        //
        // Also @see http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf
        //
        // Appendix C: Generation of Initialization Vectors
        // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        // ...
        // The IV need not be secret, so the IV, or information sufficient to determine the IV, may be
        // transmitted with the ciphertext.
        // ...
        $result = $isAddIvToOutput === false ? $encrypted : $vector . $encrypted;

        return $result;
    }
811282
public function write_setting($data) {
        if (!is_array($data)) {
            return '';
        }

        $result = $this->config_write($this->name, (int)$data['h']) && $this->config_write($this->name2, (int)$data['m']);
        return ($result ? '' : get_string('errorsetting', 'admin'));
    }
465758
private function relations( $data,$config){
		$keys = (!empty($config))? array_keys($config) : array_keys($data);
		$out =array();
		foreach( $keys as $key){
		  if (!is_array($data[$key]))  continue;
		  
		  $alias = (isset($data[$key][0]) )?  Inflector::tableize($key) : strtolower($key) ;
		  $out[$alias] = $data[$key];  	
		}
		
		return $out ;
	}