Passed
Push — master ( 41285d...af747e )
by Aimeos
06:24
created

Mailto   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A mailTo() 0 9 1
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2022
6
 * @package Controller
7
 * @subpackage Jobs
8
 */
9
10
11
namespace Aimeos\Controller\Jobs;
12
13
14
/**
15
 * Mailto trait for job controllers
16
 *
17
 * @package Controller
18
 * @subpackage Jobs
19
 */
20
trait Mailto
21
{
22
	/**
23
	 * Returns the context object
24
	 *
25
	 * @return \Aimeos\MShop\Context\Item\Iface Context object
26
	 */
27
	abstract function context() : \Aimeos\MShop\Context\Item\Iface;
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
28
29
	/**
30
	 * Prepares and returns a new mail message
31
	 *
32
	 * @param \Aimeos\MShop\Common\Item\Address\Iface $addr Address item object
33
	 * @return \Aimeos\MW\Mail\Message\Iface Prepared mail message
34
	 */
35
	protected function mailTo( \Aimeos\MShop\Common\Item\Address\Iface $addr ) : \Aimeos\MW\Mail\Message\Iface
36
	{
37
		$context = $this->context();
38
		$config = $context->config();
39
40
		return $context->mail()
41
			->header( 'X-MailGenerator', 'Aimeos' )
0 ignored issues
show
Bug introduced by
The method header() does not exist on Aimeos\MW\Mail\Iface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
			->/** @scrutinizer ignore-call */ header( 'X-MailGenerator', 'Aimeos' )

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42
			->from( $config->get( 'resource/email/from-email' ), $config->get( 'resource/email/from-name' ) )
43
			->to( $addr->getEMail(), $addr->getFirstName() . ' ' . $addr->getLastName() );
44
	}
45
}
46