Zend   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __clone() 0 4 2
A createMessage() 0 3 1
A send() 0 3 1
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2013
6
 * @copyright Aimeos (aimeos.org), 2014-2018
7
 * @package MW
8
 * @subpackage Mail
9
 */
10
11
12
namespace Aimeos\MW\Mail;
13
14
15
/**
16
 * Zend implementation for creating and sending e-mails.
17
 *
18
 * @package MW
19
 * @subpackage Mail
20
 */
21
class Zend implements \Aimeos\MW\Mail\Iface
22
{
23
	private $object;
24
	private $transport;
25
26
27
	/**
28
	 * Initializes the instance of the class.
29
	 *
30
	 * @param \Zend_Mail $object Zend mail object
31
	 * @param \Zend_Mail_Transport_Base|null $transport Mail transport object
32
	 */
33
	public function __construct( \Zend_Mail $object, \Zend_Mail_Transport_Base $transport = null )
0 ignored issues
show
Bug introduced by
The type Zend_Mail was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The type Zend_Mail_Transport_Base was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
34
	{
35
		$this->object = $object;
36
		$this->transport = $transport;
37
	}
38
39
40
	/**
41
	 * Creates a new e-mail message object.
42
	 *
43
	 * @param string $charset Default charset of the message
44
	 * @return \Aimeos\MW\Mail\Message\Iface E-mail message object
45
	 */
46
	public function createMessage( $charset = 'UTF-8' )
47
	{
48
		return new \Aimeos\MW\Mail\Message\Zend( clone $this->object );
49
	}
50
51
52
	/**
53
	 * Sends the e-mail message to the mail server.
54
	 *
55
	 * @param \Aimeos\MW\Mail\Message\Iface $message E-mail message object
56
	 */
57
	public function send( \Aimeos\MW\Mail\Message\Iface $message )
58
	{
59
		$message->getObject()->send( $this->transport );
0 ignored issues
show
Bug introduced by
The method getObject() does not exist on Aimeos\MW\Mail\Message\Iface. It seems like you code against a sub-type of Aimeos\MW\Mail\Message\Iface such as Aimeos\MW\Mail\Message\Zend. ( Ignorable by Annotation )

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

59
		$message->/** @scrutinizer ignore-call */ 
60
            getObject()->send( $this->transport );
Loading history...
60
	}
61
62
63
	/**
64
	 * Clones the internal objects.
65
	 */
66
	public function __clone()
67
	{
68
		$this->object = clone $this->object;
69
		$this->transport = ( isset( $this->transport ) ? clone $this->transport : null );
70
	}
71
}
72