PropertyMapDefinition::getPropertyMaps()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace TheSportsDb\PropertyMapper;
4
5
/**
6
 * Describes a property map definition.
7
 *
8
 * @author Jelle Sebreghts
9
 */
10
class PropertyMapDefinition {
11
12
  /**
13
   * The property maps.
14
   *
15
   * @var \TheSportsDb\PropertyMapper\PropertyMap[]
16
   */
17
  protected $propertyMaps = [];
18
19
  /**
20
   * Adds a property map.
21
   * @param \TheSportsDb\PropertyMapper\PropertyDefinition $source
22
   *   The source property definition.
23
   * @param \TheSportsDb\PropertyMapper\PropertyDefinition $destination
24
   *   The destination property definition.
25
   * @param callable $transform
0 ignored issues
show
Documentation introduced by
Should the type for parameter $transform not be null|callable? Also, consider making the array more specific, something like array<String>, or String[].

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive. In addition it looks for parameters that have the generic type array and suggests a stricter type like array<String>.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
26
   *   The transform method.
27
   * @param callable $reverse
0 ignored issues
show
Documentation introduced by
Should the type for parameter $reverse not be null|callable? Also, consider making the array more specific, something like array<String>, or String[].

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive. In addition it looks for parameters that have the generic type array and suggests a stricter type like array<String>.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
28
   *   The reverse method.
29
   *
30
   * @return $this
31
   */
32 4
  public function addPropertyMap(PropertyDefinition $source, PropertyDefinition $destination, callable $transform = NULL, callable $reverse = NULL) {
33 4
    $this->propertyMaps[] = new PropertyMap(
34
      $source,
35
      $destination,
36
      $transform,
37
      $reverse
38
    );
39 4
    return $this;
40
  }
41
42
  /**
43
   * Gets the property maps.
44
   *
45
   * @return \TheSportsDb\PropertyMapper\PropertyMap[]
46
   *   The property maps.
47
   */
48 1
  public function getPropertyMaps() {
49 1
    return $this->propertyMaps;
50
  }
51
52
53
}
54