GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ExecuteMappingFluentSyntax   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 43
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A to() 0 5 1
A toType() 0 5 1
1
<?php
2
3
namespace Papper\FluentSyntax;
4
5
use Papper\Engine;
6
use Papper\MappingContext;
7
use Papper\MappingException;
8
use Papper\NotSupportedException;
9
10
/**
11
 * Mapping executing options
12
 *
13
 * @author Vladimir Komissarov <[email protected]>
14
 */
15
class ExecuteMappingFluentSyntax
16
{
17
	private $context;
18
	private $engine;
19
20
	public function __construct(Engine $engine, $source, $sourceType = null)
21
	{
22
		$this->engine = $engine;
23
		$this->context = new MappingContext();
24
		$this->context->setSource($source, $sourceType);
25
	}
26
27
	/**
28
	 * Execute a mapping to the existing destination object.
29
	 * If no Map exists then one is created.
30
	 *
31
	 * @param object|object[] $destination Destination object or collection to map into
32
	 * @param string|null $destinationType Destination type to map
33
	 * @return object|object[] The mapped destination object, same instance as the $destination object
34
	 * @throws NotSupportedException
35
	 * @throws MappingException
36
	 */
37
	public function to($destination, $destinationType = null)
38
	{
39
		$this->context->setDestination($destination, $destinationType);
40
		return $this->engine->execute($this->context);
41
	}
42
43
	/**
44
	 * Execute a mapping to a new destination object.
45
	 * If no Map exists then one is created.
46
	 *
47
	 * @param string $destinationType Destination type to create and map
48
	 * @return object|object[]
49
	 * @throws NotSupportedException
50
	 * @throws MappingException
51
	 */
52
	public function toType($destinationType)
53
	{
54
		$this->context->setDestination(null, $destinationType);
55
		return $this->engine->execute($this->context);
56
	}
57
}
58