Skip to content

Commit 5a27927

Browse files
committed
Initial code commit.
1 parent 6cda46a commit 5a27927

File tree

81 files changed

+3540
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+3540
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace org\nameapi\client\commonwsdl;
4+
5+
class PriceArguments {
6+
7+
public function __construct() {
8+
}
9+
10+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace org\nameapi\client\commonwsdl;
4+
5+
class PriceResponse {
6+
7+
/**
8+
* @var int $return
9+
*/
10+
public $return = null;
11+
12+
/**
13+
* @param int $return
14+
*/
15+
public function __construct($return) {
16+
$this->return = $return;
17+
}
18+
19+
/**
20+
* @return int
21+
*/
22+
public function getReturn() {
23+
return $this->return;
24+
}
25+
26+
/**
27+
* @param int $return
28+
*/
29+
public function setReturn($return) {
30+
$this->return = $return;
31+
}
32+
33+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace org\nameapi\client\commonwsdl\exception;
4+
5+
class Blame {
6+
const __default = 'SERVER_UNKNOWN';
7+
const SERVER_UNKNOWN = 'SERVER_UNKNOWN';
8+
const SERVER_CODE = 'SERVER_CODE';
9+
const SERVER_DATA = 'SERVER_DATA';
10+
const SERVER_CIRCUMSTANCE = 'SERVER_CIRCUMSTANCE';
11+
const SERVER_PERFORMANCE = 'SERVER_PERFORMANCE';
12+
const CLIENT_DATA = 'CLIENT_DATA';
13+
const CLIENT_LOGIC = 'CLIENT_LOGIC';
14+
const CLIENT_BEHAVIOR = 'CLIENT_BEHAVIOR';
15+
const CLIENT_CODE = 'CLIENT_CODE';
16+
const NETWORK = 'NETWORK';
17+
const UNKNOWN = 'UNKNOWN';
18+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
3+
namespace org\nameapi\client\commonwsdl\exception;
4+
5+
include_once('Blame.php');
6+
include_once('Retry.php');
7+
8+
class FaultBean {
9+
10+
/**
11+
* @var Blame $blame
12+
*/
13+
public $blame = null;
14+
15+
/**
16+
* @var boolean $problemLogged
17+
*/
18+
public $problemLogged = null;
19+
20+
/**
21+
* @var Retry $retry
22+
*/
23+
public $retry = null;
24+
25+
/**
26+
* @param Blame $blame
27+
* @param boolean $problemLogged
28+
* @param Retry $retry
29+
*/
30+
public function __construct( Blame $blame, $problemLogged, $retry) {
31+
$this->blame = $blame;
32+
$this->problemLogged = $problemLogged;
33+
$this->retry = $retry;
34+
}
35+
36+
/**
37+
* @return Blame
38+
*/
39+
public function getBlame() {
40+
return $this->blame;
41+
}
42+
/**
43+
* @param Blame $blame
44+
*/
45+
public function setBlame(Blame $blame) {
46+
$this->blame = $blame;
47+
}
48+
49+
/**
50+
* @return boolean
51+
*/
52+
public function getProblemLogged() {
53+
return $this->problemLogged;
54+
}
55+
/**
56+
* @param boolean $problemLogged
57+
*/
58+
public function setProblemLogged($problemLogged) {
59+
$this->problemLogged = $problemLogged;
60+
}
61+
62+
/**
63+
* @return Retry
64+
*/
65+
public function getRetry() {
66+
return $this->retry;
67+
}
68+
/**
69+
* @param Retry $retry
70+
*/
71+
public function setRetry($retry) {
72+
$this->retry = $retry;
73+
}
74+
75+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace org\nameapi\client\commonwsdl\exception;
4+
5+
class Retry {
6+
const __default = 'NO';
7+
const NO = 'NO';
8+
const LATER = 'LATER';
9+
const NOW = 'NOW';
10+
const UNKNOWN = 'UNKNOWN';
11+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace org\nameapi\client\services;
4+
5+
require_once('ServiceFactory.php');
6+
require_once('Util.php');
7+
8+
9+
/**
10+
*/
11+
abstract class BaseSoapClient extends \SoapClient {
12+
13+
public function __construct($wsdl, array $classmap=array(), array $options=array()) {
14+
Util::mergeClassmap($options, $classmap, ServiceFactory::$classmap);
15+
$options['features'] = SOAP_SINGLE_ELEMENT_ARRAYS;
16+
parent::__construct($wsdl, $options);
17+
}
18+
19+
}
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<?php
2+
3+
namespace org\nameapi\client\services;
4+
5+
use org\nameapi\ontology\input\context\Context;
6+
7+
require_once('system/SystemServiceFactory.php');
8+
require_once('parser/NameParserServiceFactory.php');
9+
require_once('genderizer/GenderizerServiceFactory.php');
10+
require_once('matcher/MatcherServiceFactory.php');
11+
require_once('formatter/FormatterServiceFactory.php');
12+
require_once('email/EmailServiceFactory.php');
13+
14+
require_once(__DIR__.'/../commonwsdl/exception/FaultBean.php');
15+
require_once(__DIR__.'/../commonwsdl/PriceArguments.php');
16+
require_once(__DIR__.'/../commonwsdl/PriceResponse.php');
17+
18+
require_once(__DIR__.'/../../ontology/input/context/Context.php');
19+
require_once(__DIR__.'/../../ontology/input/entities/contact/EmailAddressFactory.php');
20+
require_once(__DIR__.'/../../ontology/input/entities/contact/TelNumberFactory.php');
21+
require_once(__DIR__.'/../../ontology/input/entities/person/NaturalInputPersonBuilder.php');
22+
23+
24+
25+
/**
26+
*
27+
*/
28+
class ServiceFactory {
29+
30+
private $context;
31+
private $systemServiceFactory;
32+
private $nameParserServiceFactory;
33+
private $genderizerServiceFactory;
34+
private $matcherServiceFactory;
35+
private $formatterServiceFactory;
36+
private $emailServiceFactory;
37+
38+
39+
/**
40+
*/
41+
public function __construct(Context $context) {
42+
$this->context = $context;
43+
}
44+
45+
46+
/**
47+
* @return system\SystemServiceFactory
48+
*/
49+
public function systemServices() {
50+
if ($this->systemServiceFactory==null) {
51+
$this->systemServiceFactory = new system\SystemServiceFactory($this->context);
52+
}
53+
return $this->systemServiceFactory;
54+
}
55+
56+
/**
57+
* @return parser\NameParserServiceFactory
58+
*/
59+
public function nameParserServiceFactory() {
60+
if ($this->nameParserServiceFactory==null) {
61+
$this->nameParserServiceFactory = new parser\NameParserServiceFactory($this->context);
62+
}
63+
return $this->nameParserServiceFactory;
64+
}
65+
66+
/**
67+
* @return genderizer\GenderizerServiceFactory
68+
*/
69+
public function genderizerServiceFactory() {
70+
if ($this->genderizerServiceFactory==null) {
71+
$this->genderizerServiceFactory = new genderizer\GenderizerServiceFactory($this->context);
72+
}
73+
return $this->genderizerServiceFactory;
74+
}
75+
76+
/**
77+
* @return matcher\MatcherServiceFactory
78+
*/
79+
public function matcherServiceFactory() {
80+
if ($this->matcherServiceFactory==null) {
81+
$this->matcherServiceFactory = new matcher\MatcherServiceFactory($this->context);
82+
}
83+
return $this->matcherServiceFactory;
84+
}
85+
86+
/**
87+
* @return formatter\FormatterServiceFactory
88+
*/
89+
public function formatterServiceFactory() {
90+
if ($this->formatterServiceFactory==null) {
91+
$this->formatterServiceFactory = new formatter\FormatterServiceFactory($this->context);
92+
}
93+
return $this->formatterServiceFactory;
94+
}
95+
96+
/**
97+
* @return email\EmailServiceFactory
98+
*/
99+
public function emailServiceFactory() {
100+
if ($this->emailServiceFactory==null) {
101+
$this->emailServiceFactory = new email\EmailServiceFactory($this->context);
102+
}
103+
return $this->emailServiceFactory;
104+
}
105+
106+
107+
public static $classmap = array(
108+
'soapContext' => 'org\nameapi\ontology\input\context\Context',
109+
110+
'faultBean' => 'org\nameapi\client\commonwsdl\exception\FaultBean',
111+
112+
'price' => 'org\nameapi\client\commonwsdl\PriceArguments',
113+
'priceResponse' => 'org\nameapi\client\commonwsdl\PriceResponse',
114+
115+
'soapSimpleNaturalPerson' => '\org\nameapi\ontology\input\entities\person\NaturalInputPerson',
116+
'soapPersonName' => '\org\nameapi\ontology\input\entities\person\name\InputPersonName',
117+
'soapFieldOrTypeBasedTerm' => '\org\nameapi\ontology\input\entities\person\name\NameField',
118+
'soapAgeInfo' => '\org\nameapi\ontology\input\entities\person\age\AgeInfo',
119+
//'soapAddressRelation' => '\org\nameapi\soapAddressRelation',
120+
//'soapAddress' => '\org\nameapi\soapAddress',
121+
//'soapStreetInfo' => '\org\nameapi\soapStreetInfo',
122+
'soapEmailAddress' => '\org\nameapi\ontology\input\entities\contact\EmailAddress',
123+
'soapTelNumber' => '\org\nameapi\ontology\input\entities\contact\TelNumber',
124+
125+
// 'properties' => '\org\nameapi\properties',
126+
// 'entry' => '\org\nameapi\entry',
127+
);
128+
129+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace org\nameapi\client\services;
4+
5+
/**
6+
*
7+
*/
8+
class Util {
9+
10+
static function mergeClassmap(&$options, $map1, $map2) {
11+
if (!isset($options['classmap'])) {
12+
$options['classmap'] = array();
13+
}
14+
$array = &$options['classmap'];
15+
Util::mergeMap($array, $map1);
16+
Util::mergeMap($array, $map2);
17+
}
18+
private static function mergeMap(&$array, $map) {
19+
foreach ($map as $key => $value) {
20+
if (isset($array[$key])) {
21+
throw new \Exception("Already defined key "+$key+ " for value: "+$array[$key]);
22+
}
23+
$array[$key] = $value;
24+
}
25+
}
26+
27+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace org\nameapi\client\services\email;
4+
5+
use org\nameapi\ontology\input\context\Context;
6+
use org\nameapi\client\services\email\disposableemailaddressdetector\DisposableEmailAddressDetector;
7+
8+
require_once('disposableemailaddressdetector/DisposableEmailAddressDetector.php');
9+
10+
11+
/**
12+
*
13+
*/
14+
class EmailServiceFactory {
15+
16+
private $context;
17+
private $disposableEmailAddressDetector;
18+
19+
/**
20+
*/
21+
public function __construct(Context $context) {
22+
$this->context = $context;
23+
}
24+
25+
/**
26+
* @return DisposableEmailAddressDetector
27+
*/
28+
public function disposableEmailAddressDetector() {
29+
if ($this->disposableEmailAddressDetector==null) {
30+
$this->disposableEmailAddressDetector = new DisposableEmailAddressDetector($this->context);
31+
}
32+
return $this->disposableEmailAddressDetector;
33+
}
34+
35+
}

0 commit comments

Comments
 (0)