本文整理汇总了PHP中Parameter::NewInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Parameter::NewInstance方法的具体用法?PHP Parameter::NewInstance怎么用?PHP Parameter::NewInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parameter
的用法示例。
在下文中一共展示了Parameter::NewInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reParseParameters
/**
* @return void
*/
private function reParseParameters()
{
$aDataToReParse = $this->CloneAsArray();
$sCharset = \MailSo\Base\Enumerations\Charset::UTF_8;
$this->clear();
$aPreParams = array();
foreach ($aDataToReParse as $oParam) {
$aMatch = array();
$sParamName = $oParam->Name();
if (preg_match('/([^\\*]+)\\*([\\d]{1,2})\\*/', $sParamName, $aMatch) && isset($aMatch[1], $aMatch[2]) && 0 < strlen($aMatch[1]) && is_numeric($aMatch[2])) {
if (!isset($aPreParams[$aMatch[1]])) {
$aPreParams[$aMatch[1]] = array();
}
$sValue = $oParam->Value();
$aValueParts = explode('\'\'', $sValue, 2);
if (is_array($aValueParts) && 2 === count($aValueParts) && 0 < strlen($aValueParts[1])) {
$sCharset = $aValueParts[0];
$sValue = $aValueParts[1];
}
$aPreParams[$aMatch[1]][(int) $aMatch[2]] = $sValue;
} else {
if (preg_match('/([^\\*]+)\\*/', $sParamName, $aMatch) && isset($aMatch[1])) {
if (!isset($aPreParams[$aMatch[1]])) {
$aPreParams[$aMatch[1]] = array();
}
$sValue = $oParam->Value();
$aValueParts = explode('\'\'', $sValue, 2);
if (is_array($aValueParts) && 2 === count($aValueParts) && 0 < strlen($aValueParts[1])) {
$sCharset = $aValueParts[0];
$sValue = $aValueParts[1];
}
$aPreParams[$aMatch[1]][0] = $sValue;
} else {
$this->Add($oParam);
}
}
}
foreach ($aPreParams as $sName => $aValues) {
ksort($aValues);
$sResult = implode(array_values($aValues));
$sResult = urldecode($sResult);
if (0 < strlen($sCharset)) {
$sResult = \MailSo\Base\Utils::ConvertEncoding($sResult, $sCharset, \MailSo\Base\Enumerations\Charset::UTF_8);
}
$this->Add(Parameter::NewInstance($sName, $sResult));
}
}
示例2: createNewMessageMixedBody
/**
* @param \MailSo\Mime\Part $oIncPart
*
* @return \MailSo\Mime\Part
*/
private function createNewMessageMixedBody($oIncPart)
{
$oResultPart = null;
$aAttachments = $this->oAttachmentCollection->UnlinkedAttachments();
if (0 < count($aAttachments)) {
$oResultPart = Part::NewInstance();
$oResultPart->Headers->AddByName(\MailSo\Mime\Enumerations\Header::CONTENT_TYPE, \MailSo\Mime\Enumerations\MimeType::MULTIPART_MIXED . '; ' . ParameterCollection::NewInstance()->Add(Parameter::NewInstance(\MailSo\Mime\Enumerations\Parameter::BOUNDARY, $this->generateNewBoundary()))->ToString());
$oResultPart->SubParts->Add($oIncPart);
foreach ($aAttachments as $oAttachment) {
$oResultPart->SubParts->Add($this->createNewMessageAttachmentBody($oAttachment));
}
} else {
$oResultPart = $oIncPart;
}
return $oResultPart;
}