本文整理汇总了PHP中Zend\Mail\Headers::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Headers::get方法的具体用法?PHP Headers::get怎么用?PHP Headers::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Mail\Headers
的用法示例。
在下文中一共展示了Headers::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processMessageReference
/**
* Retrieves Message Reference
*
* @param \Zend\Mail\Headers $headers
* @return string|null
*/
protected function processMessageReference($headers)
{
$messageReference = null;
if ($headers->get('references')) {
preg_match('/<([^<]+)>/', $headers->get('references')->getFieldValue(), $matches);
$messageReference = $matches[1];
}
return $messageReference;
}
示例2: testHeadersCanRemoveHeader
public function testHeadersCanRemoveHeader()
{
$headers = new Headers();
$headers->addHeaders(array('Foo' => 'bar', 'Baz' => 'baz'));
$header = $headers->get('foo');
$this->assertEquals(2, $headers->count());
$headers->removeHeader($header);
$this->assertEquals(1, $headers->count());
$this->assertFalse($headers->get('foo'));
}
示例3: processSubject
/**
* Retrieves Message Subject
*
* @param \Zend\Mail\Headers $headers
* @return string|null
*/
private function processSubject($headers)
{
$messageSubject = $headers->get('subject') ? $headers->get('subject')->getFieldValue() : null;
return $messageSubject;
}
示例4: getImportance
/**
* Gets an email importance
*
* @param Headers $headers
*
* @return integer
*/
protected function getImportance(Headers $headers)
{
$importance = $headers->get('Importance');
if ($importance instanceof HeaderInterface) {
switch (strtolower($importance->getFieldValue())) {
case 'high':
return 1;
case 'low':
return -1;
default:
return 0;
}
}
$labels = $headers->get('X-GM-LABELS');
if ($labels instanceof HeaderInterface) {
if ($labels->getFieldValue() === '\\\\Important') {
return 1;
}
} elseif ($labels instanceof \ArrayIterator) {
foreach ($labels as $label) {
if ($label instanceof HeaderInterface && $label->getFieldValue() === '\\\\Important') {
return 1;
}
}
}
return 0;
}
示例5: testRemoveHeaderWithInstanceWillRemoveThatInstance
public function testRemoveHeaderWithInstanceWillRemoveThatInstance()
{
$headers = new Mail\Headers();
$headers->addHeaders(array(array('Foo' => 'foo'), array('Foo' => 'bar'), 'Baz' => 'baz'));
$header = $headers->get('foo')->current();
$this->assertEquals(3, $headers->count());
$headers->removeHeader($header);
$this->assertEquals(2, $headers->count());
$this->assertTrue($headers->has('foo'));
$this->assertNotSame($header, $headers->get('foo'));
}