Skip to content

Commit 8c5d257

Browse files
committed
Updated person matcher ws.
1 parent 1e7d7b3 commit 8c5d257

File tree

7 files changed

+76
-50
lines changed

7 files changed

+76
-50
lines changed

src/org/nameapi/client/services/matcher/AgeMatch.php renamed to src/org/nameapi/client/services/matcher/AgeMatchType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* Possible values are: EQUAL, PARTIAL, NOT_APPLICABLE, DIFFERENT
1010
*/
11-
final class AgeMatch {
11+
final class AgeMatchType {
1212

1313
/**
1414
* @var string $value
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace org\nameapi\client\services\matcher;
4+
5+
require_once(__DIR__.'/AgeMatchType.php');
6+
7+
class AgeMatcherResult {
8+
9+
/**
10+
* @var AgeMatchType
11+
*/
12+
private $matchType;
13+
14+
function __construct($matchType) {
15+
$this->matchType = $matchType;
16+
}
17+
18+
/**
19+
* @return AgeMatchType
20+
*/
21+
public function getMatchType() {
22+
return $this->matchType;
23+
}
24+
25+
}

src/org/nameapi/client/services/matcher/GenderMatch.php renamed to src/org/nameapi/client/services/matcher/GenderMatcherResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
require_once(__DIR__.'/GenderMatchType.php');
66

77

8-
class GenderMatch {
8+
class GenderMatcherResult {
99

1010
/**
1111
* @var GenderMatchType $type

src/org/nameapi/client/services/matcher/PersonNameMatch.php renamed to src/org/nameapi/client/services/matcher/PersonNameMatcherResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
require_once(__DIR__.'/PersonNameMatchType.php');
66

7-
class PersonNameMatch {
7+
class PersonNameMatcherResult {
88

99
/**
1010
* @var PersonNameMatchType $type

src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherResult.php

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22

33
namespace org\nameapi\client\services\matcher\personmatcher;
44

5-
use org\nameapi\client\services\matcher\PersonNameMatch;
6-
use org\nameapi\client\services\matcher\GenderMatch;
7-
use org\nameapi\client\services\matcher\AgeMatch;
5+
use org\nameapi\client\services\matcher\PersonNameMatcherResult;
6+
use org\nameapi\client\services\matcher\GenderMatcherResult;
7+
use org\nameapi\client\services\matcher\AgeMatcherResult;
88

99
require_once(__DIR__.'/PersonMatchType.php');
1010
require_once(__DIR__.'/PersonMatchComposition.php');
11-
require_once(__DIR__.'/../PersonNameMatch.php');
12-
require_once(__DIR__.'/../GenderMatch.php');
13-
require_once(__DIR__.'/../AgeMatch.php');
11+
require_once(__DIR__.'/../PersonNameMatcherResult.php');
12+
require_once(__DIR__.'/../GenderMatcherResult.php');
13+
require_once(__DIR__.'/../AgeMatcherResult.php');
1414

1515

1616
class PersonMatcherResult {
1717

1818
/**
1919
* @var PersonMatchType $personMatchType
2020
*/
21-
private $personMatchType = null;
21+
private $matchType = null;
2222

2323
/**
2424
* @var PersonMatchComposition $personMatchComposition
2525
*/
26-
private $personMatchComposition = null;
26+
private $matchComposition = null;
2727

2828
/**
2929
* @var float $points
@@ -36,53 +36,53 @@ class PersonMatcherResult {
3636
private $confidence = null;
3737

3838
/**
39-
* @var PersonNameMatch $personNameMatch
39+
* @var PersonNameMatcherResult $personNameMatcherResult
4040
*/
41-
private $personNameMatch = null;
41+
private $personNameMatcherResult = null;
4242

4343
/**
44-
* @var GenderMatch $genderMatch
44+
* @var GenderMatcherResult $genderMatcherResult
4545
*/
46-
private $genderMatch = null;
46+
private $genderMatcherResult = null;
4747

4848
/**
49-
* @var AgeMatch $ageMatch
49+
* @var AgeMatcherResult $ageMatcherResult
5050
*/
51-
private $ageMatch = null;
51+
private $ageMatcherResult = null;
5252

5353
/**
5454
*
5555
* @param PersonMatchType $personMatchType
5656
* @param PersonMatchComposition $personMatchComposition
5757
* @param float $points
5858
* @param float $confidence
59-
* @param PersonNameMatch $personNameMatch
60-
* @param GenderMatch $genderMatch
61-
* @param AgeMatch $ageMatch
59+
* @param PersonNameMatcherResult $personNameMatch
60+
* @param GenderMatcherResult $genderMatch
61+
* @param AgeMatcherResult $ageMatch
6262
*/
6363
public function __construct($personMatchType, $personMatchComposition, $points, $confidence, $personNameMatch, $genderMatch, $ageMatch) {
64-
$this->personMatchType = $personMatchType;
65-
$this->personMatchComposition = $personMatchComposition;
64+
$this->matchType = $personMatchType;
65+
$this->matchComposition = $personMatchComposition;
6666
$this->points = $points;
6767
$this->confidence = $confidence;
68-
$this->personNameMatch = $personNameMatch;
69-
$this->genderMatch = $genderMatch;
70-
$this->ageMatch = $ageMatch;
68+
$this->personNameMatcherResult = $personNameMatch;
69+
$this->genderMatcherResult = $genderMatch;
70+
$this->ageMatcherResult = $ageMatch;
7171
}
7272

7373

7474
/**
7575
* @return PersonMatchType
7676
*/
77-
public function getPersonMatchType() {
78-
return $this->personMatchType;
77+
public function getMatchType() {
78+
return $this->matchType;
7979
}
8080

8181
/**
8282
* @return PersonMatchComposition
8383
*/
84-
public function getPersonMatchComposition() {
85-
return $this->personMatchComposition;
84+
public function getMatchComposition() {
85+
return $this->matchComposition;
8686
}
8787

8888
/**
@@ -103,25 +103,25 @@ public function getConfidence() {
103103

104104
/**
105105
*
106-
* @return PersonNameMatch
106+
* @return PersonNameMatcherResult
107107
*/
108-
public function getPersonNameMatch() {
109-
return $this->personNameMatch;
108+
public function getPersonNameMatcherResult() {
109+
return $this->personNameMatcherResult;
110110
}
111111

112112
/**
113113
*
114-
* @return GenderMatch
114+
* @return GenderMatcherResult
115115
*/
116-
public function getGenderMatch() {
117-
return $this->genderMatch;
116+
public function getGenderMatcherResult() {
117+
return $this->genderMatcherResult;
118118
}
119119

120120
/**
121-
* @return AgeMatch
121+
* @return AgeMatcherResult
122122
*/
123-
public function getAgeMatch() {
124-
return $this->ageMatch;
123+
public function getAgeMatcherResult() {
124+
return $this->ageMatcherResult;
125125
}
126126

127127
}

src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherService.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
use org\nameapi\ontology\input\entities\person\NaturalInputPerson;
77
use org\nameapi\client\services\matcher\PersonNameMatchType;
88

9-
use org\nameapi\client\services\matcher\PersonNameMatch;
10-
use org\nameapi\client\services\matcher\GenderMatch;
9+
use org\nameapi\client\services\matcher\PersonNameMatcherResult;
10+
use org\nameapi\client\services\matcher\GenderMatcherResult;
1111
use org\nameapi\client\services\matcher\GenderMatchType;
12-
use org\nameapi\client\services\matcher\AgeMatch;
12+
use org\nameapi\client\services\matcher\AgeMatcherResult;
13+
use org\nameapi\client\services\matcher\AgeMatchType;
1314

1415
require_once(__DIR__.'/wsdl/SoapPersonMatcherService.php');
1516
require_once(__DIR__.'/PersonMatcherResult.php');
@@ -45,15 +46,15 @@ public function match(NaturalInputPerson $person1, NaturalInputPerson $person2)
4546
$parameters = new wsdl\MatchArguments($this->context, $person1, $person2);
4647
$result = $this->soapPersonMatcher->match($parameters);
4748

48-
$genderWarnings = isSet($result->genderMatch->warnings) ? $result->genderMatch->warnings : null;
49+
$genderWarnings = isSet($result->genderMatcherResult->warnings) ? $result->genderMatcherResult->warnings : null;
4950

5051
return new PersonMatcherResult(
51-
new PersonMatchType($result->personMatchType),
52-
new PersonMatchComposition($result->personMatchComposition),
52+
new PersonMatchType($result->matchType),
53+
new PersonMatchComposition($result->matchComposition),
5354
$result->points, $result->confidence,
54-
new PersonNameMatch(new PersonNameMatchType($result->personNameMatch->type)),
55-
new GenderMatch(new GenderMatchType($result->genderMatch->type), $result->genderMatch->confidence, $genderWarnings),
56-
new AgeMatch($result->ageMatch)
55+
new PersonNameMatcherResult(new PersonNameMatchType($result->personNameMatcherResult->matchType)),
56+
new GenderMatcherResult(new GenderMatchType($result->genderMatcherResult->matchType), $result->genderMatcherResult->confidence, $genderWarnings),
57+
new AgeMatcherResult(new AgeMatchType($result->ageMatcherResult->matchType))
5758
);
5859
}
5960

tests/functional/org/nameapi/client/services/matcher/personmatcher/PersonMatcherServiceTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function testMatch_matching() {
2424
->build())
2525
->build();
2626
$personMatcherResult = $personMatcher->match($inputPerson1, $inputPerson2);
27-
$this->assertEquals('MATCHING', (string)$personMatcherResult->getPersonMatchType());
27+
$this->assertEquals('MATCHING', (string)$personMatcherResult->getMatchType());
2828
}
2929

3030
public function testMatch_similar() {
@@ -42,7 +42,7 @@ public function testMatch_similar() {
4242
->ageInfo( AgeInfoFactory::forDate(1990,12,31) )
4343
->build();
4444
$personMatcherResult = $personMatcher->match($inputPerson1, $inputPerson2);
45-
$this->assertEquals('SIMILAR', (string)$personMatcherResult->getPersonMatchType());
45+
$this->assertEquals('SIMILAR', (string)$personMatcherResult->getMatchType());
4646
}
4747

4848
public function testMatch_different() {
@@ -60,7 +60,7 @@ public function testMatch_different() {
6060
->ageInfo( AgeInfoFactory::forDate(1990,12,31) )
6161
->build();
6262
$personMatcherResult = $personMatcher->match($inputPerson1, $inputPerson2);
63-
$this->assertEquals('DIFFERENT', (string)$personMatcherResult->getPersonMatchType());
63+
$this->assertEquals('DIFFERENT', (string)$personMatcherResult->getMatchType());
6464
}
6565

6666
}

0 commit comments

Comments
 (0)