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.

MapFromTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testShouldMapFromAnotherValue() 0 21 1
1
<?php
2
3
namespace Papper\Tests\MemberOptions\MapFrom;
4
5
use Papper\MemberOption\MapFrom;
6
use Papper\Tests\FixtureBase;
7
use Papper\Tests\TestCaseBase;
8
9
class MapFromTest extends TestCaseBase
10
{
11
	public function testShouldMapFromAnotherValue()
12
	{
13
		// arrange
14
		$engine = $this->createEngine();
15
		$engine->createMap(User::className(), UserDTO::className())
16
			->forMember('fullName', new MapFrom(function(User $source) {
17
				return $source->firstName . ' ' . $source->lastName;
18
			}))
19
			->forMember('numberOfYears', new MapFrom('age'));
20
21
		$user = new User();
22
		$user->firstName = 'John';
23
		$user->lastName = 'Smith';
24
		$user->age = 26;
25
		// act
26
		/** @var UserDTO $dest */
27
		$dest = $engine->map($user)->toType(UserDTO::className());
28
		// assert
29
		$this->assertEquals('John Smith', $dest->fullName);
30
		$this->assertEquals(26, $dest->numberOfYears);
31
	}
32
}
33
34
class User extends FixtureBase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
35
{
36
	public $firstName;
37
	public $lastName;
38
	public $age;
39
}
40
41
class UserDTO extends FixtureBase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
42
{
43
	public $fullName;
44
	public $numberOfYears;
45
}
46