Passed
Push — master ( bfdfff...e9621f )
by Aimeos
13:01
created

Standard::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2024
6
 * @package Base
7
 * @subpackage Mail
8
 */
9
10
11
namespace Aimeos\Base\Mail\Manager;
12
13
14
/**
15
 * Laravel mail manager
16
 *
17
 * @package Base
18
 * @subpackage Mail
19
 */
20
class Standard implements Iface
21
{
22
	private ?\Illuminate\Mail\MailManager $manager;
23
24
25
	/**
26
	 * Initializes the object
27
	 *
28
	 * @param \Illuminate\Mail\MailManager $manager Mail manager object
29
	 */
30
	public function __construct( \Illuminate\Mail\MailManager $manager )
31
	{
32
		$this->manager = $manager;
33
	}
34
35
36
	/**
37
	 * Returns the mailer for the given name
38
	 *
39
	 * @param string $name Key for the mailer
40
	 * @return \Aimeos\Base\Mail\Iface Mail object
41
	 * @throws \Aimeos\Base\Mail\Exception If an error occurs
42
	 */
43
	public function get( string $name ) : \Aimeos\Base\Mail\Iface
44
	{
45
		return new \Aimeos\Base\Mail\Laravel( $this->manager->mailer( $name ) );
0 ignored issues
show
Bug introduced by
$this->manager->mailer($name) of type Illuminate\Mail\Mailer is incompatible with the type Closure expected by parameter $mailer of Aimeos\Base\Mail\Laravel::__construct(). ( Ignorable by Annotation )

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

45
		return new \Aimeos\Base\Mail\Laravel( /** @scrutinizer ignore-type */ $this->manager->mailer( $name ) );
Loading history...
Bug introduced by
The method mailer() does not exist on null. ( Ignorable by Annotation )

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

45
		return new \Aimeos\Base\Mail\Laravel( $this->manager->/** @scrutinizer ignore-call */ mailer( $name ) );

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...
46
	}
47
}
48