From d94df3f7240e37c043d3724c952b49e05495db8d Mon Sep 17 00:00:00 2001 From: Mark Stralka Date: Sat, 20 Mar 2021 14:22:55 -0400 Subject: [PATCH 1/9] Renamed packages to comply with PSR-4 naming standard. Removed require_once, require, and include_once statements. Added PHPUnit 9 and cleaned up test cases so they comply with PSR-4 also. --- README.md | 51 ++--- composer.json | 14 +- src/org/nameapi/client/fault/Blame.php | 22 ++- src/org/nameapi/client/fault/FaultInfo.php | 13 +- .../client/fault/FaultInfoUnmarshaller.php | 27 ++- src/org/nameapi/client/fault/Retry.php | 16 +- src/org/nameapi/client/fault/RetryType.php | 26 ++- .../nameapi/client/fault/ServiceException.php | 16 +- .../nameapi/client/http/HttpResponseData.php | 4 +- .../nameapi/client/http/RestHttpClient.php | 53 +++--- .../client/http/RestHttpClientConfig.php | 179 +++++++++--------- .../nameapi/client/services/BaseService.php | 24 ++- src/org/nameapi/client/services/Host.php | 45 +++-- .../client/services/ServiceFactory.php | 110 +++++------ .../development/DevelopmentServiceFactory.php | 20 +- .../ExceptionThrowerService.php | 25 +-- .../services/email/EmailServiceFactory.php | 28 +-- .../DisposableEmailAddressDetectorResult.php | 11 +- .../DisposableEmailAddressDetectorService.php | 24 +-- .../disposableemailaddressdetector/Maybe.php | 18 +- .../emailnameparser/EmailAddressNameType.php | 19 +- .../EmailAddressParsingResultType.php | 25 +-- .../emailnameparser/EmailNameParserMatch.php | 38 ++-- .../emailnameparser/EmailNameParserResult.php | 32 ++-- .../EmailNameParserService.php | 31 +-- .../emailnameparser/NameFromEmailAddress.php | 23 ++- .../formatter/FormatterProperties.php | 11 +- .../services/formatter/FormatterResult.php | 14 +- .../formatter/FormatterServiceFactory.php | 28 +-- .../NameFieldFormatterService.php | 23 ++- .../PersonNameFormatterService.php | 32 ++-- .../genderizer/GenderizerServiceFactory.php | 22 +-- .../persongenderizer/PersonGenderResult.php | 19 +- .../PersonGenderizerService.php | 26 +-- .../client/services/matcher/AgeMatchType.php | 16 +- .../services/matcher/AgeMatcherResult.php | 15 +- .../services/matcher/GenderMatchType.php | 15 +- .../services/matcher/GenderMatcherResult.php | 20 +- .../matcher/MatcherServiceFactory.php | 21 +- .../services/matcher/PersonNameMatchType.php | 15 +- .../matcher/PersonNameMatcherResult.php | 13 +- .../personmatcher/PersonMatchComposition.php | 16 +- .../matcher/personmatcher/PersonMatchType.php | 16 +- .../personmatcher/PersonMatcherResult.php | 42 ++-- .../personmatcher/PersonMatcherService.php | 40 ++-- .../services/parser/OutputPersonName.php | 27 +-- .../client/services/parser/OutputTermType.php | 12 +- .../services/parser/ParserServiceFactory.php | 21 +- .../nameapi/client/services/parser/Term.php | 26 +-- .../parser/personnameparser/DisputeType.php | 16 +- .../parser/personnameparser/ParsedPerson.php | 61 +++--- .../personnameparser/ParsedPersonMatch.php | 23 ++- .../parser/personnameparser/ParserDispute.php | 16 +- .../PersonNameParserResult.php | 19 +- .../PersonNameParserService.php | 88 +++++---- .../client/services/riskdetector/DataItem.php | 16 +- .../services/riskdetector/DetectedRisk.php | 26 +-- .../riskdetector/DisguiseRiskType.php | 18 +- .../services/riskdetector/FakeRiskType.php | 18 +- .../riskdetector/RiskDetectorResult.php | 23 ++- .../RiskDetectorServiceFactory.php | 24 +-- .../client/services/riskdetector/RiskType.php | 5 +- .../person/PersonRiskDetectorService.php | 41 ++-- .../services/system/SystemServiceFactory.php | 20 +- .../services/system/ping/PingService.php | 17 +- .../ontology/input/context/Context.php | 59 ++++-- .../ontology/input/context/ContextBuilder.php | 28 +-- .../ontology/input/context/Priority.php | 37 ++-- .../ontology/input/context/TextCase.php | 44 +++-- .../entities/address/AddressRelation.php | 5 +- .../input/entities/address/AddressUsage.php | 18 +- .../input/entities/address/InputAddress.php | 5 +- .../input/entities/address/PlaceInfo.php | 5 +- .../input/entities/address/StreetInfo.php | 5 +- .../entities/address/StructuredAddress.php | 28 ++- .../address/StructuredAddressBuilder.php | 22 ++- .../entities/address/StructuredPlaceInfo.php | 35 ++-- .../address/StructuredPlaceInfoBuilder.php | 28 +-- .../entities/address/StructuredStreetInfo.php | 28 ++- .../address/StructuredStreetInfoBuilder.php | 31 +-- .../address/UseForAllAddressRelation.php | 10 +- .../input/entities/contact/EmailAddress.php | 8 +- .../entities/contact/EmailAddressFactory.php | 10 +- .../input/entities/contact/TelNumber.php | 8 +- .../entities/contact/TelNumberFactory.php | 10 +- .../input/entities/person/MaritalStatus.php | 18 +- .../entities/person/NaturalInputPerson.php | 57 ++---- .../person/NaturalInputPersonBuilder.php | 77 ++++---- .../input/entities/person/PersonRole.php | 15 +- .../input/entities/person/PersonType.php | 15 +- .../input/entities/person/age/AgeInfo.php | 5 +- .../entities/person/age/AgeInfoFactory.php | 21 +- .../input/entities/person/age/BirthDate.php | 45 ++++- .../input/entities/person/age/BirthYear.php | 10 +- .../entities/person/age/BirthYearRange.php | 10 +- .../input/entities/person/age/YearRange.php | 12 +- .../person/gender/ComputedPersonGender.php | 18 +- .../person/gender/StoragePersonGender.php | 18 +- .../entities/person/name/InputPersonName.php | 44 ++--- .../input/entities/person/name/NameField.php | 10 +- .../AmericanInputPersonNameBuilder.php | 26 ++- .../name/builder/InputPersonNameBuilder.php | 23 ++- .../builder/WesternInputPersonNameBuilder.php | 15 +- .../name/types/AmericanNameFieldType.php | 5 +- .../person/name/types/CommonNameFieldType.php | 5 +- ...posableEmailAddressDetectorServiceTest.php | 18 +- .../PersonNameParserServiceTest.php | 29 +-- .../PersonRiskDetectorServiceTest.php | 50 +++-- tests/functional/PingServiceTest.php | 18 +- .../fault/FaultInfoUnmarshallerTest.php | 19 +- .../input/context/ContextBuilderTest.php | 12 +- .../ontology/input/context/PriorityTest.php | 11 +- .../ontology/input/context/TextCaseTest.php | 11 +- .../person/age/AgeInfoFactoryTest.php | 15 +- 114 files changed, 1555 insertions(+), 1316 deletions(-) diff --git a/README.md b/README.md index 845e46e..659852a 100644 --- a/README.md +++ b/README.md @@ -5,38 +5,33 @@ PHP Client for the NameAPI Web Service at http://www.nameapi.org/ All you need to send requests is your own api key, get it from nameapi.org. - ## Library setup -The recommended way is to use Composer. The project at https://github.com/optimaize/nameapi-client-php-example-composer +The recommended way is to use Composer. The project at https://github.com/optimaize/nameapi-client-php-example-composer shows how that's done. -You can download the source code and make it available to your code. Or you can check it out directly -from this GitHub project. Currently there is no phar available. +You can download the source code and make it available to your code. Or you can check it out directly from this GitHub project. Currently there is no phar available. The only requirement is that the php_curl extension is enabled. - ## Functional tests -Functional tests that demonstrate how the services work, and that they work, are in -https://github.com/optimaize/nameapi-client-php-functionaltests you can look at the code, and you can -even run those tests using your api key and PHPUnit. - +Functional tests that demonstrate how the services work, and that they work, are in +https://github.com/optimaize/nameapi-client-php-functionaltests you can look at the code, and you can even run those tests using your api key and PHPUnit. ## Setup code At first you need one single include, the one to the nameapi service factory: ```php -require_once('your/path/to/org/nameapi/client/services/ServiceFactory.php'); +require_once('your/path/to/Org/NameApi/Client/Services/ServiceFactory.php'); ``` Then you need a Context that explains a bit your working environment, something like: ```php -use org\nameapi\ontology\input\context\Context; -use org\nameapi\ontology\input\context\Priority; +use Org\NameApi\Ontology\input\Context\Context; +use Org\NameApi\Ontology\input\Context\Priority; $context = Context::builder() ->place('US') ->priority(Priority::REALTIME) @@ -49,7 +44,6 @@ Then you can already create the service factory which gives you access to all na $serviceFactory = new ServiceFactory('your-api-key', $context); ``` - ## Send a ping This code sends a simple ping to nameapi to test the connection: @@ -61,31 +55,21 @@ $pong = $ping->ping(); If the response is 'pong' then all is fine and you can move on to the real goodies. - ## Input / Output -All input objects come with builders or nicely documented setters. -The result objects returned by the services all have fully documented getters. -Many input arguments are optional - that means you can start simple, and add more as you need. - -Behind the scenes this service api uses REST. But luckily you don't need to worry about any -of the interface detail, you can just use the provided classes. +All input objects come with builders or nicely documented setters. The result objects returned by the services all have fully documented getters. Many input arguments are optional - that means you can start simple, and add more as you need. +Behind the scenes this service api uses REST. But luckily you don't need to worry about any of the interface detail, you can just use the provided classes. #### Person input object -Most services accept a 'Person' as input. This person contains a name, and optionally -more data such as gender, birth date etc. -The name can be just a single "full name" string, or it can be composed of multiple -fields like given name, middle name, surname. -This standardized api makes it simple to use different services in a consistent way, -and is very convenient in accepting the data however you have it at hands. +Most services accept a 'Person' as input. This person contains a name, and optionally more data such as gender, birth date etc. The name can be just a single "full name" string, or it can be composed of multiple fields like given name, middle name, surname. This standardized api makes it simple to use different services in a consistent way, and is very convenient in accepting the data however you have it at hands. Creating a simple person looks something like this: ```php -use org\nameapi\ontology\input\entities\person\NaturalInputPerson; -use org\nameapi\ontology\input\entities\person\name\InputPersonName; +use Org\NameApi\Ontology\input\Entities\Person\NaturalInputPerson; +use Org\NameApi\Ontology\input\Entities\Person\Name\InputPersonName; $inputPerson = NaturalInputPerson::builder() ->name(InputPersonName::westernBuilder() ->fullname( "John F. Kennedy" ) @@ -93,7 +77,6 @@ $inputPerson = NaturalInputPerson::builder() ->build(); ``` - ## Name Parser Name parsing is the process of splitting a full name into its components. @@ -106,7 +89,6 @@ $parseResult = $personNameParser->parse($inputPerson); var_dump($parseResult); ``` - ## Name Genderizer Name genderizing is the process of identifying the gender based on a person's name. @@ -119,7 +101,6 @@ $personGenderResult = $personGenderizer->assess($inputPerson); echo $personGenderResult->getGender()->toString(); //will print 'MALE' ``` - ## Name Matcher The Name Matcher compares names and name pairs to discover whether the people could possibly be one and the same person. @@ -142,7 +123,6 @@ $personMatcherResult = $personMatcher->match($inputPerson1, $inputPerson2); echo $personMatcherResult->getPersonMatchType()->toString(); //will print 'MATCHING' ``` - ## Name Formatter The Name Formatter displays personal names in the desired form. This includes the order as well as upper and lower case writing. @@ -158,7 +138,6 @@ $formatterResult = $personNameFormatter->format($inputPerson, new FormatterPrope echo $formatterResult->getFormatted(); //will print 'John Kennedy' ``` - ## Email Name Parser The Email Name Parser extracts names out of email addresses. @@ -169,8 +148,6 @@ $result = $emailNameParser->parse("john.doe@example.com"); echo $result; ``` - - ## Disposable Email Address Detector The DEA-Detector checks email addresses against a list of known "trash domains" such as mailinator.com. @@ -181,11 +158,9 @@ $result = $deaDetector->isDisposable("abcdefgh@10minutemail.com"); echo $result->getDisposable()->toString()); //will print 'YES' ``` - ## Risk Detector -The Risk-Detector checks all data in the person input, including the name, address, birthdate, -email address and phone number for fake and suspicious data. +The Risk-Detector checks all data in the person input, including the name, address, birthdate, email address and phone number for fake and suspicious data. ```php $riskDetector = $serviceFactory->riskServices()->personRiskDetector(); diff --git a/composer.json b/composer.json index 183462e..3b2ca22 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,6 @@ { "name": "optimaize/nameapi-client-php", "description": "PHP Client for the NameAPI Web Service", - "version": "5.3.0-rc4", "homepage": "https://github.com/optimaize/nameapi-client-php", "license": "LGPL-3.0", "require": { @@ -11,8 +10,15 @@ }, "autoload": { "psr-4": { - "org\\": "src/org" + "Org\\": "src/Org" } }, - "minimum-stability": "dev" -} \ No newline at end of file + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "require-dev": { + "phpunit/phpunit": "^9" + } +} diff --git a/src/org/nameapi/client/fault/Blame.php b/src/org/nameapi/client/fault/Blame.php index 7480fe0..3acf86d 100644 --- a/src/org/nameapi/client/fault/Blame.php +++ b/src/org/nameapi/client/fault/Blame.php @@ -1,6 +1,6 @@ Possible values are: CLIENT, SERVER.

*/ -final class Blame { +final class Blame +{ /** * @var string $value */ private $value = null; - public function __construct($value) { - if ($value!='CLIENT' && $value!='SERVER') { - throw new \Exception('Invalid value for Blame: '.$value.'!'); + public function __construct($value) + { + if ($value != 'CLIENT' && $value != 'SERVER') { + throw new \Exception('Invalid value for Blame: ' . $value . '!'); } $this->value = $value; } - public function __toString() { + public function __toString() + { return $this->value; } - public function isClient() { + public function isClient() + { return $this->value === 'CLIENT'; } - public function isServer() { + + public function isServer() + { return $this->value === 'SERVER'; } diff --git a/src/org/nameapi/client/fault/FaultInfo.php b/src/org/nameapi/client/fault/FaultInfo.php index 256ec38..49669e3 100644 --- a/src/org/nameapi/client/fault/FaultInfo.php +++ b/src/org/nameapi/client/fault/FaultInfo.php @@ -1,13 +1,6 @@ faultCause = $faultCause; $this->blame = $blame; @@ -172,4 +165,4 @@ public function getRetryOtherLocations() return $this->retryOtherLocations; } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/fault/FaultInfoUnmarshaller.php b/src/org/nameapi/client/fault/FaultInfoUnmarshaller.php index a7331a8..6f6a377 100644 --- a/src/org/nameapi/client/fault/FaultInfoUnmarshaller.php +++ b/src/org/nameapi/client/fault/FaultInfoUnmarshaller.php @@ -1,12 +1,6 @@ retrySameLocation)) { + if (isset($data->retrySameLocation)) { $retrySame = FaultInfoUnmarshaller::unmarshallRetry($data->retrySameLocation); } $retryOther = null; - if (isSet($data->retryOtherLocations)) { + if (isset($data->retryOtherLocations)) { $retryOther = FaultInfoUnmarshaller::unmarshallRetry($data->retryOtherLocations); } @@ -51,8 +46,8 @@ public static function unmarshallJsonObject($data) { $data->faultCause, new Blame($data->blame), $data->message, - (isSet($data->applicationErrorCode)) ? $data->applicationErrorCode : null, //this is optional - (isSet($data->incidentId)) ? $data->incidentId : null, //this is optional + (isset($data->applicationErrorCode)) ? $data->applicationErrorCode : null, //this is optional + (isset($data->incidentId)) ? $data->incidentId : null, //this is optional $retrySame, $retryOther ); @@ -72,8 +67,8 @@ private static function unmarshallRetry($data) { return new Retry( new RetryType($data->retryType), - (isSet($data->retryInSeconds)) ? $data->retryInSeconds : null // this is optional + (isset($data->retryInSeconds)) ? $data->retryInSeconds : null // this is optional ); } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/fault/Retry.php b/src/org/nameapi/client/fault/Retry.php index d3ca1f2..e39ac8f 100644 --- a/src/org/nameapi/client/fault/Retry.php +++ b/src/org/nameapi/client/fault/Retry.php @@ -1,6 +1,6 @@ retryType = $retryType; $this->retryInSeconds = $retryInSeconds; } + public static function no() + { + return new Retry(new RetryType('NO'), null); + } + /** * @return RetryType not null */ @@ -53,4 +53,4 @@ public function getRetryInSeconds() } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/fault/RetryType.php b/src/org/nameapi/client/fault/RetryType.php index d149936..589fd3e 100644 --- a/src/org/nameapi/client/fault/RetryType.php +++ b/src/org/nameapi/client/fault/RetryType.php @@ -1,38 +1,46 @@ Possible values are: NO, LATER, NOW.

*/ -final class RetryType { +final class RetryType +{ /** * @var string $value */ private $value = null; - public function __construct($value) { - if ($value!='NO' && $value!='LATER' && $value!='NOW') { - throw new \Exception('Invalid value for RetryType: '.$value.'!'); + public function __construct($value) + { + if ($value != 'NO' && $value != 'LATER' && $value != 'NOW') { + throw new \Exception('Invalid value for RetryType: ' . $value . '!'); } $this->value = $value; } - public function __toString() { + public function __toString() + { return $this->value; } - public function isNo() { + public function isNo() + { return $this->value === 'NO'; } - public function isLater() { + + public function isLater() + { return $this->value === 'LATER'; } - public function isNow() { + + public function isNow() + { return $this->value === 'NOW'; } diff --git a/src/org/nameapi/client/fault/ServiceException.php b/src/org/nameapi/client/fault/ServiceException.php index f20d3ee..24b6a88 100644 --- a/src/org/nameapi/client/fault/ServiceException.php +++ b/src/org/nameapi/client/fault/ServiceException.php @@ -1,18 +1,14 @@ faultInfo = $faultInfo; $this->httpData = $httpData; } - /** * @return FaultInfo or null if not available, for example because un-serializing failed */ diff --git a/src/org/nameapi/client/http/HttpResponseData.php b/src/org/nameapi/client/http/HttpResponseData.php index 2c2cb5b..6d25385 100644 --- a/src/org/nameapi/client/http/HttpResponseData.php +++ b/src/org/nameapi/client/http/HttpResponseData.php @@ -1,6 +1,6 @@ responseHeaders; } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/http/RestHttpClient.php b/src/org/nameapi/client/http/RestHttpClient.php index 062deb9..534e3a7 100644 --- a/src/org/nameapi/client/http/RestHttpClient.php +++ b/src/org/nameapi/client/http/RestHttpClient.php @@ -1,16 +1,12 @@ callApi($resourcePath, 'GET', $queryParams, null, $headerParams); } - public function callApiPost($resourcePath, $queryParams, $headerParams, $postData) { - return $this->callApi($resourcePath, 'POST', $queryParams, $postData, $headerParams); - } /** * Make the HTTP call (Sync) * @param string $resourcePath path to method endpoint - * @param string $method method to call - * @param array $queryParams parameters to be place in query URL - * @param array $postData parameters to be placed in POST body - * @param array $headerParams parameters to be place in request header - * @throws ServiceException on a non 2xx response + * @param string $method method to call + * @param array $queryParams parameters to be place in query URL + * @param array $postData parameters to be placed in POST body + * @param array $headerParams parameters to be place in request header * @return mixed + * @throws ServiceException on a non 2xx response */ - public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams) { + public function callApi($resourcePath, $method, $queryParams, $postData, $headerParams) + { $headers = array(); $headers[] = "Accept: application/json"; $headers[] = "Content-Type: application/json"; @@ -145,7 +142,7 @@ public function callApi($resourcePath, $method, $queryParams, $postData, $header // debugging for curl if ($this->config->getDebug()) { - error_log("[DEBUG] HTTP Request body ~BEGIN~\n".print_r($postData, true)."\n~END~\n", 3, $this->config->getDebugFile()); + error_log("[DEBUG] HTTP Request body ~BEGIN~\n" . print_r($postData, true) . "\n~END~\n", 3, $this->config->getDebugFile()); curl_setopt($curl, CURLOPT_VERBOSE, 1); //this doesn't work, i get: @@ -168,19 +165,19 @@ public function callApi($resourcePath, $method, $queryParams, $postData, $header // debug HTTP response body if ($this->config->getDebug()) { - error_log("[DEBUG] HTTP Response body ~BEGIN~\n".print_r($http_body, true)."\n~END~\n", 3, $this->config->getDebugFile()); + error_log("[DEBUG] HTTP Response body ~BEGIN~\n" . print_r($http_body, true) . "\n~END~\n", 3, $this->config->getDebugFile()); } // Handle the response if ($response_info['http_code'] == 0) { $faultInfo = new FaultInfo( 'NetworkTimeout', new Blame('SERVER'), - "API call to $url timed out: ".serialize($response_info), + "API call to $url timed out: " . serialize($response_info), null, null, Retry::no(), Retry::no() ); throw new ServiceException($faultInfo->getMessage(), $faultInfo, $httpResponseData); - } else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299 ) { + } else if ($response_info['http_code'] >= 200 && $response_info['http_code'] <= 299) { $data = json_decode($http_body); if (json_last_error() > 0) { // if response is a string $data = $http_body; @@ -206,6 +203,10 @@ public function callApi($resourcePath, $method, $queryParams, $postData, $header return array($data, $httpResponseData); } + public function callApiPost($resourcePath, $queryParams, $headerParams, $postData) + { + return $this->callApi($resourcePath, 'POST', $queryParams, $postData, $headerParams); + } } diff --git a/src/org/nameapi/client/http/RestHttpClientConfig.php b/src/org/nameapi/client/http/RestHttpClientConfig.php index 32ea5cc..49f8e3f 100644 --- a/src/org/nameapi/client/http/RestHttpClientConfig.php +++ b/src/org/nameapi/client/http/RestHttpClientConfig.php @@ -1,19 +1,20 @@ tempFolderPath = sys_get_temp_dir(); } + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = "RestHttpClientConfig Debug Report:\n"; + $report .= " OS: " . php_uname() . "\n"; + $report .= " PHP Version: " . phpversion() . "\n"; + $report .= " Swagger Spec Version: v5.3\n"; + $report .= " SDK Package Version: 1.0.0\n"; + $report .= " Temp Folder Path: " . self::getDefaultConfiguration()->getTempFolderPath() . "\n"; + + return $report; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return RestHttpClientConfig + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the default configuration instance + * + * @return RestHttpClientConfig + */ + public static function getDefaultConfiguration() + { + if (self::$_defaultConfiguration == null) { + self::$_defaultConfiguration = new RestHttpClientConfig(); + } + + return self::$_defaultConfiguration; + } + + /** + * Sets the detault configuration instance + * + * @param RestHttpClientConfig $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(RestHttpClientConfig $config) + { + self::$_defaultConfiguration = $config; + } + /** * @return mixed */ @@ -109,23 +176,6 @@ public function setUserAgent($userAgent) $this->userAgent = $userAgent; } - /** - * Sets the HTTP timeout value - * - * @param integer $seconds Number of seconds before timing out [set to 0 for no timeout] - * - * @return RestHttpClient - */ - public function setCurlTimeout($seconds) - { - if (!is_numeric($seconds) || $seconds < 0) { - throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.'); - } - - $this->curlTimeout = $seconds; - return $this; - } - /** * Gets the HTTP timeout value * @@ -137,15 +187,19 @@ public function getCurlTimeout() } /** - * Sets debug flag + * Sets the HTTP timeout value * - * @param bool $debug Debug flag + * @param integer $seconds Number of seconds before timing out [set to 0 for no timeout] * * @return RestHttpClientConfig */ - public function setDebug($debug) + public function setCurlTimeout($seconds) { - $this->debug = $debug; + if (!is_numeric($seconds) || $seconds < 0) { + throw new \InvalidArgumentException('Timeout value must be numeric and a non-negative number.'); + } + + $this->curlTimeout = $seconds; return $this; } @@ -160,15 +214,15 @@ public function getDebug() } /** - * Sets the debug file + * Sets debug flag * - * @param string $debugFile Debug file + * @param bool $debug Debug flag * * @return RestHttpClientConfig */ - public function setDebugFile($debugFile) + public function setDebug($debug) { - $this->debugFile = $debugFile; + $this->debug = $debug; return $this; } @@ -183,26 +237,26 @@ public function getDebugFile() } /** - * Sets the temp folder path + * Sets the debug file * - * @param string $tempFolderPath Temp folder path + * @param string $debugFile Debug file * * @return RestHttpClientConfig */ - public function setTempFolderPath($tempFolderPath) + public function setDebugFile($debugFile) { - $this->tempFolderPath = $tempFolderPath; + $this->debugFile = $debugFile; return $this; } /** - * Gets the temp folder path + * Gets if SSL verification should be enabled or disabled * - * @return string Temp folder path + * @return boolean True if the certificate should be validated, false otherwise */ - public function getTempFolderPath() + public function getSSLVerification() { - return $this->tempFolderPath; + return $this->sslVerification; } /** @@ -218,57 +272,4 @@ public function setSSLVerification($sslVerification) return $this; } - /** - * Gets if SSL verification should be enabled or disabled - * - * @return boolean True if the certificate should be validated, false otherwise - */ - public function getSSLVerification() - { - return $this->sslVerification; - } - - /** - * Gets the default configuration instance - * - * @return RestHttpClientConfig - */ - public static function getDefaultConfiguration() - { - if (self::$_defaultConfiguration == null) { - self::$_defaultConfiguration = new RestHttpClientConfig(); - } - - return self::$_defaultConfiguration; - } - - /** - * Sets the detault configuration instance - * - * @param RestHttpClientConfig $config An instance of the Configuration Object - * - * @return void - */ - public static function setDefaultConfiguration(RestHttpClientConfig $config) - { - self::$_defaultConfiguration = $config; - } - - /** - * Gets the essential information for debugging - * - * @return string The report for debugging - */ - public static function toDebugReport() - { - $report = "RestHttpClientConfig Debug Report:\n"; - $report .= " OS: ".php_uname()."\n"; - $report .= " PHP Version: ".phpversion()."\n"; - $report .= " Swagger Spec Version: v5.3\n"; - $report .= " SDK Package Version: 1.0.0\n"; - $report .= " Temp Folder Path: ".self::getDefaultConfiguration()->getTempFolderPath()."\n"; - - return $report; - } - } diff --git a/src/org/nameapi/client/services/BaseService.php b/src/org/nameapi/client/services/BaseService.php index 1c872d6..16e0b76 100644 --- a/src/org/nameapi/client/services/BaseService.php +++ b/src/org/nameapi/client/services/BaseService.php @@ -1,16 +1,14 @@ context = $context; $configuration = new RestHttpClientConfig(); $configuration->setApiKey($apiKey); @@ -41,7 +40,6 @@ public function __construct($apiKey, Context $context, $baseUrl) { } - /** * @param $response * @param $httpResponseData @@ -58,4 +56,4 @@ protected function unmarshallingFailed($response, $httpResponseData) return new ServiceException($faultInfo->getMessage(), $faultInfo, $httpResponseData); } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/services/Host.php b/src/org/nameapi/client/services/Host.php index c036b7e..e5d81d6 100644 --- a/src/org/nameapi/client/services/Host.php +++ b/src/org/nameapi/client/services/Host.php @@ -1,12 +1,13 @@ protocol = $protocol; $this->hostName = $hostName; $this->portNumber = $portNumber; } + public static function standard() + { + return new Host('http', 'api.nameapi.org', 80); + } + + public static function http($hostName) + { + return new Host('http', $hostName, 80); + } + + public static function https($hostName) + { + return new Host('https', $hostName, 443); + } + /** * Returns something like 'http://api.nameapi.org' and omits the port if it's a default port (like 80 for http). */ - public function toString() { + public function toString() + { $str = $this->protocol . '://' . $this->hostName; - if ($this->protocol==='http' && $this->portNumber==80) { + if ($this->protocol === 'http' && $this->portNumber == 80) { //don't add port - } else if ($this->protocol==='https' && $this->portNumber==443) { + } else if ($this->protocol === 'https' && $this->portNumber == 443) { //don't add port } else { - $str .= ':'. $this->portNumber; + $str .= ':' . $this->portNumber; } return $str; } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/services/ServiceFactory.php b/src/org/nameapi/client/services/ServiceFactory.php index af18092..417ed20 100644 --- a/src/org/nameapi/client/services/ServiceFactory.php +++ b/src/org/nameapi/client/services/ServiceFactory.php @@ -1,35 +1,14 @@ apiKey = $apiKey; $this->context = $context; - if ($host==null) { + if ($host == null) { $this->host = Host::standard(); } else { $this->host = $host; } - if ($apiVersion==null) { + if ($apiVersion == null) { $this->apiVersion = '5.0'; } else { $this->apiVersion = $apiVersion; } - $this->baseUrl = $this->host->toString() . '/'.$this->technology.'/v'.$this->apiVersion.'/'; + $this->baseUrl = $this->host->toString() . '/' . $this->technology . '/v' . $this->apiVersion . '/'; } /** - * @return development\DevelopmentServiceFactory + * @return Development\DevelopmentServiceFactory */ - public function developmentServices() { - if ($this->developmentServiceFactory==null) { - $this->developmentServiceFactory = new development\DevelopmentServiceFactory($this->apiKey, $this->context, $this->baseUrl); + public function developmentServices() + { + if ($this->developmentServiceFactory == null) { + $this->developmentServiceFactory = new Development\DevelopmentServiceFactory($this->apiKey, $this->context, $this->baseUrl); } return $this->developmentServiceFactory; } /** - * @return system\SystemServiceFactory + * @return System\SystemServiceFactory */ - public function systemServices() { - if ($this->systemServiceFactory==null) { - $this->systemServiceFactory = new system\SystemServiceFactory($this->apiKey, $this->context, $this->baseUrl); + public function systemServices() + { + if ($this->systemServiceFactory == null) { + $this->systemServiceFactory = new System\SystemServiceFactory($this->apiKey, $this->context, $this->baseUrl); } return $this->systemServiceFactory; } /** - * @return parser\ParserServiceFactory + * @return Parser\ParserServiceFactory */ - public function parserServices() { - if ($this->parserServiceFactory==null) { - $this->parserServiceFactory = new parser\ParserServiceFactory($this->apiKey, $this->context, $this->baseUrl); + public function parserServices() + { + if ($this->parserServiceFactory == null) { + $this->parserServiceFactory = new Parser\ParserServiceFactory($this->apiKey, $this->context, $this->baseUrl); } return $this->parserServiceFactory; } /** - * @return genderizer\GenderizerServiceFactory + * @return Genderizer\GenderizerServiceFactory */ - public function genderizerServices() { - if ($this->genderizerServiceFactory==null) { - $this->genderizerServiceFactory = new genderizer\GenderizerServiceFactory($this->apiKey, $this->context, $this->baseUrl); + public function genderizerServices() + { + if ($this->genderizerServiceFactory == null) { + $this->genderizerServiceFactory = new Genderizer\GenderizerServiceFactory($this->apiKey, $this->context, $this->baseUrl); } return $this->genderizerServiceFactory; } /** - * @return matcher\MatcherServiceFactory + * @return Matcher\MatcherServiceFactory */ - public function matcherServices() { - if ($this->matcherServiceFactory==null) { - $this->matcherServiceFactory = new matcher\MatcherServiceFactory($this->apiKey, $this->context, $this->baseUrl); + public function matcherServices() + { + if ($this->matcherServiceFactory == null) { + $this->matcherServiceFactory = new Matcher\MatcherServiceFactory($this->apiKey, $this->context, $this->baseUrl); } return $this->matcherServiceFactory; } /** - * @return formatter\FormatterServiceFactory + * @return Formatter\FormatterServiceFactory */ - public function formatterServices() { - if ($this->formatterServiceFactory==null) { - $this->formatterServiceFactory = new formatter\FormatterServiceFactory($this->apiKey, $this->context, $this->baseUrl); + public function formatterServices() + { + if ($this->formatterServiceFactory == null) { + $this->formatterServiceFactory = new Formatter\FormatterServiceFactory($this->apiKey, $this->context, $this->baseUrl); } return $this->formatterServiceFactory; } /** - * @return email\EmailServiceFactory + * @return Email\EmailServiceFactory */ - public function emailServices() { - if ($this->emailServiceFactory==null) { - $this->emailServiceFactory = new email\EmailServiceFactory($this->apiKey, $this->context, $this->baseUrl); + public function emailServices() + { + if ($this->emailServiceFactory == null) { + $this->emailServiceFactory = new Email\EmailServiceFactory($this->apiKey, $this->context, $this->baseUrl); } return $this->emailServiceFactory; } /** - * @return riskdetector\RiskDetectorServiceFactory + * @return RiskDetector\RiskDetectorServiceFactory * @since v5.3 */ - public function riskServices() { - if ($this->riskServiceFactory==null) { - $this->riskServiceFactory = new riskdetector\RiskDetectorServiceFactory($this->apiKey, $this->context, $this->baseUrl); + public function riskServices() + { + if ($this->riskServiceFactory == null) { + $this->riskServiceFactory = new RiskDetector\RiskDetectorServiceFactory($this->apiKey, $this->context, $this->baseUrl); } return $this->riskServiceFactory; } diff --git a/src/org/nameapi/client/services/development/DevelopmentServiceFactory.php b/src/org/nameapi/client/services/development/DevelopmentServiceFactory.php index a046f66..0afe920 100644 --- a/src/org/nameapi/client/services/development/DevelopmentServiceFactory.php +++ b/src/org/nameapi/client/services/development/DevelopmentServiceFactory.php @@ -1,17 +1,15 @@ apiKey = $apiKey; $this->context = $context; $this->baseUrl = $baseUrl; @@ -30,8 +29,9 @@ public function __construct($apiKey, Context $context, $baseUrl) { * @return ExceptionThrowerService * @since v5.0 */ - public function exceptionThrower() { - if ($this->exceptionThrowerService==null) { + public function exceptionThrower() + { + if ($this->exceptionThrowerService == null) { $this->exceptionThrowerService = new ExceptionThrowerService($this->apiKey, $this->context, $this->baseUrl); } return $this->exceptionThrowerService; diff --git a/src/org/nameapi/client/services/development/exceptionthrower/ExceptionThrowerService.php b/src/org/nameapi/client/services/development/exceptionthrower/ExceptionThrowerService.php index 08c37ca..5b46f44 100644 --- a/src/org/nameapi/client/services/development/exceptionthrower/ExceptionThrowerService.php +++ b/src/org/nameapi/client/services/development/exceptionthrower/ExceptionThrowerService.php @@ -1,10 +1,10 @@ developmentServices()->exceptionThrowerService(); * $exceptionThrower = $ping->throwException(); */ -class ExceptionThrowerService extends BaseService { +class ExceptionThrowerService extends BaseService +{ private static $RESOURCE_PATH = "development/exceptionthrower"; - public function __construct($apiKey, Context $context, $baseUrl) { + public function __construct($apiKey, Context $context, $baseUrl) + { parent::__construct($apiKey, $context, $baseUrl); } /** - * @param string $exceptionType One of 'AccessDeniedNoSuchAccount', 'InvalidInput', 'InternalServerError' - * @param int $exceptionChance 0-100 where 100 means always + * @param string $exceptionType One of 'AccessDeniedNoSuchAccount', 'InvalidInput', 'InternalServerError' + * @param int $exceptionChance 0-100 where 100 means always * @return string 'OK' in case the remote service does not throw. * @throws ServiceException */ - public function throwException($exceptionType, $exceptionChance) { + public function throwException($exceptionType, $exceptionChance) + { $queryParams = array( - 'exceptionType' => $exceptionType, + 'exceptionType' => $exceptionType, 'exceptionChance' => $exceptionChance, ); $headerParams = array(); @@ -50,4 +53,4 @@ public function throwException($exceptionType, $exceptionChance) { return $response; } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/services/email/EmailServiceFactory.php b/src/org/nameapi/client/services/email/EmailServiceFactory.php index d92d5fc..cd16067 100644 --- a/src/org/nameapi/client/services/email/EmailServiceFactory.php +++ b/src/org/nameapi/client/services/email/EmailServiceFactory.php @@ -1,19 +1,16 @@ apiKey = $apiKey; $this->context = $context; $this->baseUrl = $baseUrl; @@ -34,8 +32,9 @@ public function __construct($apiKey, Context $context, $baseUrl) { * @return DisposableEmailAddressDetectorService * @since v4.0 */ - public function disposableEmailAddressDetector() { - if ($this->disposableEmailAddressDetector==null) { + public function disposableEmailAddressDetector() + { + if ($this->disposableEmailAddressDetector == null) { $this->disposableEmailAddressDetector = new DisposableEmailAddressDetectorService($this->apiKey, $this->context, $this->baseUrl); } return $this->disposableEmailAddressDetector; @@ -45,8 +44,9 @@ public function disposableEmailAddressDetector() { * @return EmailNameParserService * @since v4.0 */ - public function emailNameParser() { - if ($this->emailNameParser==null) { + public function emailNameParser() + { + if ($this->emailNameParser == null) { $this->emailNameParser = new EmailNameParserService($this->apiKey, $this->context, $this->baseUrl); } return $this->emailNameParser; diff --git a/src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorResult.php b/src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorResult.php index 54ebb0e..ed808a9 100644 --- a/src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorResult.php +++ b/src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorResult.php @@ -1,8 +1,9 @@ disposable = $disposable; } /** * @return Maybe */ - public function getDisposable() { + public function getDisposable() + { return $this->disposable; } diff --git a/src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorService.php b/src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorService.php index 07636ef..2495cb6 100644 --- a/src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorService.php +++ b/src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorService.php @@ -1,13 +1,10 @@ $emailAddress + 'emailAddress' => $emailAddress ); $headerParams = array(); @@ -51,4 +51,4 @@ public function isDisposable($emailAddress) { } } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/services/email/disposableemailaddressdetector/Maybe.php b/src/org/nameapi/client/services/email/disposableemailaddressdetector/Maybe.php index 6a8420a..7455ac3 100644 --- a/src/org/nameapi/client/services/email/disposableemailaddressdetector/Maybe.php +++ b/src/org/nameapi/client/services/email/disposableemailaddressdetector/Maybe.php @@ -1,6 +1,6 @@ >>'.$value.'<<>>' . $value . '<<value = $value; } @@ -27,11 +29,13 @@ public function __construct($value) { /** * @return bool */ - public function isDisposable() { + public function isDisposable() + { return $this->value === 'YES'; } - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/client/services/email/emailnameparser/EmailAddressNameType.php b/src/org/nameapi/client/services/email/emailnameparser/EmailAddressNameType.php index 4206489..7a4814f 100644 --- a/src/org/nameapi/client/services/email/emailnameparser/EmailAddressNameType.php +++ b/src/org/nameapi/client/services/email/emailnameparser/EmailAddressNameType.php @@ -1,6 +1,6 @@ */ -class EmailAddressNameType { +class EmailAddressNameType +{ /** * @var string $value */ private $value = null; - public function __construct($value) { - if ($value!=='NAME' - && $value!=='INITIAL' + public function __construct($value) + { + if ($value !== 'NAME' + && $value !== 'INITIAL' ) { - throw new \Exception('Invalid value for EmailAddressNameType: '.$value.'!'); + throw new \Exception('Invalid value for EmailAddressNameType: ' . $value . '!'); } $this->value = $value; } - public function __toString() { + public function __toString() + { return $this->value; } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/services/email/emailnameparser/EmailAddressParsingResultType.php b/src/org/nameapi/client/services/email/emailnameparser/EmailAddressParsingResultType.php index d28e1c2..5e808df 100644 --- a/src/org/nameapi/client/services/email/emailnameparser/EmailAddressParsingResultType.php +++ b/src/org/nameapi/client/services/email/emailnameparser/EmailAddressParsingResultType.php @@ -1,6 +1,6 @@ value = $value; } - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserMatch.php b/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserMatch.php index 6ad3dd7..cdb5a8d 100644 --- a/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserMatch.php +++ b/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserMatch.php @@ -1,13 +1,12 @@ givenNames = $givenNames; $this->surnames = $surnames; $this->confidence = $confidence; @@ -39,36 +39,40 @@ public function __construct($givenNames, $surnames, $confidence) { /** * @return NameFromEmailAddress[] */ - public function getGivenNames() { + public function getGivenNames() + { return $this->givenNames; } /** * @return NameFromEmailAddress[] */ - public function getSurnames() { + public function getSurnames() + { return $this->surnames; } /** * @return float 0-1 */ - public function getConfidence() { + public function getConfidence() + { return $this->confidence; } - public function __toString() { - $ret = ''; - if (count($this->givenNames) >0) { + public function __toString() + { + $ret = ''; + if (count($this->givenNames) > 0) { if (!empty($ret)) $ret .= ', '; - $ret .= 'givenNames='. implode(", ",$this->givenNames); + $ret .= 'givenNames=' . implode(", ", $this->givenNames); } - if (count($this->surnames) >0) { + if (count($this->surnames) > 0) { if (!empty($ret)) $ret .= ', '; - $ret .= 'surnames='. implode(", ",$this->surnames); + $ret .= 'surnames=' . implode(", ", $this->surnames); } if (!empty($ret)) $ret .= ', '; - $ret .= 'confidence='.$this->confidence; - return '{'.$ret.'}'; + $ret .= 'confidence=' . $this->confidence; + return '{' . $ret . '}'; } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserResult.php b/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserResult.php index 8e56e9a..fd348df 100644 --- a/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserResult.php +++ b/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserResult.php @@ -1,11 +1,9 @@ resultType = $resultType; $this->matches = $matches; } @@ -30,25 +29,28 @@ public function __construct(EmailAddressParsingResultType $resultType, $matches) /** * @return EmailAddressParsingResultType */ - public function getResultType() { + public function getResultType() + { return $this->resultType; } /** * @return EmailNameParserMatch[] */ - public function getMatches() { + public function getMatches() + { return $this->matches; } - public function __toString() { - $ret = 'Result{'; - $ret .= 'type='.$this->resultType; - if (count($this->matches) >0) { - $ret .= ', matches='. implode(", ",$this->matches); + public function __toString() + { + $ret = 'Result{'; + $ret .= 'type=' . $this->resultType; + if (count($this->matches) > 0) { + $ret .= ', matches=' . implode(", ", $this->matches); } - return $ret.'}'; + return $ret . '}'; } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserService.php b/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserService.php index 00de2fa..e8cc7b6 100644 --- a/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserService.php +++ b/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserService.php @@ -1,12 +1,10 @@ $emailAddress + 'emailAddress' => $emailAddress ); $headerParams = array(); @@ -44,16 +45,16 @@ public function parse($emailAddress) { ); try { $matches = array(); - if (isSet($response->nameMatches)) { + if (isset($response->nameMatches)) { foreach ($response->nameMatches as $match) { $givenNames = array(); - $surnames = array(); - if (isSet($match->givenNames)) { + $surnames = array(); + if (isset($match->givenNames)) { foreach ($match->givenNames as $name) { array_push($givenNames, new NameFromEmailAddress($name->name, new EmailAddressNameType($name->nameType))); } } - if (isSet($match->surnames)) { + if (isset($match->surnames)) { foreach ($match->surnames as $name) { array_push($surnames, new NameFromEmailAddress($name->name, new EmailAddressNameType($name->nameType))); } @@ -70,4 +71,4 @@ public function parse($emailAddress) { } } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/services/email/emailnameparser/NameFromEmailAddress.php b/src/org/nameapi/client/services/email/emailnameparser/NameFromEmailAddress.php index 37c8823..b93a4bf 100644 --- a/src/org/nameapi/client/services/email/emailnameparser/NameFromEmailAddress.php +++ b/src/org/nameapi/client/services/email/emailnameparser/NameFromEmailAddress.php @@ -1,10 +1,9 @@ name = $name; $this->nameType = $nameType; } @@ -29,23 +29,26 @@ public function __construct($name, EmailAddressNameType $nameType) { /** * @return string */ - public function getName() { + public function getName() + { return $this->name; } /** * @return EmailAddressNameType */ - public function getNameType() { + public function getNameType() + { return $this->nameType; } - public function __toString() { + public function __toString() + { $ret = $this->name; if ((string)$this->nameType != 'NAME') { - $ret .= ' (type=' . (string)$this->nameType .')'; + $ret .= ' (type=' . (string)$this->nameType . ')'; } return $ret; } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/services/formatter/FormatterProperties.php b/src/org/nameapi/client/services/formatter/FormatterProperties.php index 49df130..42ebbfc 100644 --- a/src/org/nameapi/client/services/formatter/FormatterProperties.php +++ b/src/org/nameapi/client/services/formatter/FormatterProperties.php @@ -1,8 +1,9 @@ formatUnknownInput = $bool; return $this; } diff --git a/src/org/nameapi/client/services/formatter/FormatterResult.php b/src/org/nameapi/client/services/formatter/FormatterResult.php index afa8420..2747da4 100644 --- a/src/org/nameapi/client/services/formatter/FormatterResult.php +++ b/src/org/nameapi/client/services/formatter/FormatterResult.php @@ -1,11 +1,12 @@ formatted = $formatted; $this->unknown = $unknown; } @@ -25,7 +27,8 @@ public function __construct($formatted, $unknown) { /** * @return string The formatted string, which may be the same as the input name/string if that was in the desired form already. */ - public function getFormatted() { + public function getFormatted() + { return $this->formatted; } @@ -34,7 +37,8 @@ public function getFormatted() { * @return boolean true if the server was unable to understand the input, and thus the formatted output is a guess. * The default behavior (see input settings) is for the server to throw on unknown input. */ - public function getUnknown() { + public function getUnknown() + { return $this->unknown; } diff --git a/src/org/nameapi/client/services/formatter/FormatterServiceFactory.php b/src/org/nameapi/client/services/formatter/FormatterServiceFactory.php index 56b45c8..6e8ed5f 100644 --- a/src/org/nameapi/client/services/formatter/FormatterServiceFactory.php +++ b/src/org/nameapi/client/services/formatter/FormatterServiceFactory.php @@ -1,19 +1,16 @@ apiKey = $apiKey; $this->context = $context; $this->baseUrl = $baseUrl; @@ -33,8 +31,9 @@ public function __construct($apiKey, Context $context, $baseUrl) { * @return PersonNameFormatterService * @since v4.0 */ - public function personNameFormatter() { - if ($this->personNameFormatterService==null) { + public function personNameFormatter() + { + if ($this->personNameFormatterService == null) { $this->personNameFormatterService = new PersonNameFormatterService($this->apiKey, $this->context, $this->baseUrl); } return $this->personNameFormatterService; @@ -43,8 +42,9 @@ public function personNameFormatter() { /** * @return NameFieldFormatterService */ - public function nameFieldFormatter() { - if ($this->nameFieldFormatterService==null) { + public function nameFieldFormatter() + { + if ($this->nameFieldFormatterService == null) { $this->nameFieldFormatterService = new NameFieldFormatterService($this->apiKey, $this->context, $this->baseUrl); } return $this->nameFieldFormatterService; diff --git a/src/org/nameapi/client/services/formatter/namefieldformatter/NameFieldFormatterService.php b/src/org/nameapi/client/services/formatter/namefieldformatter/NameFieldFormatterService.php index 36abab7..b989e61 100644 --- a/src/org/nameapi/client/services/formatter/namefieldformatter/NameFieldFormatterService.php +++ b/src/org/nameapi/client/services/formatter/namefieldformatter/NameFieldFormatterService.php @@ -1,22 +1,24 @@ restHttpClient->callApiPost( PersonNameFormatterService::$RESOURCE_PATH, $queryParams, $headerParams, - array('inputPerson'=>$person, 'properties'=>$properties, 'context'=>$this->context) + array('inputPerson' => $person, 'properties' => $properties, 'context' => $this->context) ); try { return new FormatterResult($response->formatted, $response->unknown); @@ -55,4 +53,4 @@ public function format(NaturalInputPerson $person, FormatterProperties $properti } } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/services/genderizer/GenderizerServiceFactory.php b/src/org/nameapi/client/services/genderizer/GenderizerServiceFactory.php index fe10cf7..806d52a 100644 --- a/src/org/nameapi/client/services/genderizer/GenderizerServiceFactory.php +++ b/src/org/nameapi/client/services/genderizer/GenderizerServiceFactory.php @@ -1,16 +1,14 @@ apiKey = $apiKey; $this->context = $context; $this->baseUrl = $baseUrl; } /** - * @return persongenderizer\PersonGenderizerService + * @return PersonGenderizer\PersonGenderizerService * @since v4.0 */ - public function personGenderizer() { - if ($this->personGenderizerService==null) { - $this->personGenderizerService = new persongenderizer\PersonGenderizerService($this->apiKey, $this->context, $this->baseUrl); + public function personGenderizer() + { + if ($this->personGenderizerService == null) { + $this->personGenderizerService = new PersonGenderizer\PersonGenderizerService($this->apiKey, $this->context, $this->baseUrl); } return $this->personGenderizerService; } diff --git a/src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderResult.php b/src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderResult.php index f262962..107117c 100644 --- a/src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderResult.php +++ b/src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderResult.php @@ -1,10 +1,11 @@ gender = $gender; $this->maleProportion = $maleProportion; $this->confidence = $confidence; @@ -35,7 +37,8 @@ public function __construct(ComputedPersonGender $gender, $maleProportion, $conf /** * @return ComputedPersonGender */ - public function getGender() { + public function getGender() + { return $this->gender; } @@ -44,14 +47,16 @@ public function getGender() { * @return float null if inapplicable or unknown. * Range 0-1, 0.5 is neutral, high above is more male and closer to 0 is more female). */ - public function getMalePercent() { + public function getMalePercent() + { return $this->maleProportion; } /** * @return float 0-1, the higher the better. */ - public function getConfidence() { + public function getConfidence() + { return $this->confidence; } diff --git a/src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderizerService.php b/src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderizerService.php index 96a5a40..1e1fcff 100644 --- a/src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderizerService.php +++ b/src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderizerService.php @@ -1,15 +1,12 @@ restHttpClient->callApiPost( PersonGenderizerService::$RESOURCE_PATH, $queryParams, $headerParams, - array('inputPerson'=>$person, 'context'=>$this->context) + array('inputPerson' => $person, 'context' => $this->context) ); try { return new PersonGenderResult(new ComputedPersonGender( diff --git a/src/org/nameapi/client/services/matcher/AgeMatchType.php b/src/org/nameapi/client/services/matcher/AgeMatchType.php index b1533b9..33873fd 100644 --- a/src/org/nameapi/client/services/matcher/AgeMatchType.php +++ b/src/org/nameapi/client/services/matcher/AgeMatchType.php @@ -1,6 +1,6 @@ value = $value; } - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/client/services/matcher/AgeMatcherResult.php b/src/org/nameapi/client/services/matcher/AgeMatcherResult.php index 3be769f..bd6cc55 100644 --- a/src/org/nameapi/client/services/matcher/AgeMatcherResult.php +++ b/src/org/nameapi/client/services/matcher/AgeMatcherResult.php @@ -1,25 +1,26 @@ matchType = $matchType; } /** * @return AgeMatchType */ - public function getMatchType() { + public function getMatchType() + { return $this->matchType; } -} \ No newline at end of file +} diff --git a/src/org/nameapi/client/services/matcher/GenderMatchType.php b/src/org/nameapi/client/services/matcher/GenderMatchType.php index a9b5025..d2032a6 100644 --- a/src/org/nameapi/client/services/matcher/GenderMatchType.php +++ b/src/org/nameapi/client/services/matcher/GenderMatchType.php @@ -1,6 +1,6 @@ value = $value; } - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/client/services/matcher/GenderMatcherResult.php b/src/org/nameapi/client/services/matcher/GenderMatcherResult.php index b72df3d..3fc131a 100644 --- a/src/org/nameapi/client/services/matcher/GenderMatcherResult.php +++ b/src/org/nameapi/client/services/matcher/GenderMatcherResult.php @@ -1,11 +1,9 @@ matchType = $type; $this->confidence = $confidence; } @@ -35,21 +34,24 @@ public function __construct(GenderMatchType $type, $confidence, $warnings) { /** * @return GenderMatchType */ - public function getMatchType() { + public function getMatchType() + { return $this->matchType; } /** * @return float */ - public function getConfidence() { + public function getConfidence() + { return $this->confidence; } /** * @return string[] */ - public function getWarnings() { + public function getWarnings() + { return $this->warnings; } diff --git a/src/org/nameapi/client/services/matcher/MatcherServiceFactory.php b/src/org/nameapi/client/services/matcher/MatcherServiceFactory.php index a938c1e..c53ac44 100644 --- a/src/org/nameapi/client/services/matcher/MatcherServiceFactory.php +++ b/src/org/nameapi/client/services/matcher/MatcherServiceFactory.php @@ -1,15 +1,14 @@ apiKey = $apiKey; $this->context = $context; $this->baseUrl = $baseUrl; } /** - * @return personmatcher\PersonMatcherService + * @return PersonMatcher\PersonMatcherService * @since v4.0 */ - public function personMatcher() { - if ($this->personMatcher==null) { - $this->personMatcher = new personmatcher\PersonMatcherService($this->apiKey, $this->context, $this->baseUrl); + public function personMatcher() + { + if ($this->personMatcher == null) { + $this->personMatcher = new PersonMatcher\PersonMatcherService($this->apiKey, $this->context, $this->baseUrl); } return $this->personMatcher; } diff --git a/src/org/nameapi/client/services/matcher/PersonNameMatchType.php b/src/org/nameapi/client/services/matcher/PersonNameMatchType.php index f8648c8..1b786f0 100644 --- a/src/org/nameapi/client/services/matcher/PersonNameMatchType.php +++ b/src/org/nameapi/client/services/matcher/PersonNameMatchType.php @@ -1,6 +1,6 @@ */ -final class PersonNameMatchType { +final class PersonNameMatchType +{ /** * @var string $value */ private $value = null; - public function __construct($value) { - if ($value!=='EQUAL' && $value!=='MATCHING' && $value!=='SIMILAR' && $value!=='NO_SIMILARITY_FOUND' && $value!=='DIFFERENT') { - throw new \Exception('Invalid value for PersonNameMatchType: '.$value.'!'); + public function __construct($value) + { + if ($value !== 'EQUAL' && $value !== 'MATCHING' && $value !== 'SIMILAR' && $value !== 'NO_SIMILARITY_FOUND' && $value !== 'DIFFERENT') { + throw new \Exception('Invalid value for PersonNameMatchType: ' . $value . '!'); } $this->value = $value; } - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/client/services/matcher/PersonNameMatcherResult.php b/src/org/nameapi/client/services/matcher/PersonNameMatcherResult.php index be38c46..08fddea 100644 --- a/src/org/nameapi/client/services/matcher/PersonNameMatcherResult.php +++ b/src/org/nameapi/client/services/matcher/PersonNameMatcherResult.php @@ -1,10 +1,9 @@ matchType = $type; } @@ -22,7 +22,8 @@ public function __construct(PersonNameMatchType $type) { * * @return PersonNameMatchType */ - public function getMatchType() { + public function getMatchType() + { return $this->matchType; } diff --git a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatchComposition.php b/src/org/nameapi/client/services/matcher/personmatcher/PersonMatchComposition.php index 218089f..1d26838 100644 --- a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatchComposition.php +++ b/src/org/nameapi/client/services/matcher/personmatcher/PersonMatchComposition.php @@ -1,6 +1,6 @@ value = $value; } - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatchType.php b/src/org/nameapi/client/services/matcher/personmatcher/PersonMatchType.php index e83d563..bf5000a 100644 --- a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatchType.php +++ b/src/org/nameapi/client/services/matcher/personmatcher/PersonMatchType.php @@ -1,6 +1,6 @@ value = $value; } - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherResult.php b/src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherResult.php index c4e0671..ed3767c 100644 --- a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherResult.php +++ b/src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherResult.php @@ -1,19 +1,13 @@ matchType = $personMatchType; $this->matchComposition = $personMatchComposition; $this->points = $points; @@ -74,14 +69,16 @@ public function __construct($personMatchType, $personMatchComposition, $points, /** * @return PersonMatchType */ - public function getMatchType() { + public function getMatchType() + { return $this->matchType; } /** * @return PersonMatchComposition */ - public function getMatchComposition() { + public function getMatchComposition() + { return $this->matchComposition; } @@ -89,7 +86,8 @@ public function getMatchComposition() { * * @return float */ - public function getPoints() { + public function getPoints() + { return $this->points; } @@ -97,7 +95,8 @@ public function getPoints() { * * @return float */ - public function getConfidence() { + public function getConfidence() + { return $this->confidence; } @@ -105,7 +104,8 @@ public function getConfidence() { * * @return PersonNameMatcherResult */ - public function getPersonNameMatcherResult() { + public function getPersonNameMatcherResult() + { return $this->personNameMatcherResult; } @@ -113,14 +113,16 @@ public function getPersonNameMatcherResult() { * * @return GenderMatcherResult */ - public function getGenderMatcherResult() { + public function getGenderMatcherResult() + { return $this->genderMatcherResult; } /** * @return AgeMatcherResult */ - public function getAgeMatcherResult() { + public function getAgeMatcherResult() + { return $this->ageMatcherResult; } diff --git a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherService.php b/src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherService.php index 0f4ec8d..46ca151 100644 --- a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherService.php +++ b/src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherService.php @@ -1,20 +1,17 @@ restHttpClient->callApiPost( PersonMatcherService::$RESOURCE_PATH, $queryParams, $headerParams, - array('inputPerson1'=>$person1, 'inputPerson2'=>$person2, 'context'=>$this->context) + array('inputPerson1' => $person1, 'inputPerson2' => $person2, 'context' => $this->context) ); try { @@ -59,8 +59,8 @@ public function match(NaturalInputPerson $person1, NaturalInputPerson $person2) new PersonNameMatcherResult(new PersonNameMatchType($response->personNameMatcherResult->matchType)), new GenderMatcherResult( new GenderMatchType($response->genderMatcherResult->matchType), - isSet($response->genderMatcherResult->confidence) ? $response->genderMatcherResult->confidence : null, - isSet($response->genderMatcherResult->warnings) ? $response->genderMatcherResult->warnings : null + isset($response->genderMatcherResult->confidence) ? $response->genderMatcherResult->confidence : null, + isset($response->genderMatcherResult->warnings) ? $response->genderMatcherResult->warnings : null ), new AgeMatcherResult(new AgeMatchType($response->ageMatcherResult->matchType)) ); diff --git a/src/org/nameapi/client/services/parser/OutputPersonName.php b/src/org/nameapi/client/services/parser/OutputPersonName.php index 4beed5b..6c10cee 100644 --- a/src/org/nameapi/client/services/parser/OutputPersonName.php +++ b/src/org/nameapi/client/services/parser/OutputPersonName.php @@ -1,10 +1,9 @@ terms = $terms; } /** * @return Term[] */ - public function getTerms() { + public function getTerms() + { return $this->terms; } @@ -32,7 +33,8 @@ public function getTerms() { * @param string $termType * @return Term[] */ - public function getAll($termType) { + public function getAll($termType) + { $arr = array(); foreach ($this->terms as $term) { if ((string)$term->getTermType() === $termType) { @@ -47,7 +49,8 @@ public function getAll($termType) { * @param string $termType * @return Term */ - public function getFirst($termType) { + public function getFirst($termType) + { foreach ($this->terms as $term) { if ((string)$term->getTermType() === $termType) { return $term; @@ -57,17 +60,19 @@ public function getFirst($termType) { } - public function __toString() { + public function __toString() + { $nameStr = ''; foreach ($this->terms as $term) { if ($nameStr != '') $nameStr .= ','; $nameStr .= $term; } - $str = 'OutputPersonName{terms='.$nameStr.'}'; + $str = 'OutputPersonName{terms=' . $nameStr . '}'; return $str; } - public function toShortString() { + public function toShortString() + { $nameStr = ''; foreach ($this->terms as $term) { if ($nameStr != '') $nameStr .= ', '; diff --git a/src/org/nameapi/client/services/parser/OutputTermType.php b/src/org/nameapi/client/services/parser/OutputTermType.php index e8fa737..da3c0a6 100644 --- a/src/org/nameapi/client/services/parser/OutputTermType.php +++ b/src/org/nameapi/client/services/parser/OutputTermType.php @@ -1,6 +1,6 @@ value; } diff --git a/src/org/nameapi/client/services/parser/ParserServiceFactory.php b/src/org/nameapi/client/services/parser/ParserServiceFactory.php index facb5cf..7cf4e94 100644 --- a/src/org/nameapi/client/services/parser/ParserServiceFactory.php +++ b/src/org/nameapi/client/services/parser/ParserServiceFactory.php @@ -1,15 +1,14 @@ apiKey = $apiKey; $this->context = $context; $this->baseUrl = $baseUrl; } /** - * @return personnameparser\PersonNameParserService + * @return PersonNameParser\PersonNameParserService * @since v4.0 */ - public function personNameParser() { - if ($this->personNameParser==null) { - $this->personNameParser = new personnameparser\PersonNameParserService($this->apiKey, $this->context, $this->baseUrl); + public function personNameParser() + { + if ($this->personNameParser == null) { + $this->personNameParser = new PersonNameParser\PersonNameParserService($this->apiKey, $this->context, $this->baseUrl); } return $this->personNameParser; } diff --git a/src/org/nameapi/client/services/parser/Term.php b/src/org/nameapi/client/services/parser/Term.php index 424771d..42dd56e 100644 --- a/src/org/nameapi/client/services/parser/Term.php +++ b/src/org/nameapi/client/services/parser/Term.php @@ -1,10 +1,9 @@ string = $string; $this->termType = $termType; } @@ -24,23 +24,27 @@ public function __construct($string, OutputTermType $termType) { /** * @return string */ - public function getString() { + public function getString() + { return $this->string; } /** * @return OutputTermType */ - public function getTermType() { + public function getTermType() + { return $this->termType; } - public function __toString() { - return 'Term{string='.$this->string.', termType='.$this->termType.'}'; + public function __toString() + { + return 'Term{string=' . $this->string . ', termType=' . $this->termType . '}'; } - public function toShortString() { - return $this->termType . ':'.$this->string; + public function toShortString() + { + return $this->termType . ':' . $this->string; } } diff --git a/src/org/nameapi/client/services/parser/personnameparser/DisputeType.php b/src/org/nameapi/client/services/parser/personnameparser/DisputeType.php index b7a1d50..d4eaeb8 100644 --- a/src/org/nameapi/client/services/parser/personnameparser/DisputeType.php +++ b/src/org/nameapi/client/services/parser/personnameparser/DisputeType.php @@ -1,6 +1,6 @@ value = $value; } - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/client/services/parser/personnameparser/ParsedPerson.php b/src/org/nameapi/client/services/parser/personnameparser/ParsedPerson.php index 075ab74..b5fcef1 100644 --- a/src/org/nameapi/client/services/parser/personnameparser/ParsedPerson.php +++ b/src/org/nameapi/client/services/parser/personnameparser/ParsedPerson.php @@ -1,19 +1,15 @@ personType = $personType; - $this->personRole = $personRole; - $this->gender = $gender; - $this->addressingGivenName = $addressingGivenName; - $this->addressingSurname = $addressingSurname; - $this->outputPersonName = $outputPersonName; - $this->people = $people; + $this->personType = $personType; + $this->personRole = $personRole; + $this->gender = $gender; + $this->addressingGivenName = $addressingGivenName; + $this->addressingSurname = $addressingSurname; + $this->outputPersonName = $outputPersonName; + $this->people = $people; } /** * @return PersonType */ - public function getPersonType() { + public function getPersonType() + { return $this->personType; } /** * @return PersonRole */ - public function getPersonRole() { + public function getPersonRole() + { return $this->personRole; } /** * @return PersonGenderResult or null */ - public function getGender() { + public function getGender() + { return $this->gender; } /** * @return null */ - public function getAddressingGivenName() { + public function getAddressingGivenName() + { return $this->addressingGivenName; } /** * @return null */ - public function getAddressingSurname() { + public function getAddressingSurname() + { return $this->addressingSurname; } /** * @return OutputPersonName */ - public function getOutputPersonName() { + public function getOutputPersonName() + { return $this->outputPersonName; } @@ -108,13 +111,15 @@ public function getOutputPersonName() { * * @return ParsedPerson[] the array may be empty */ - public function getPeople() { + public function getPeople() + { return $this->people; } - public function __toString() { - $str = 'ParsedPerson{personType='.$this->personType.'}'; + public function __toString() + { + $str = 'ParsedPerson{personType=' . $this->personType . '}'; return $str; } } diff --git a/src/org/nameapi/client/services/parser/personnameparser/ParsedPersonMatch.php b/src/org/nameapi/client/services/parser/personnameparser/ParsedPersonMatch.php index d32957e..47f0c56 100644 --- a/src/org/nameapi/client/services/parser/personnameparser/ParsedPersonMatch.php +++ b/src/org/nameapi/client/services/parser/personnameparser/ParsedPersonMatch.php @@ -1,11 +1,9 @@ parsedPerson = $parsedPerson; $this->likeliness = $likeliness; $this->confidence = $confidence; @@ -44,21 +43,24 @@ public function __construct(ParsedPerson $parsedPerson, $likeliness, $confidence /** * @return ParsedPerson */ - public function getParsedPerson() { + public function getParsedPerson() + { return $this->parsedPerson; } /** * @return float 0-1 */ - public function getLikeliness() { + public function getLikeliness() + { return $this->likeliness; } /** * @return float 0-1 */ - public function getConfidence() { + public function getConfidence() + { return $this->confidence; } @@ -66,7 +68,8 @@ public function getConfidence() { * Usually empty, that's good. * @return ParserDispute[] */ - public function getParserDisputes() { + public function getParserDisputes() + { return $this->parserDisputes; } diff --git a/src/org/nameapi/client/services/parser/personnameparser/ParserDispute.php b/src/org/nameapi/client/services/parser/personnameparser/ParserDispute.php index 6d07c53..a9a7120 100644 --- a/src/org/nameapi/client/services/parser/personnameparser/ParserDispute.php +++ b/src/org/nameapi/client/services/parser/personnameparser/ParserDispute.php @@ -1,10 +1,9 @@ disputeType = $disputeType; $this->message = $message; } @@ -29,14 +29,16 @@ public function __construct(DisputeType $disputeType, $message) { /** * @return DisputeType */ - public function getDisputeType() { + public function getDisputeType() + { return $this->disputeType; } /** * @return string */ - public function getMessage() { + public function getMessage() + { return $this->message; } diff --git a/src/org/nameapi/client/services/parser/personnameparser/PersonNameParserResult.php b/src/org/nameapi/client/services/parser/personnameparser/PersonNameParserResult.php index 617b031..5559f62 100644 --- a/src/org/nameapi/client/services/parser/personnameparser/PersonNameParserResult.php +++ b/src/org/nameapi/client/services/parser/personnameparser/PersonNameParserResult.php @@ -1,19 +1,18 @@ matches = $matches; } @@ -21,7 +20,8 @@ public function __construct($matches) { * Returns a non-empty array if getParsingStatus() is SUCCESS, and null otherwise. * @return ParsedPersonMatch[] */ - public function getMatches() { + public function getMatches() + { return $this->matches; } @@ -29,7 +29,8 @@ public function getMatches() { * Returns the best match. * @return ParsedPersonMatch */ - public function getBestMatch() { + public function getBestMatch() + { return $this->matches[0]; } diff --git a/src/org/nameapi/client/services/parser/personnameparser/PersonNameParserService.php b/src/org/nameapi/client/services/parser/personnameparser/PersonNameParserService.php index e3cc1dd..80f905b 100644 --- a/src/org/nameapi/client/services/parser/personnameparser/PersonNameParserService.php +++ b/src/org/nameapi/client/services/parser/personnameparser/PersonNameParserService.php @@ -1,21 +1,18 @@ restHttpClient->callApiPost( PersonNameParserService::$RESOURCE_PATH, $queryParams, $headerParams, - array('inputPerson'=>$person, 'context'=>$this->context) + array('inputPerson' => $person, 'context' => $this->context) ); try { @@ -61,7 +61,7 @@ public function parse(NaturalInputPerson $person) { $parsedPerson = $this->extractPerson($pp); $parserDisputes = array(); - if (isSet($match->parserDisputes)) { + if (isset($match->parserDisputes)) { foreach ($match->parserDisputes as $dispute) { array_push($parserDisputes, new ParserDispute(new DisputeType($dispute->disputeType), $dispute->message)); } @@ -81,20 +81,38 @@ public function parse(NaturalInputPerson $person) { } } - private function extractGender($parsedPerson) { - if (!isSet($parsedPerson->gender)) { + private function extractPerson($pp) + { + $gender = $this->extractGender($pp); + $outputPersonName = $this->extractTerms($pp); + $people = $this->extractPeople($pp); + return new ParsedPerson( + new PersonType($pp->personType), + new PersonRole($pp->personRole), + $gender, + (isset($pp->addressingGivenName)) ? $pp->addressingGivenName : null, + (isset($pp->addressingSurname)) ? $pp->addressingSurname : null, + $outputPersonName, + $people + ); + } + + private function extractGender($parsedPerson) + { + if (!isset($parsedPerson->gender)) { return null; } return new PersonGenderResult( new ComputedPersonGender($parsedPerson->gender->gender), - (isset( $parsedPerson->gender->maleProportion) ? $parsedPerson->gender->maleProportion : null), + (isset($parsedPerson->gender->maleProportion) ? $parsedPerson->gender->maleProportion : null), $parsedPerson->gender->confidence ); } - private function extractTerms($parsedPerson) { + private function extractTerms($parsedPerson) + { $terms = array(); - if (isSet($parsedPerson->outputPersonName) && isSet($parsedPerson->outputPersonName->terms)) { + if (isset($parsedPerson->outputPersonName) && isset($parsedPerson->outputPersonName->terms)) { foreach ($parsedPerson->outputPersonName->terms as $term) { array_push($terms, new Term($term->string, new OutputTermType($term->termType))); } @@ -102,9 +120,10 @@ private function extractTerms($parsedPerson) { return new OutputPersonName($terms); } - private function extractPeople($parsedPerson) { + private function extractPeople($parsedPerson) + { $people = array(); - if (isSet($parsedPerson->people)) { + if (isset($parsedPerson->people)) { foreach ($parsedPerson->people as $onePerson) { $extractedPerson = $this->extractPerson($onePerson); array_push($people, $extractedPerson); @@ -113,19 +132,4 @@ private function extractPeople($parsedPerson) { return $people; } - private function extractPerson($pp) { - $gender = $this->extractGender($pp); - $outputPersonName = $this->extractTerms($pp); - $people = $this->extractPeople($pp); - return new ParsedPerson( - new PersonType($pp->personType), - new PersonRole($pp->personRole), - $gender, - (isSet($pp->addressingGivenName)) ? $pp->addressingGivenName : null, - (isSet($pp->addressingSurname)) ? $pp->addressingSurname : null, - $outputPersonName, - $people - ); - } - } diff --git a/src/org/nameapi/client/services/riskdetector/DataItem.php b/src/org/nameapi/client/services/riskdetector/DataItem.php index 5173a19..a004cd9 100644 --- a/src/org/nameapi/client/services/riskdetector/DataItem.php +++ b/src/org/nameapi/client/services/riskdetector/DataItem.php @@ -1,6 +1,6 @@ value = $value; } - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/client/services/riskdetector/DetectedRisk.php b/src/org/nameapi/client/services/riskdetector/DetectedRisk.php index 9036e6a..ebae5fa 100644 --- a/src/org/nameapi/client/services/riskdetector/DetectedRisk.php +++ b/src/org/nameapi/client/services/riskdetector/DetectedRisk.php @@ -1,10 +1,6 @@ 1) throw new \Exception("Risk score is out of range (0,1]: ".$riskScore."!"); + public function __construct($dataItem, $riskType, $riskScore, $reason) + { + if ($riskScore <= 0 || $riskScore > 1) throw new \Exception("Risk score is out of range (0,1]: " . $riskScore . "!"); $this->dataItem = $dataItem; $this->riskType = $riskType; $this->riskScore = $riskScore; @@ -49,28 +47,32 @@ public function __construct($dataItem, $riskType, $riskScore, $reason) { /** * @return DataItem */ - public function getDataItem() { + public function getDataItem() + { return $this->dataItem; } /** * @return RiskType */ - public function getRiskType() { + public function getRiskType() + { return $this->riskType; } /** * @return float range (0,1] the higher the worse. */ - public function getRiskScore() { + public function getRiskScore() + { return $this->riskScore; } /** * A one sentence text reason intended for the human that explains the risk. */ - public function getReason() { + public function getReason() + { return $this->reason; } diff --git a/src/org/nameapi/client/services/riskdetector/DisguiseRiskType.php b/src/org/nameapi/client/services/riskdetector/DisguiseRiskType.php index 42d06d0..8fb72e1 100644 --- a/src/org/nameapi/client/services/riskdetector/DisguiseRiskType.php +++ b/src/org/nameapi/client/services/riskdetector/DisguiseRiskType.php @@ -1,8 +1,6 @@ value = $value; } - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/client/services/riskdetector/FakeRiskType.php b/src/org/nameapi/client/services/riskdetector/FakeRiskType.php index 8934e86..fc40428 100644 --- a/src/org/nameapi/client/services/riskdetector/FakeRiskType.php +++ b/src/org/nameapi/client/services/riskdetector/FakeRiskType.php @@ -1,8 +1,6 @@ value = $value; } - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/client/services/riskdetector/RiskDetectorResult.php b/src/org/nameapi/client/services/riskdetector/RiskDetectorResult.php index 8f6231d..198db38 100644 --- a/src/org/nameapi/client/services/riskdetector/RiskDetectorResult.php +++ b/src/org/nameapi/client/services/riskdetector/RiskDetectorResult.php @@ -1,15 +1,14 @@ 1) throw new \Exception("Score is out of range [-1,1]: ".$score); + public function __construct($score, $risks) + { + if ($score < -1 || $score > 1) throw new \Exception("Score is out of range [-1,1]: " . $score); if ($score > 0) { - if (sizeof($risks)==0) throw new \Exception("At least one risk is required when there is a positive score!"); + if (sizeof($risks) == 0) throw new \Exception("At least one risk is required when there is a positive score!"); } $this->score = $score; $this->risks = $risks; @@ -42,11 +42,13 @@ public function __construct($score, $risks) { * * @return double in range [-1,1] */ - public function getScore() { + public function getScore() + { return $this->score; } - public function hasRisk() { + public function hasRisk() + { return !empty($this->risks); } @@ -54,7 +56,8 @@ public function hasRisk() { * Returns all the detected risks. * @return DetectedRisk[] Sorted by severity having the worst come first. Possibly empty, guaranteed to be non-empty if the getScore() is > 0. */ - public function getRisks() { + public function getRisks() + { return $this->risks; } diff --git a/src/org/nameapi/client/services/riskdetector/RiskDetectorServiceFactory.php b/src/org/nameapi/client/services/riskdetector/RiskDetectorServiceFactory.php index f6c7aac..715cf44 100644 --- a/src/org/nameapi/client/services/riskdetector/RiskDetectorServiceFactory.php +++ b/src/org/nameapi/client/services/riskdetector/RiskDetectorServiceFactory.php @@ -1,17 +1,17 @@ apiKey = $apiKey; + public function __construct($apiKey, Context $context, $baseUrl) + { + $this->apiKey = $apiKey; $this->context = $context; $this->baseUrl = $baseUrl; } /** - * @return riskdetector\PersonRiskDetectorService + * @return PersonRiskDetectorService */ - public function personRiskDetector() { - if ($this->personRiskDetector==null) { - $this->personRiskDetector = new riskdetector\PersonRiskDetectorService($this->apiKey, $this->context, $this->baseUrl); + public function personRiskDetector() + { + if ($this->personRiskDetector == null) { + $this->personRiskDetector = new PersonRiskDetectorService($this->apiKey, $this->context, $this->baseUrl); } return $this->personRiskDetector; } diff --git a/src/org/nameapi/client/services/riskdetector/RiskType.php b/src/org/nameapi/client/services/riskdetector/RiskType.php index 4c956b3..d1c5a09 100644 --- a/src/org/nameapi/client/services/riskdetector/RiskType.php +++ b/src/org/nameapi/client/services/riskdetector/RiskType.php @@ -1,12 +1,13 @@ restHttpClient->callApiPost( PersonRiskDetectorService::$RESOURCE_PATH, $queryParams, $headerParams, - array('inputPerson'=>$person, 'context'=>$this->context) + array('inputPerson' => $person, 'context' => $this->context) ); try { @@ -68,17 +69,19 @@ public function detect(NaturalInputPerson $person) { } } - private function _riskTypeToEnum($val) { + private function _riskTypeToEnum($val) + { if ($val[0] === 'FakeRiskType') { return new FakeRiskType($val[1]); } else if ($val[0] === 'DisguiseRiskType') { return new DisguiseRiskType($val[1]); } else { - throw new \Exception("Unsupported risk class: ".$val[0]); + throw new \Exception("Unsupported risk class: " . $val[0]); } } - private function _riskReason($val) { + private function _riskReason($val) + { if (isset($val->reason)) { return $val->reason; } else { diff --git a/src/org/nameapi/client/services/system/SystemServiceFactory.php b/src/org/nameapi/client/services/system/SystemServiceFactory.php index 8f017d0..81aef43 100644 --- a/src/org/nameapi/client/services/system/SystemServiceFactory.php +++ b/src/org/nameapi/client/services/system/SystemServiceFactory.php @@ -1,17 +1,15 @@ apiKey = $apiKey; $this->context = $context; $this->baseUrl = $baseUrl; @@ -30,8 +29,9 @@ public function __construct($apiKey, Context $context, $baseUrl) { * @return PingService * @since v4.0 */ - public function ping() { - if ($this->pingService==null) { + public function ping() + { + if ($this->pingService == null) { $this->pingService = new PingService($this->apiKey, $this->context, $this->baseUrl); } return $this->pingService; diff --git a/src/org/nameapi/client/services/system/ping/PingService.php b/src/org/nameapi/client/services/system/ping/PingService.php index 921b487..6072c74 100644 --- a/src/org/nameapi/client/services/system/ping/PingService.php +++ b/src/org/nameapi/client/services/system/ping/PingService.php @@ -1,10 +1,10 @@ systemServices()->pingService(); * $pong = $ping->ping(); */ -class PingService extends BaseService { +class PingService extends BaseService +{ private static $RESOURCE_PATH = "system/ping"; - public function __construct($apiKey, Context $context, $baseUrl) { + public function __construct($apiKey, Context $context, $baseUrl) + { parent::__construct($apiKey, $context, $baseUrl); } @@ -27,7 +29,8 @@ public function __construct($apiKey, Context $context, $baseUrl) { * @return string 'pong' * @throws ServiceException */ - public function ping() { + public function ping() + { $queryParams = array(); $headerParams = array(); diff --git a/src/org/nameapi/ontology/input/context/Context.php b/src/org/nameapi/ontology/input/context/Context.php index 8af1afe..af39cd4 100644 --- a/src/org/nameapi/ontology/input/context/Context.php +++ b/src/org/nameapi/ontology/input/context/Context.php @@ -1,23 +1,15 @@ priority = ($priority==null) ? null : (string)$priority; + public function __construct($priority, $place, $textCase, $properties) + { + $this->priority = ($priority == null) ? null : (string)$priority; $this->place = $place; - $this->textCase = ($textCase==null) ? null : (string)$textCase; - $this->properties = isSet($properties) ? $properties : array(); + $this->textCase = ($textCase == null) ? null : (string)$textCase; + $this->properties = isset($properties) ? $properties : array(); + } + + static function builder() + { + return new ContextBuilder(); + } + + /** + * @return string|null + */ + public function getPriority() + { + return $this->priority; } + /** + * @return string|null + */ + public function getPlace() + { + return $this->place; + } + + /** + * @return string|null + */ + public function getTextCase() + { + return $this->textCase; + } + + /** + * @return array|null + */ + public function getProperties() + { + return $this->properties; + } } diff --git a/src/org/nameapi/ontology/input/context/ContextBuilder.php b/src/org/nameapi/ontology/input/context/ContextBuilder.php index d311027..9054431 100644 --- a/src/org/nameapi/ontology/input/context/ContextBuilder.php +++ b/src/org/nameapi/ontology/input/context/ContextBuilder.php @@ -1,20 +1,22 @@ place = $place; return $this; } @@ -24,7 +26,8 @@ function place($place) { * either an instance of Priority, or a string in upper case. * @return ContextBuilder */ - function priority($priority) { + function priority($priority) + { if (is_string($priority)) { $priority = new Priority($priority); } @@ -36,7 +39,8 @@ function priority($priority) { * @param TextCase $textCase * @return ContextBuilder */ - function textCase($textCase) { + function textCase($textCase) + { $this->textCase = $textCase; return $this; } @@ -46,8 +50,9 @@ function textCase($textCase) { * @param string $value * @return ContextBuilder */ - function property($key, $value) { - if ($this->properties==null) $this->properties = array(); + function property($key, $value) + { + if ($this->properties == null) $this->properties = array(); $this->properties[$key] = $value; return $this; } @@ -56,7 +61,8 @@ function property($key, $value) { /** * @return Context */ - function build() { + function build() + { return new Context($this->priority, $this->place, $this->textCase, $this->properties); } diff --git a/src/org/nameapi/ontology/input/context/Priority.php b/src/org/nameapi/ontology/input/context/Priority.php index 25ff8a7..7fa6551 100644 --- a/src/org/nameapi/ontology/input/context/Priority.php +++ b/src/org/nameapi/ontology/input/context/Priority.php @@ -1,41 +1,44 @@ value = $value; } + public static function REALTIME() + { + if (!Priority::$realtime) Priority::$realtime = new Priority('REALTIME'); + return Priority::$realtime; + } + + public static function LOW() + { + if (!Priority::$low) Priority::$low = new Priority('LOW'); + return Priority::$low; + } - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/ontology/input/context/TextCase.php b/src/org/nameapi/ontology/input/context/TextCase.php index df23273..c6ee298 100644 --- a/src/org/nameapi/ontology/input/context/TextCase.php +++ b/src/org/nameapi/ontology/input/context/TextCase.php @@ -1,45 +1,51 @@ value = $value; + } - public static function TITLE_CASE() { + public static function TITLE_CASE() + { if (!TextCase::$titleCase) TextCase::$titleCase = new TextCase('TITLE_CASE'); return TextCase::$titleCase; } - public static function UPPER_CASE() { + + public static function UPPER_CASE() + { if (!TextCase::$upperCase) TextCase::$upperCase = new TextCase('UPPER_CASE'); return TextCase::$upperCase; } - public static function LOWER_CASE() { + + public static function LOWER_CASE() + { if (!TextCase::$lowerCase) TextCase::$lowerCase = new TextCase('LOWER_CASE'); return TextCase::$lowerCase; } - /** - * @var string $value - */ - private $value = null; - - public function __construct($value) { - if ($value!=='TITLE_CASE' && $value!=='UPPER_CASE' && $value!=='LOWER_CASE') { - throw new \Exception('Invalid value for TextCase: '.$value.'!'); - } - $this->value = $value; - } - - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/ontology/input/entities/address/AddressRelation.php b/src/org/nameapi/ontology/input/entities/address/AddressRelation.php index 73f0ce9..6414d23 100644 --- a/src/org/nameapi/ontology/input/entities/address/AddressRelation.php +++ b/src/org/nameapi/ontology/input/entities/address/AddressRelation.php @@ -1,12 +1,13 @@ value = $value; } - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/ontology/input/entities/address/InputAddress.php b/src/org/nameapi/ontology/input/entities/address/InputAddress.php index 53a869c..87d7f7d 100644 --- a/src/org/nameapi/ontology/input/entities/address/InputAddress.php +++ b/src/org/nameapi/ontology/input/entities/address/InputAddress.php @@ -1,6 +1,6 @@ streetInfo = $streetInfo; $this->pobox = $pobox; $this->placeInfo = $placeInfo; } + /** + * @return StructuredAddressBuilder + */ + static function builder() + { + return new StructuredAddressBuilder(); + } + } diff --git a/src/org/nameapi/ontology/input/entities/address/StructuredAddressBuilder.php b/src/org/nameapi/ontology/input/entities/address/StructuredAddressBuilder.php index 3894565..f5f0e30 100644 --- a/src/org/nameapi/ontology/input/entities/address/StructuredAddressBuilder.php +++ b/src/org/nameapi/ontology/input/entities/address/StructuredAddressBuilder.php @@ -1,8 +1,6 @@ The setters don't do anything other than setting the value. They don't check if the value was * set already, they don't trim the values.

*/ -class StructuredAddressBuilder { +class StructuredAddressBuilder +{ /** * @var StreetInfo|null $streetInfo @@ -26,7 +25,8 @@ class StructuredAddressBuilder { private $placeInfo; - function __construct() { + function __construct() + { } @@ -34,7 +34,8 @@ function __construct() { * @param StreetInfo|null $streetInfo * @return StructuredAddressBuilder */ - public function streetInfo($streetInfo) { + public function streetInfo($streetInfo) + { $this->streetInfo = $streetInfo; return $this; } @@ -43,7 +44,8 @@ public function streetInfo($streetInfo) { * @param string|null $pobox * @return StructuredAddressBuilder */ - public function pobox($pobox) { + public function pobox($pobox) + { $this->pobox = $pobox; return $this; } @@ -52,7 +54,8 @@ public function pobox($pobox) { * @param PlaceInfo|null $placeInfo * @return StructuredAddressBuilder */ - public function placeInfo($placeInfo) { + public function placeInfo($placeInfo) + { $this->placeInfo = $placeInfo; return $this; } @@ -61,7 +64,8 @@ public function placeInfo($placeInfo) { /** * @return StructuredAddress */ - public function build() { + public function build() + { return new StructuredAddress( $this->streetInfo, $this->pobox, diff --git a/src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfo.php b/src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfo.php index b3ff477..6f65a74 100644 --- a/src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfo.php +++ b/src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfo.php @@ -1,27 +1,17 @@ locality = $locality; - $this->postalCode = $postalCode; + public function __construct($locality, $postalCode, $neighborhood, $region, $country) + { + $this->locality = $locality; + $this->postalCode = $postalCode; $this->neighborhood = $neighborhood; - $this->region = $region; - $this->country = $country; + $this->region = $region; + $this->country = $country; + } + + /** + * @return StructuredPlaceInfoBuilder + */ + static function builder() + { + return new StructuredPlaceInfoBuilder(); } } diff --git a/src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfoBuilder.php b/src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfoBuilder.php index d6cce8b..d053086 100644 --- a/src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfoBuilder.php +++ b/src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfoBuilder.php @@ -1,8 +1,6 @@ The setters don't do anything other than setting the value. They don't check if the value was * set already, they don't trim the values.

*/ -class StructuredPlaceInfoBuilder { +class StructuredPlaceInfoBuilder +{ /** * @var string|null $locality @@ -34,7 +33,8 @@ class StructuredPlaceInfoBuilder { private $country; - function __construct() { + function __construct() + { } @@ -44,7 +44,8 @@ function __construct() { * @param string|null $locality * @return StructuredPlaceInfoBuilder */ - public function locality($locality) { + public function locality($locality) + { $this->locality = $locality; return $this; } @@ -55,7 +56,8 @@ public function locality($locality) { * @param string|null $postalCode * @return StructuredPlaceInfoBuilder */ - public function postalCode($postalCode) { + public function postalCode($postalCode) + { $this->postalCode = $postalCode; return $this; } @@ -64,7 +66,8 @@ public function postalCode($postalCode) { * @param string|null $neighborhood * @return StructuredPlaceInfoBuilder */ - public function neighborhood($neighborhood) { + public function neighborhood($neighborhood) + { $this->neighborhood = $neighborhood; return $this; } @@ -73,7 +76,8 @@ public function neighborhood($neighborhood) { * @param string|null $region * @return StructuredPlaceInfoBuilder */ - public function region($region) { + public function region($region) + { $this->region = $region; return $this; } @@ -84,7 +88,8 @@ public function region($region) { * @param string|null $country * @return StructuredPlaceInfoBuilder */ - public function country($country) { + public function country($country) + { $this->country = $country; return $this; } @@ -93,7 +98,8 @@ public function country($country) { /** * @return StructuredPlaceInfo */ - public function build() { + public function build() + { return new StructuredPlaceInfo( $this->locality, $this->postalCode, diff --git a/src/org/nameapi/ontology/input/entities/address/StructuredStreetInfo.php b/src/org/nameapi/ontology/input/entities/address/StructuredStreetInfo.php index 24fb2f0..c6c6b33 100644 --- a/src/org/nameapi/ontology/input/entities/address/StructuredStreetInfo.php +++ b/src/org/nameapi/ontology/input/entities/address/StructuredStreetInfo.php @@ -1,27 +1,17 @@ streetName = $streetName; $this->houseNumber = $houseNumber; $this->building = $building; @@ -66,5 +56,13 @@ public function __construct($streetName, $houseNumber, $building, $staircase, $f $this->apartment = $apartment; } + /** + * @return StructuredStreetInfoBuilder + */ + static function builder() + { + return new StructuredStreetInfoBuilder(); + } + } diff --git a/src/org/nameapi/ontology/input/entities/address/StructuredStreetInfoBuilder.php b/src/org/nameapi/ontology/input/entities/address/StructuredStreetInfoBuilder.php index 2b0d924..72d4076 100644 --- a/src/org/nameapi/ontology/input/entities/address/StructuredStreetInfoBuilder.php +++ b/src/org/nameapi/ontology/input/entities/address/StructuredStreetInfoBuilder.php @@ -1,8 +1,6 @@ The setters don't do anything other than setting the value. They don't check if the value was * set already, they don't trim the values.

*/ -class StructuredStreetInfoBuilder { +class StructuredStreetInfoBuilder +{ /** * @var string|null $streetName @@ -38,7 +37,8 @@ class StructuredStreetInfoBuilder { private $apartment; - function __construct() { + function __construct() + { } @@ -46,7 +46,8 @@ function __construct() { * @param string|null $streetName * @return StructuredStreetInfoBuilder */ - public function streetName($streetName) { + public function streetName($streetName) + { $this->streetName = $streetName; return $this; } @@ -55,7 +56,8 @@ public function streetName($streetName) { * @param string|null $houseNumber * @return StructuredStreetInfoBuilder */ - public function houseNumber($houseNumber) { + public function houseNumber($houseNumber) + { $this->houseNumber = $houseNumber; return $this; } @@ -64,7 +66,8 @@ public function houseNumber($houseNumber) { * @param string|null $building * @return StructuredStreetInfoBuilder */ - public function building($building) { + public function building($building) + { $this->building = $building; return $this; } @@ -73,7 +76,8 @@ public function building($building) { * @param string|null $staircase * @return StructuredStreetInfoBuilder */ - public function staircase($staircase) { + public function staircase($staircase) + { $this->staircase = $staircase; return $this; } @@ -82,7 +86,8 @@ public function staircase($staircase) { * @param string|null $floor * @return StructuredStreetInfoBuilder */ - public function floor($floor) { + public function floor($floor) + { $this->floor = $floor; return $this; } @@ -91,7 +96,8 @@ public function floor($floor) { * @param string|null $apartment * @return StructuredStreetInfoBuilder */ - public function apartment($apartment) { + public function apartment($apartment) + { $this->apartment = $apartment; return $this; } @@ -100,7 +106,8 @@ public function apartment($apartment) { /** * @return StructuredStreetInfo */ - public function build() { + public function build() + { return new StructuredStreetInfo( $this->streetName, $this->houseNumber, diff --git a/src/org/nameapi/ontology/input/entities/address/UseForAllAddressRelation.php b/src/org/nameapi/ontology/input/entities/address/UseForAllAddressRelation.php index e57d3fb..5bfa1c5 100644 --- a/src/org/nameapi/ontology/input/entities/address/UseForAllAddressRelation.php +++ b/src/org/nameapi/ontology/input/entities/address/UseForAllAddressRelation.php @@ -1,15 +1,14 @@ This is the case when only one address is known from the InputPerson.

*/ -class UseForAllAddressRelation extends AddressRelation { +class UseForAllAddressRelation extends AddressRelation +{ /** * Used for JSON marshalling only. @@ -26,7 +25,8 @@ class UseForAllAddressRelation extends AddressRelation { * UseForAllAddressRelation constructor. * @param InputAddress $address */ - public function __construct(InputAddress $address) { + public function __construct(InputAddress $address) + { $this->address = $address; } diff --git a/src/org/nameapi/ontology/input/entities/contact/EmailAddress.php b/src/org/nameapi/ontology/input/entities/contact/EmailAddress.php index 3a82204..bbb2798 100644 --- a/src/org/nameapi/ontology/input/entities/contact/EmailAddress.php +++ b/src/org/nameapi/ontology/input/entities/contact/EmailAddress.php @@ -1,8 +1,9 @@ emailAddress = $emailAddress; } diff --git a/src/org/nameapi/ontology/input/entities/contact/EmailAddressFactory.php b/src/org/nameapi/ontology/input/entities/contact/EmailAddressFactory.php index 7618109..3c1d555 100644 --- a/src/org/nameapi/ontology/input/entities/contact/EmailAddressFactory.php +++ b/src/org/nameapi/ontology/input/entities/contact/EmailAddressFactory.php @@ -1,16 +1,16 @@ fullNumber = $fullNumber; } diff --git a/src/org/nameapi/ontology/input/entities/contact/TelNumberFactory.php b/src/org/nameapi/ontology/input/entities/contact/TelNumberFactory.php index ae61b27..37ee653 100644 --- a/src/org/nameapi/ontology/input/entities/contact/TelNumberFactory.php +++ b/src/org/nameapi/ontology/input/entities/contact/TelNumberFactory.php @@ -1,16 +1,16 @@ value = $value; } - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/ontology/input/entities/person/NaturalInputPerson.php b/src/org/nameapi/ontology/input/entities/person/NaturalInputPerson.php index 1e169e0..30a12af 100644 --- a/src/org/nameapi/ontology/input/entities/person/NaturalInputPerson.php +++ b/src/org/nameapi/ontology/input/entities/person/NaturalInputPerson.php @@ -1,87 +1,63 @@ personName = $personName; - $this->gender = ($gender!=null) ? (String)$gender : null; + $this->gender = ($gender != null) ? (string)$gender : null; $this->ageInfo = $ageInfo; - $this->maritalStatus = ($maritalStatus!=null) ? (String)$maritalStatus : null; + $this->maritalStatus = ($maritalStatus != null) ? (string)$maritalStatus : null; $this->nationalities = $nationalities; $this->nativeLanguages = $nativeLanguages; $this->correspondenceLanguage = $correspondenceLanguage; @@ -117,4 +94,12 @@ public function __construct(InputPersonName $personName, $gender, $this->emailAddresses = $emailAddresses; } + /** + * @return NaturalInputPersonBuilder + */ + static function builder() + { + return new NaturalInputPersonBuilder(); + } + } diff --git a/src/org/nameapi/ontology/input/entities/person/NaturalInputPersonBuilder.php b/src/org/nameapi/ontology/input/entities/person/NaturalInputPersonBuilder.php index 706814a..a82203c 100644 --- a/src/org/nameapi/ontology/input/entities/person/NaturalInputPersonBuilder.php +++ b/src/org/nameapi/ontology/input/entities/person/NaturalInputPersonBuilder.php @@ -1,17 +1,15 @@ The setters don't do anything other than setting the value. They don't check if the value was * set already, they don't trim the values.

*/ -class NaturalInputPersonBuilder { +class NaturalInputPersonBuilder +{ /** * @var InputPersonName|null $personName @@ -77,8 +76,8 @@ class NaturalInputPersonBuilder { private $emailAddresses = null; - - function __construct() { + function __construct() + { } @@ -86,7 +85,8 @@ function __construct() { * @param InputPersonName|null $personName * @return NaturalInputPersonBuilder */ - public function name(InputPersonName $personName) { + public function name(InputPersonName $personName) + { $this->personName = $personName; return $this; } @@ -96,7 +96,8 @@ public function name(InputPersonName $personName) { * either an instance of StoragePersonGender, or a string in upper case like 'MALE'. * @return NaturalInputPersonBuilder */ - public function gender($gender) { + public function gender($gender) + { if (is_string($gender)) { $gender = new StoragePersonGender($gender); } @@ -108,7 +109,8 @@ public function gender($gender) { * @param AgeInfo $ageInfo * @return NaturalInputPersonBuilder */ - public function ageInfo(AgeInfo $ageInfo) { + public function ageInfo(AgeInfo $ageInfo) + { $this->ageInfo = $ageInfo; return $this; } @@ -117,7 +119,8 @@ public function ageInfo(AgeInfo $ageInfo) { * @param MaritalStatus $maritalStatus * @return NaturalInputPersonBuilder */ - public function maritalStatus($maritalStatus) { + public function maritalStatus($maritalStatus) + { $this->maritalStatus = $maritalStatus; return $this; } @@ -126,8 +129,9 @@ public function maritalStatus($maritalStatus) { * @param string $nationality * @return NaturalInputPersonBuilder */ - public function addNationality($nationality) { - if ($this->nationalities==null) { + public function addNationality($nationality) + { + if ($this->nationalities == null) { $this->nationalities = array(); } array_push($this->nationalities, $nationality); @@ -138,8 +142,9 @@ public function addNationality($nationality) { * @param string $nativeLanguage * @return NaturalInputPersonBuilder */ - public function addNativeLanguage($nativeLanguage) { - if ($this->nativeLanguages==null) { + public function addNativeLanguage($nativeLanguage) + { + if ($this->nativeLanguages == null) { $this->nativeLanguages = array(); } array_push($this->nativeLanguages, $nativeLanguage); @@ -150,7 +155,8 @@ public function addNativeLanguage($nativeLanguage) { * @param string $correspondenceLanguage * @return NaturalInputPersonBuilder */ - public function correspondenceLanguage($correspondenceLanguage) { + public function correspondenceLanguage($correspondenceLanguage) + { $this->correspondenceLanguage = $correspondenceLanguage; return $this; } @@ -159,7 +165,8 @@ public function correspondenceLanguage($correspondenceLanguage) { * @param string $religion * @return NaturalInputPersonBuilder */ - public function religion($religion) { + public function religion($religion) + { $this->religion = $religion; return $this; } @@ -172,12 +179,13 @@ public function religion($religion) { * @param string|TelNumber $telNumber * @return NaturalInputPersonBuilder */ - public function addTelNumber($telNumber) { - if ($this->telNumbers==null) { + public function addTelNumber($telNumber) + { + if ($this->telNumbers == null) { $this->telNumbers = array(); } if (is_string($telNumber)) { - $telNumber = \org\nameapi\ontology\input\entities\contact\TelNumberFactory::forNumber($telNumber); + $telNumber = \Org\NameApi\Ontology\Input\Entities\Contact\TelNumberFactory::forNumber($telNumber); } array_push($this->telNumbers, $telNumber); return $this; @@ -187,12 +195,13 @@ public function addTelNumber($telNumber) { * @param string|EmailAddress $emailAddress * @return NaturalInputPersonBuilder */ - public function addEmailAddress($emailAddress) { - if ($this->emailAddresses==null) { + public function addEmailAddress($emailAddress) + { + if ($this->emailAddresses == null) { $this->emailAddresses = array(); } if (is_string($emailAddress)) { - $emailAddress = \org\nameapi\ontology\input\entities\contact\EmailAddressFactory::forAddress($emailAddress); + $emailAddress = \Org\NameApi\Ontology\Input\Entities\Contact\EmailAddressFactory::forAddress($emailAddress); } array_push($this->emailAddresses, $emailAddress); return $this; @@ -203,8 +212,9 @@ public function addEmailAddress($emailAddress) { * @param InputAddress $address * @return NaturalInputPersonBuilder */ - public function addAddressForAll(InputAddress $address) { - if ($this->addresses==null) { + public function addAddressForAll(InputAddress $address) + { + if ($this->addresses == null) { $this->addresses = array(); } array_push($this->addresses, new UseForAllAddressRelation($address)); @@ -215,7 +225,8 @@ public function addAddressForAll(InputAddress $address) { /** * @return NaturalInputPerson */ - public function build() { + public function build() + { return new NaturalInputPerson( $this->personName, $this->gender, $this->ageInfo, $this->maritalStatus, diff --git a/src/org/nameapi/ontology/input/entities/person/PersonRole.php b/src/org/nameapi/ontology/input/entities/person/PersonRole.php index 60a5107..2241e38 100644 --- a/src/org/nameapi/ontology/input/entities/person/PersonRole.php +++ b/src/org/nameapi/ontology/input/entities/person/PersonRole.php @@ -1,27 +1,30 @@ value = $value; } - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/ontology/input/entities/person/PersonType.php b/src/org/nameapi/ontology/input/entities/person/PersonType.php index fda45f7..5ea6121 100644 --- a/src/org/nameapi/ontology/input/entities/person/PersonType.php +++ b/src/org/nameapi/ontology/input/entities/person/PersonType.php @@ -1,27 +1,30 @@ value = $value; } - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/ontology/input/entities/person/age/AgeInfo.php b/src/org/nameapi/ontology/input/entities/person/age/AgeInfo.php index 6833262..6acae79 100644 --- a/src/org/nameapi/ontology/input/entities/person/age/AgeInfo.php +++ b/src/org/nameapi/ontology/input/entities/person/age/AgeInfo.php @@ -1,9 +1,10 @@ 2100) throw new \Exception("Year is out of legal range: ".$year."!"); - if ($month<1 || $month>12) throw new \Exception("Month must be 1-12 but was: ".$month."!"); - if ($day<1 || $day>31) throw new \Exception("Day must be 1-31 but was: ".$day."!"); + public function __construct($year, $month, $day) + { + if ($year < 0 || $year > 2100) throw new \Exception("Year is out of legal range: " . $year . "!"); + if ($month < 1 || $month > 12) throw new \Exception("Month must be 1-12 but was: " . $month . "!"); + if ($day < 1 || $day > 31) throw new \Exception("Day must be 1-31 but was: " . $day . "!"); $this->year = $year; $this->month = $month; $this->day = $day; } + /** + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * @return int + */ + public function getYear() + { + return $this->year; + } + + /** + * @return int + */ + public function getMonth() + { + return $this->month; + } + + /** + * @return int + */ + public function getDay() + { + return $this->day; + } } diff --git a/src/org/nameapi/ontology/input/entities/person/age/BirthYear.php b/src/org/nameapi/ontology/input/entities/person/age/BirthYear.php index 2d93b2d..0ae1b2d 100644 --- a/src/org/nameapi/ontology/input/entities/person/age/BirthYear.php +++ b/src/org/nameapi/ontology/input/entities/person/age/BirthYear.php @@ -1,11 +1,12 @@ 2100) throw new \Exception("Year is out of legal range: ".$year."!"); + public function __construct($year) + { + if ($year < 0 || $year > 2100) throw new \Exception("Year is out of legal range: " . $year . "!"); $this->year = $year; } diff --git a/src/org/nameapi/ontology/input/entities/person/age/BirthYearRange.php b/src/org/nameapi/ontology/input/entities/person/age/BirthYearRange.php index ebe2568..d793867 100644 --- a/src/org/nameapi/ontology/input/entities/person/age/BirthYearRange.php +++ b/src/org/nameapi/ontology/input/entities/person/age/BirthYearRange.php @@ -1,11 +1,12 @@ yearRange = $yearRange; } diff --git a/src/org/nameapi/ontology/input/entities/person/age/YearRange.php b/src/org/nameapi/ontology/input/entities/person/age/YearRange.php index 4bfa8f9..f6f8598 100644 --- a/src/org/nameapi/ontology/input/entities/person/age/YearRange.php +++ b/src/org/nameapi/ontology/input/entities/person/age/YearRange.php @@ -1,10 +1,11 @@ startIncluding = $startIncluding; $this->endIncluding = $endIncluding; } - + } diff --git a/src/org/nameapi/ontology/input/entities/person/gender/ComputedPersonGender.php b/src/org/nameapi/ontology/input/entities/person/gender/ComputedPersonGender.php index d99e8b6..77264f3 100644 --- a/src/org/nameapi/ontology/input/entities/person/gender/ComputedPersonGender.php +++ b/src/org/nameapi/ontology/input/entities/person/gender/ComputedPersonGender.php @@ -1,31 +1,33 @@ value = $value; } - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/ontology/input/entities/person/gender/StoragePersonGender.php b/src/org/nameapi/ontology/input/entities/person/gender/StoragePersonGender.php index d02212f..82e01d2 100644 --- a/src/org/nameapi/ontology/input/entities/person/gender/StoragePersonGender.php +++ b/src/org/nameapi/ontology/input/entities/person/gender/StoragePersonGender.php @@ -1,6 +1,6 @@ value = $value; } - - public function __toString() { + public function __toString() + { return $this->value; } diff --git a/src/org/nameapi/ontology/input/entities/person/name/InputPersonName.php b/src/org/nameapi/ontology/input/entities/person/name/InputPersonName.php index 7cb49f8..8ff7b13 100644 --- a/src/org/nameapi/ontology/input/entities/person/name/InputPersonName.php +++ b/src/org/nameapi/ontology/input/entities/person/name/InputPersonName.php @@ -1,28 +1,9 @@ nameFields = $nameFields; } + /** + * @return Builder\WesternInputPersonNameBuilder + */ + static function westernBuilder() + { + return new Builder\WesternInputPersonNameBuilder(); + } + + /** + * @return Builder\AmericanInputPersonNameBuilder + */ + static function americanBuilder() + { + return new Builder\AmericanInputPersonNameBuilder(); + } + } diff --git a/src/org/nameapi/ontology/input/entities/person/name/NameField.php b/src/org/nameapi/ontology/input/entities/person/name/NameField.php index ce4b92d..a466e55 100644 --- a/src/org/nameapi/ontology/input/entities/person/name/NameField.php +++ b/src/org/nameapi/ontology/input/entities/person/name/NameField.php @@ -1,6 +1,6 @@ string = $string; $this->fieldType = $fieldType; } diff --git a/src/org/nameapi/ontology/input/entities/person/name/builder/AmericanInputPersonNameBuilder.php b/src/org/nameapi/ontology/input/entities/person/name/builder/AmericanInputPersonNameBuilder.php index 8c5e1c9..6f5a0a7 100644 --- a/src/org/nameapi/ontology/input/entities/person/name/builder/AmericanInputPersonNameBuilder.php +++ b/src/org/nameapi/ontology/input/entities/person/name/builder/AmericanInputPersonNameBuilder.php @@ -1,18 +1,20 @@ nameField(new NameField($string, CommonNameFieldType::GIVENNAME)); return $this; } @@ -21,7 +23,8 @@ public function givenName($string) { * @param $string * @return $this */ - public function middleName($string) { + public function middleName($string) + { $this->nameField(new NameField($string, AmericanNameFieldType::MIDDLENAME)); return $this; } @@ -30,7 +33,8 @@ public function middleName($string) { * @param $string * @return $this */ - public function surname($string) { + public function surname($string) + { $this->nameField(new NameField($string, CommonNameFieldType::SURNAME)); return $this; } @@ -40,7 +44,8 @@ public function surname($string) { * @param $string * @return $this */ - public function prefix($string) { + public function prefix($string) + { $this->nameField(new NameField($string, AmericanNameFieldType::NAMEPREFIX)); return $this; } @@ -49,7 +54,8 @@ public function prefix($string) { * @param $string * @return $this */ - public function suffix($string) { + public function suffix($string) + { $this->nameField(new NameField($string, AmericanNameFieldType::NAMESUFFIX)); return $this; } diff --git a/src/org/nameapi/ontology/input/entities/person/name/builder/InputPersonNameBuilder.php b/src/org/nameapi/ontology/input/entities/person/name/builder/InputPersonNameBuilder.php index c2b2141..c137a3b 100644 --- a/src/org/nameapi/ontology/input/entities/person/name/builder/InputPersonNameBuilder.php +++ b/src/org/nameapi/ontology/input/entities/person/name/builder/InputPersonNameBuilder.php @@ -1,12 +1,13 @@ nameField(new NameField($string, CommonNameFieldType::FULLNAME)); } @@ -26,17 +28,20 @@ public function fullname($string) { * @param NameField $nameField * @return $this */ - public function nameField(NameField $nameField) { + public function nameField(NameField $nameField) + { array_push($this->nameFields, $nameField); return $this; } - public function isEmpty() { + public function isEmpty() + { return empty($this->nameFields); } - public function build() { + public function build() + { return new InputPersonName($this->nameFields); } diff --git a/src/org/nameapi/ontology/input/entities/person/name/builder/WesternInputPersonNameBuilder.php b/src/org/nameapi/ontology/input/entities/person/name/builder/WesternInputPersonNameBuilder.php index 5fb92d2..ba7476f 100644 --- a/src/org/nameapi/ontology/input/entities/person/name/builder/WesternInputPersonNameBuilder.php +++ b/src/org/nameapi/ontology/input/entities/person/name/builder/WesternInputPersonNameBuilder.php @@ -1,17 +1,19 @@ nameField(new NameField($string, CommonNameFieldType::GIVENNAME)); return $this; } @@ -20,7 +22,8 @@ public function givenName($string) { * @param $string * @return $this */ - public function surname($string) { + public function surname($string) + { $this->nameField(new NameField($string, CommonNameFieldType::SURNAME)); return $this; } diff --git a/src/org/nameapi/ontology/input/entities/person/name/types/AmericanNameFieldType.php b/src/org/nameapi/ontology/input/entities/person/name/types/AmericanNameFieldType.php index 3492256..b0d8148 100644 --- a/src/org/nameapi/ontology/input/entities/person/name/types/AmericanNameFieldType.php +++ b/src/org/nameapi/ontology/input/entities/person/name/types/AmericanNameFieldType.php @@ -1,8 +1,9 @@ priority(Priority::REALTIME()) diff --git a/tests/functional/PersonNameParserServiceTest.php b/tests/functional/PersonNameParserServiceTest.php index 2a14bf6..bf0c010 100644 --- a/tests/functional/PersonNameParserServiceTest.php +++ b/tests/functional/PersonNameParserServiceTest.php @@ -1,12 +1,14 @@ priority(Priority::REALTIME()) @@ -30,7 +34,7 @@ public function testParse() { //the call: $inputPerson = NaturalInputPerson::builder() ->name(InputPersonName::westernBuilder() - ->fullname( "John Doe" ) + ->fullname("John Doe") ->build()) ->gender("FEMALE") ->build(); @@ -49,7 +53,8 @@ public function testParse() { $this->assertEquals('GENDER', (string)$bestMatch->getParserDisputes()[0]->getDisputeType()); } - public function test_parseTwoPeople() { + public function test_parseTwoPeople() + { //setup code: $context = Context::builder() ->priority(Priority::REALTIME()) @@ -61,7 +66,7 @@ public function test_parseTwoPeople() { //the call: $inputPerson = NaturalInputPerson::builder() ->name(InputPersonName::westernBuilder() - ->fullname( "Peter und Daniela Meyer" ) + ->fullname("Peter und Daniela Meyer") ->build()) ->build(); $parseResult = $personNameParser->parse($inputPerson); diff --git a/tests/functional/PersonRiskDetectorServiceTest.php b/tests/functional/PersonRiskDetectorServiceTest.php index 170d05b..4c03168 100644 --- a/tests/functional/PersonRiskDetectorServiceTest.php +++ b/tests/functional/PersonRiskDetectorServiceTest.php @@ -1,15 +1,17 @@ priority(Priority::REALTIME()) @@ -34,7 +38,7 @@ public function testDetect() { //the call: $inputPerson = NaturalInputPerson::builder() ->name(InputPersonName::westernBuilder() - ->fullname( "John Doe" ) + ->fullname("John Doe") ->build()) ->gender("FEMALE") ->build(); @@ -62,7 +66,8 @@ public function testDetect() { * - a telephone number * - a physical address */ - public function testDetect_allValues() { + public function testDetect_allValues() + { $context = Context::builder() ->priority(Priority::REALTIME()) ->build(); @@ -72,8 +77,8 @@ public function testDetect_allValues() { $inputPerson = NaturalInputPerson::builder() ->name(InputPersonName::westernBuilder() - ->givenName( "Donald" ) - ->surname( "Duck" ) + ->givenName("Donald") + ->surname("Duck") ->build()) ->addEmailAddress("info@example.com") ->addTelNumber("999 999 999") @@ -107,7 +112,8 @@ public function testDetect_allValues() { } - private function _expectRiskOnName($risks) { + private function _expectRiskOnName($risks) + { foreach ($risks as $risk) { if ((string)$risk->getDataItem() === 'NAME') { return; @@ -116,7 +122,8 @@ private function _expectRiskOnName($risks) { $this->assertTrue(false); //fail } - private function _expectRiskOnAddress($risks) { + private function _expectRiskOnAddress($risks) + { foreach ($risks as $risk) { if ((string)$risk->getDataItem() === 'ADDRESS') { @@ -126,7 +133,8 @@ private function _expectRiskOnAddress($risks) { $this->assertTrue(false); //fail } - private function _expectRiskOnEmail($risks) { + private function _expectRiskOnEmail($risks) + { foreach ($risks as $risk) { if ((string)$risk->getDataItem() === 'EMAIL') { @@ -136,7 +144,8 @@ private function _expectRiskOnEmail($risks) { $this->assertTrue(false); //fail } - private function _expectRiskOnTel($risks) { + private function _expectRiskOnTel($risks) + { foreach ($risks as $risk) { if ((string)$risk->getDataItem() === 'TEL') { @@ -147,5 +156,4 @@ private function _expectRiskOnTel($risks) { } - } diff --git a/tests/functional/PingServiceTest.php b/tests/functional/PingServiceTest.php index 2b5f9f0..322726e 100644 --- a/tests/functional/PingServiceTest.php +++ b/tests/functional/PingServiceTest.php @@ -1,10 +1,12 @@ priority(Priority::REALTIME()) diff --git a/tests/unit/org/nameapi/client/fault/FaultInfoUnmarshallerTest.php b/tests/unit/org/nameapi/client/fault/FaultInfoUnmarshallerTest.php index 4b22f2e..a856f68 100644 --- a/tests/unit/org/nameapi/client/fault/FaultInfoUnmarshallerTest.php +++ b/tests/unit/org/nameapi/client/fault/FaultInfoUnmarshallerTest.php @@ -1,19 +1,22 @@ >>foo<<assertEquals("AccessDenied", $faultInfo->getFaultCause()); + $this->assertEquals("AccessDenied", $faultInfo->getFaultCause()); $this->assertTrue($faultInfo->getBlame()->isClient()); - $this->assertEquals("No such account: >>>foo<<getMessage()); - $this->assertEquals("1201", $faultInfo->getApplicationErrorCode()); - $this->assertEquals(null, $faultInfo->getIncidentId()); + $this->assertEquals("No such account: >>>foo<<getMessage()); + $this->assertEquals("1201", $faultInfo->getApplicationErrorCode()); + $this->assertEquals(null, $faultInfo->getIncidentId()); } } diff --git a/tests/unit/org/nameapi/ontology/input/context/ContextBuilderTest.php b/tests/unit/org/nameapi/ontology/input/context/ContextBuilderTest.php index 77947bf..17e794b 100644 --- a/tests/unit/org/nameapi/ontology/input/context/ContextBuilderTest.php +++ b/tests/unit/org/nameapi/ontology/input/context/ContextBuilderTest.php @@ -1,12 +1,16 @@ place('DE')->priority(Priority::REALTIME())->build(); $this->assertEquals('DE', $context->getPlace()); $this->assertEquals(Priority::REALTIME(), $context->getPriority()); diff --git a/tests/unit/org/nameapi/ontology/input/context/PriorityTest.php b/tests/unit/org/nameapi/ontology/input/context/PriorityTest.php index 1e2014c..54c9b58 100644 --- a/tests/unit/org/nameapi/ontology/input/context/PriorityTest.php +++ b/tests/unit/org/nameapi/ontology/input/context/PriorityTest.php @@ -1,12 +1,15 @@ assertEquals(Priority::REALTIME(), Priority::REALTIME()); $this->assertTrue(Priority::REALTIME() === Priority::REALTIME()); $this->assertEquals('REALTIME', (string)Priority::REALTIME()); diff --git a/tests/unit/org/nameapi/ontology/input/context/TextCaseTest.php b/tests/unit/org/nameapi/ontology/input/context/TextCaseTest.php index 11da093..c108e8a 100644 --- a/tests/unit/org/nameapi/ontology/input/context/TextCaseTest.php +++ b/tests/unit/org/nameapi/ontology/input/context/TextCaseTest.php @@ -1,12 +1,15 @@ assertEquals(TextCase::TITLE_CASE(), TextCase::TITLE_CASE()); $this->assertTrue(TextCase::TITLE_CASE() === TextCase::TITLE_CASE()); $this->assertEquals('TITLE_CASE', (string)TextCase::TITLE_CASE()); diff --git a/tests/unit/org/nameapi/ontology/input/entities/person/age/AgeInfoFactoryTest.php b/tests/unit/org/nameapi/ontology/input/entities/person/age/AgeInfoFactoryTest.php index ffa3ec5..15fe38a 100644 --- a/tests/unit/org/nameapi/ontology/input/entities/person/age/AgeInfoFactoryTest.php +++ b/tests/unit/org/nameapi/ontology/input/entities/person/age/AgeInfoFactoryTest.php @@ -1,15 +1,18 @@ assertEquals(29, $ageInfo->getDay()); - $this->assertEquals(5, $ageInfo->getMonth()); + $this->assertEquals(29, $ageInfo->getDay()); + $this->assertEquals(5, $ageInfo->getMonth()); $this->assertEquals(1917, $ageInfo->getYear()); } From a3c21fa01f83044573dc2331972adf0b5b582f66 Mon Sep 17 00:00:00 2001 From: Mark Stralka Date: Sat, 20 Mar 2021 14:25:53 -0400 Subject: [PATCH 2/9] Moved folders and refacttored PSR-4 autoloading --- composer.json | 2 +- src/{org/nameapi/client/fault => Client/Fault}/Blame.php | 0 src/{org/nameapi/client/fault => Client/Fault}/FaultInfo.php | 0 .../client/fault => Client/Fault}/FaultInfoUnmarshaller.php | 0 src/{org/nameapi/client/fault => Client/Fault}/Retry.php | 0 src/{org/nameapi/client/fault => Client/Fault}/RetryType.php | 0 .../nameapi/client/fault => Client/Fault}/ServiceException.php | 0 .../nameapi/client/http => Client/Http}/HttpResponseData.php | 0 src/{org/nameapi/client/http => Client/Http}/RestHttpClient.php | 0 .../client/http => Client/Http}/RestHttpClientConfig.php | 0 .../nameapi/client/services => Client/Services}/BaseService.php | 0 .../Services/Development}/DevelopmentServiceFactory.php | 0 .../Development/ExceptionThrower}/ExceptionThrowerService.php | 0 .../DisposableEmailAddressDetectorResult.php | 0 .../DisposableEmailAddressDetectorService.php | 0 .../Services/Email/DisposableEmailAddressDetector}/Maybe.php | 0 .../Services/Email/EmailNameParser}/EmailAddressNameType.php | 0 .../Email/EmailNameParser}/EmailAddressParsingResultType.php | 0 .../Services/Email/EmailNameParser}/EmailNameParserMatch.php | 0 .../Services/Email/EmailNameParser}/EmailNameParserResult.php | 0 .../Services/Email/EmailNameParser}/EmailNameParserService.php | 0 .../Services/Email/EmailNameParser}/NameFromEmailAddress.php | 0 .../email => Client/Services/Email}/EmailServiceFactory.php | 0 .../Services/Formatter}/FormatterProperties.php | 0 .../formatter => Client/Services/Formatter}/FormatterResult.php | 0 .../Services/Formatter}/FormatterServiceFactory.php | 0 .../Formatter/NameFieldFormatter}/NameFieldFormatterService.php | 0 .../PersonNameFormatter}/PersonNameFormatterService.php | 0 .../Services/Genderizer}/GenderizerServiceFactory.php | 0 .../Genderizer/PersonGenderizer}/PersonGenderResult.php | 0 .../Genderizer/PersonGenderizer}/PersonGenderizerService.php | 0 src/{org/nameapi/client/services => Client/Services}/Host.php | 0 .../matcher => Client/Services/Matcher}/AgeMatchType.php | 0 .../matcher => Client/Services/Matcher}/AgeMatcherResult.php | 0 .../matcher => Client/Services/Matcher}/GenderMatchType.php | 0 .../matcher => Client/Services/Matcher}/GenderMatcherResult.php | 0 .../Services/Matcher}/MatcherServiceFactory.php | 0 .../Services/Matcher/PersonMatcher}/PersonMatchComposition.php | 0 .../Services/Matcher/PersonMatcher}/PersonMatchType.php | 0 .../Services/Matcher/PersonMatcher}/PersonMatcherResult.php | 0 .../Services/Matcher/PersonMatcher}/PersonMatcherService.php | 0 .../matcher => Client/Services/Matcher}/PersonNameMatchType.php | 0 .../Services/Matcher}/PersonNameMatcherResult.php | 0 .../parser => Client/Services/Parser}/OutputPersonName.php | 0 .../parser => Client/Services/Parser}/OutputTermType.php | 0 .../parser => Client/Services/Parser}/ParserServiceFactory.php | 0 .../Services/Parser/PersonNameParser}/DisputeType.php | 0 .../Services/Parser/PersonNameParser}/ParsedPerson.php | 0 .../Services/Parser/PersonNameParser}/ParsedPersonMatch.php | 0 .../Services/Parser/PersonNameParser}/ParserDispute.php | 0 .../Parser/PersonNameParser}/PersonNameParserResult.php | 0 .../Parser/PersonNameParser}/PersonNameParserService.php | 0 .../client/services/parser => Client/Services/Parser}/Term.php | 0 .../riskdetector => Client/Services/RiskDetector}/DataItem.php | 0 .../Services/RiskDetector}/DetectedRisk.php | 0 .../Services/RiskDetector}/DisguiseRiskType.php | 0 .../Services/RiskDetector}/FakeRiskType.php | 0 .../Services/RiskDetector/Person}/PersonRiskDetectorService.php | 0 .../Services/RiskDetector}/RiskDetectorResult.php | 0 .../Services/RiskDetector}/RiskDetectorServiceFactory.php | 0 .../riskdetector => Client/Services/RiskDetector}/RiskType.php | 0 .../client/services => Client/Services}/ServiceFactory.php | 0 .../system/ping => Client/Services/System/Ping}/PingService.php | 0 .../system => Client/Services/System}/SystemServiceFactory.php | 0 .../input/context => Ontology/Input/Context}/Context.php | 0 .../input/context => Ontology/Input/Context}/ContextBuilder.php | 0 .../input/context => Ontology/Input/Context}/Priority.php | 0 .../input/context => Ontology/Input/Context}/TextCase.php | 0 .../Input/Entities/Address}/AddressRelation.php | 0 .../Input/Entities/Address}/AddressUsage.php | 0 .../Input/Entities/Address}/InputAddress.php | 0 .../address => Ontology/Input/Entities/Address}/PlaceInfo.php | 0 .../address => Ontology/Input/Entities/Address}/StreetInfo.php | 0 .../Input/Entities/Address}/StructuredAddress.php | 0 .../Input/Entities/Address}/StructuredAddressBuilder.php | 0 .../Input/Entities/Address}/StructuredPlaceInfo.php | 0 .../Input/Entities/Address}/StructuredPlaceInfoBuilder.php | 0 .../Input/Entities/Address}/StructuredStreetInfo.php | 0 .../Input/Entities/Address}/StructuredStreetInfoBuilder.php | 0 .../Input/Entities/Address}/UseForAllAddressRelation.php | 0 .../Input/Entities/Contact}/EmailAddress.php | 0 .../Input/Entities/Contact}/EmailAddressFactory.php | 0 .../contact => Ontology/Input/Entities/Contact}/TelNumber.php | 0 .../Input/Entities/Contact}/TelNumberFactory.php | 0 .../age => Ontology/Input/Entities/Person/Age}/AgeInfo.php | 0 .../Input/Entities/Person/Age}/AgeInfoFactory.php | 0 .../age => Ontology/Input/Entities/Person/Age}/BirthDate.php | 0 .../age => Ontology/Input/Entities/Person/Age}/BirthYear.php | 0 .../Input/Entities/Person/Age}/BirthYearRange.php | 0 .../age => Ontology/Input/Entities/Person/Age}/YearRange.php | 0 .../Input/Entities/Person/Gender}/ComputedPersonGender.php | 0 .../Input/Entities/Person/Gender}/StoragePersonGender.php | 0 .../person => Ontology/Input/Entities/Person}/MaritalStatus.php | 0 .../Person/Name/Builder}/AmericanInputPersonNameBuilder.php | 0 .../Entities/Person/Name/Builder}/InputPersonNameBuilder.php | 0 .../Person/Name/Builder}/WesternInputPersonNameBuilder.php | 0 .../Input/Entities/Person/Name}/InputPersonName.php | 0 .../name => Ontology/Input/Entities/Person/Name}/NameField.php | 0 .../Input/Entities/Person/Name/Types}/AmericanNameFieldType.php | 0 .../Input/Entities/Person/Name/Types}/CommonNameFieldType.php | 0 .../Input/Entities/Person}/NaturalInputPerson.php | 0 .../Input/Entities/Person}/NaturalInputPersonBuilder.php | 0 .../person => Ontology/Input/Entities/Person}/PersonRole.php | 0 .../person => Ontology/Input/Entities/Person}/PersonType.php | 0 104 files changed, 1 insertion(+), 1 deletion(-) rename src/{org/nameapi/client/fault => Client/Fault}/Blame.php (100%) rename src/{org/nameapi/client/fault => Client/Fault}/FaultInfo.php (100%) rename src/{org/nameapi/client/fault => Client/Fault}/FaultInfoUnmarshaller.php (100%) rename src/{org/nameapi/client/fault => Client/Fault}/Retry.php (100%) rename src/{org/nameapi/client/fault => Client/Fault}/RetryType.php (100%) rename src/{org/nameapi/client/fault => Client/Fault}/ServiceException.php (100%) rename src/{org/nameapi/client/http => Client/Http}/HttpResponseData.php (100%) rename src/{org/nameapi/client/http => Client/Http}/RestHttpClient.php (100%) rename src/{org/nameapi/client/http => Client/Http}/RestHttpClientConfig.php (100%) rename src/{org/nameapi/client/services => Client/Services}/BaseService.php (100%) rename src/{org/nameapi/client/services/development => Client/Services/Development}/DevelopmentServiceFactory.php (100%) rename src/{org/nameapi/client/services/development/exceptionthrower => Client/Services/Development/ExceptionThrower}/ExceptionThrowerService.php (100%) rename src/{org/nameapi/client/services/email/disposableemailaddressdetector => Client/Services/Email/DisposableEmailAddressDetector}/DisposableEmailAddressDetectorResult.php (100%) rename src/{org/nameapi/client/services/email/disposableemailaddressdetector => Client/Services/Email/DisposableEmailAddressDetector}/DisposableEmailAddressDetectorService.php (100%) rename src/{org/nameapi/client/services/email/disposableemailaddressdetector => Client/Services/Email/DisposableEmailAddressDetector}/Maybe.php (100%) rename src/{org/nameapi/client/services/email/emailnameparser => Client/Services/Email/EmailNameParser}/EmailAddressNameType.php (100%) rename src/{org/nameapi/client/services/email/emailnameparser => Client/Services/Email/EmailNameParser}/EmailAddressParsingResultType.php (100%) rename src/{org/nameapi/client/services/email/emailnameparser => Client/Services/Email/EmailNameParser}/EmailNameParserMatch.php (100%) rename src/{org/nameapi/client/services/email/emailnameparser => Client/Services/Email/EmailNameParser}/EmailNameParserResult.php (100%) rename src/{org/nameapi/client/services/email/emailnameparser => Client/Services/Email/EmailNameParser}/EmailNameParserService.php (100%) rename src/{org/nameapi/client/services/email/emailnameparser => Client/Services/Email/EmailNameParser}/NameFromEmailAddress.php (100%) rename src/{org/nameapi/client/services/email => Client/Services/Email}/EmailServiceFactory.php (100%) rename src/{org/nameapi/client/services/formatter => Client/Services/Formatter}/FormatterProperties.php (100%) rename src/{org/nameapi/client/services/formatter => Client/Services/Formatter}/FormatterResult.php (100%) rename src/{org/nameapi/client/services/formatter => Client/Services/Formatter}/FormatterServiceFactory.php (100%) rename src/{org/nameapi/client/services/formatter/namefieldformatter => Client/Services/Formatter/NameFieldFormatter}/NameFieldFormatterService.php (100%) rename src/{org/nameapi/client/services/formatter/personnameformatter => Client/Services/Formatter/PersonNameFormatter}/PersonNameFormatterService.php (100%) rename src/{org/nameapi/client/services/genderizer => Client/Services/Genderizer}/GenderizerServiceFactory.php (100%) rename src/{org/nameapi/client/services/genderizer/persongenderizer => Client/Services/Genderizer/PersonGenderizer}/PersonGenderResult.php (100%) rename src/{org/nameapi/client/services/genderizer/persongenderizer => Client/Services/Genderizer/PersonGenderizer}/PersonGenderizerService.php (100%) rename src/{org/nameapi/client/services => Client/Services}/Host.php (100%) rename src/{org/nameapi/client/services/matcher => Client/Services/Matcher}/AgeMatchType.php (100%) rename src/{org/nameapi/client/services/matcher => Client/Services/Matcher}/AgeMatcherResult.php (100%) rename src/{org/nameapi/client/services/matcher => Client/Services/Matcher}/GenderMatchType.php (100%) rename src/{org/nameapi/client/services/matcher => Client/Services/Matcher}/GenderMatcherResult.php (100%) rename src/{org/nameapi/client/services/matcher => Client/Services/Matcher}/MatcherServiceFactory.php (100%) rename src/{org/nameapi/client/services/matcher/personmatcher => Client/Services/Matcher/PersonMatcher}/PersonMatchComposition.php (100%) rename src/{org/nameapi/client/services/matcher/personmatcher => Client/Services/Matcher/PersonMatcher}/PersonMatchType.php (100%) rename src/{org/nameapi/client/services/matcher/personmatcher => Client/Services/Matcher/PersonMatcher}/PersonMatcherResult.php (100%) rename src/{org/nameapi/client/services/matcher/personmatcher => Client/Services/Matcher/PersonMatcher}/PersonMatcherService.php (100%) rename src/{org/nameapi/client/services/matcher => Client/Services/Matcher}/PersonNameMatchType.php (100%) rename src/{org/nameapi/client/services/matcher => Client/Services/Matcher}/PersonNameMatcherResult.php (100%) rename src/{org/nameapi/client/services/parser => Client/Services/Parser}/OutputPersonName.php (100%) rename src/{org/nameapi/client/services/parser => Client/Services/Parser}/OutputTermType.php (100%) rename src/{org/nameapi/client/services/parser => Client/Services/Parser}/ParserServiceFactory.php (100%) rename src/{org/nameapi/client/services/parser/personnameparser => Client/Services/Parser/PersonNameParser}/DisputeType.php (100%) rename src/{org/nameapi/client/services/parser/personnameparser => Client/Services/Parser/PersonNameParser}/ParsedPerson.php (100%) rename src/{org/nameapi/client/services/parser/personnameparser => Client/Services/Parser/PersonNameParser}/ParsedPersonMatch.php (100%) rename src/{org/nameapi/client/services/parser/personnameparser => Client/Services/Parser/PersonNameParser}/ParserDispute.php (100%) rename src/{org/nameapi/client/services/parser/personnameparser => Client/Services/Parser/PersonNameParser}/PersonNameParserResult.php (100%) rename src/{org/nameapi/client/services/parser/personnameparser => Client/Services/Parser/PersonNameParser}/PersonNameParserService.php (100%) rename src/{org/nameapi/client/services/parser => Client/Services/Parser}/Term.php (100%) rename src/{org/nameapi/client/services/riskdetector => Client/Services/RiskDetector}/DataItem.php (100%) rename src/{org/nameapi/client/services/riskdetector => Client/Services/RiskDetector}/DetectedRisk.php (100%) rename src/{org/nameapi/client/services/riskdetector => Client/Services/RiskDetector}/DisguiseRiskType.php (100%) rename src/{org/nameapi/client/services/riskdetector => Client/Services/RiskDetector}/FakeRiskType.php (100%) rename src/{org/nameapi/client/services/riskdetector/person => Client/Services/RiskDetector/Person}/PersonRiskDetectorService.php (100%) rename src/{org/nameapi/client/services/riskdetector => Client/Services/RiskDetector}/RiskDetectorResult.php (100%) rename src/{org/nameapi/client/services/riskdetector => Client/Services/RiskDetector}/RiskDetectorServiceFactory.php (100%) rename src/{org/nameapi/client/services/riskdetector => Client/Services/RiskDetector}/RiskType.php (100%) rename src/{org/nameapi/client/services => Client/Services}/ServiceFactory.php (100%) rename src/{org/nameapi/client/services/system/ping => Client/Services/System/Ping}/PingService.php (100%) rename src/{org/nameapi/client/services/system => Client/Services/System}/SystemServiceFactory.php (100%) rename src/{org/nameapi/ontology/input/context => Ontology/Input/Context}/Context.php (100%) rename src/{org/nameapi/ontology/input/context => Ontology/Input/Context}/ContextBuilder.php (100%) rename src/{org/nameapi/ontology/input/context => Ontology/Input/Context}/Priority.php (100%) rename src/{org/nameapi/ontology/input/context => Ontology/Input/Context}/TextCase.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/AddressRelation.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/AddressUsage.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/InputAddress.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/PlaceInfo.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/StreetInfo.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/StructuredAddress.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/StructuredAddressBuilder.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/StructuredPlaceInfo.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/StructuredPlaceInfoBuilder.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/StructuredStreetInfo.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/StructuredStreetInfoBuilder.php (100%) rename src/{org/nameapi/ontology/input/entities/address => Ontology/Input/Entities/Address}/UseForAllAddressRelation.php (100%) rename src/{org/nameapi/ontology/input/entities/contact => Ontology/Input/Entities/Contact}/EmailAddress.php (100%) rename src/{org/nameapi/ontology/input/entities/contact => Ontology/Input/Entities/Contact}/EmailAddressFactory.php (100%) rename src/{org/nameapi/ontology/input/entities/contact => Ontology/Input/Entities/Contact}/TelNumber.php (100%) rename src/{org/nameapi/ontology/input/entities/contact => Ontology/Input/Entities/Contact}/TelNumberFactory.php (100%) rename src/{org/nameapi/ontology/input/entities/person/age => Ontology/Input/Entities/Person/Age}/AgeInfo.php (100%) rename src/{org/nameapi/ontology/input/entities/person/age => Ontology/Input/Entities/Person/Age}/AgeInfoFactory.php (100%) rename src/{org/nameapi/ontology/input/entities/person/age => Ontology/Input/Entities/Person/Age}/BirthDate.php (100%) rename src/{org/nameapi/ontology/input/entities/person/age => Ontology/Input/Entities/Person/Age}/BirthYear.php (100%) rename src/{org/nameapi/ontology/input/entities/person/age => Ontology/Input/Entities/Person/Age}/BirthYearRange.php (100%) rename src/{org/nameapi/ontology/input/entities/person/age => Ontology/Input/Entities/Person/Age}/YearRange.php (100%) rename src/{org/nameapi/ontology/input/entities/person/gender => Ontology/Input/Entities/Person/Gender}/ComputedPersonGender.php (100%) rename src/{org/nameapi/ontology/input/entities/person/gender => Ontology/Input/Entities/Person/Gender}/StoragePersonGender.php (100%) rename src/{org/nameapi/ontology/input/entities/person => Ontology/Input/Entities/Person}/MaritalStatus.php (100%) rename src/{org/nameapi/ontology/input/entities/person/name/builder => Ontology/Input/Entities/Person/Name/Builder}/AmericanInputPersonNameBuilder.php (100%) rename src/{org/nameapi/ontology/input/entities/person/name/builder => Ontology/Input/Entities/Person/Name/Builder}/InputPersonNameBuilder.php (100%) rename src/{org/nameapi/ontology/input/entities/person/name/builder => Ontology/Input/Entities/Person/Name/Builder}/WesternInputPersonNameBuilder.php (100%) rename src/{org/nameapi/ontology/input/entities/person/name => Ontology/Input/Entities/Person/Name}/InputPersonName.php (100%) rename src/{org/nameapi/ontology/input/entities/person/name => Ontology/Input/Entities/Person/Name}/NameField.php (100%) rename src/{org/nameapi/ontology/input/entities/person/name/types => Ontology/Input/Entities/Person/Name/Types}/AmericanNameFieldType.php (100%) rename src/{org/nameapi/ontology/input/entities/person/name/types => Ontology/Input/Entities/Person/Name/Types}/CommonNameFieldType.php (100%) rename src/{org/nameapi/ontology/input/entities/person => Ontology/Input/Entities/Person}/NaturalInputPerson.php (100%) rename src/{org/nameapi/ontology/input/entities/person => Ontology/Input/Entities/Person}/NaturalInputPersonBuilder.php (100%) rename src/{org/nameapi/ontology/input/entities/person => Ontology/Input/Entities/Person}/PersonRole.php (100%) rename src/{org/nameapi/ontology/input/entities/person => Ontology/Input/Entities/Person}/PersonType.php (100%) diff --git a/composer.json b/composer.json index 3b2ca22..faa54fb 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ }, "autoload": { "psr-4": { - "Org\\": "src/Org" + "Org\\NameApi\\": "src" } }, "autoload-dev": { diff --git a/src/org/nameapi/client/fault/Blame.php b/src/Client/Fault/Blame.php similarity index 100% rename from src/org/nameapi/client/fault/Blame.php rename to src/Client/Fault/Blame.php diff --git a/src/org/nameapi/client/fault/FaultInfo.php b/src/Client/Fault/FaultInfo.php similarity index 100% rename from src/org/nameapi/client/fault/FaultInfo.php rename to src/Client/Fault/FaultInfo.php diff --git a/src/org/nameapi/client/fault/FaultInfoUnmarshaller.php b/src/Client/Fault/FaultInfoUnmarshaller.php similarity index 100% rename from src/org/nameapi/client/fault/FaultInfoUnmarshaller.php rename to src/Client/Fault/FaultInfoUnmarshaller.php diff --git a/src/org/nameapi/client/fault/Retry.php b/src/Client/Fault/Retry.php similarity index 100% rename from src/org/nameapi/client/fault/Retry.php rename to src/Client/Fault/Retry.php diff --git a/src/org/nameapi/client/fault/RetryType.php b/src/Client/Fault/RetryType.php similarity index 100% rename from src/org/nameapi/client/fault/RetryType.php rename to src/Client/Fault/RetryType.php diff --git a/src/org/nameapi/client/fault/ServiceException.php b/src/Client/Fault/ServiceException.php similarity index 100% rename from src/org/nameapi/client/fault/ServiceException.php rename to src/Client/Fault/ServiceException.php diff --git a/src/org/nameapi/client/http/HttpResponseData.php b/src/Client/Http/HttpResponseData.php similarity index 100% rename from src/org/nameapi/client/http/HttpResponseData.php rename to src/Client/Http/HttpResponseData.php diff --git a/src/org/nameapi/client/http/RestHttpClient.php b/src/Client/Http/RestHttpClient.php similarity index 100% rename from src/org/nameapi/client/http/RestHttpClient.php rename to src/Client/Http/RestHttpClient.php diff --git a/src/org/nameapi/client/http/RestHttpClientConfig.php b/src/Client/Http/RestHttpClientConfig.php similarity index 100% rename from src/org/nameapi/client/http/RestHttpClientConfig.php rename to src/Client/Http/RestHttpClientConfig.php diff --git a/src/org/nameapi/client/services/BaseService.php b/src/Client/Services/BaseService.php similarity index 100% rename from src/org/nameapi/client/services/BaseService.php rename to src/Client/Services/BaseService.php diff --git a/src/org/nameapi/client/services/development/DevelopmentServiceFactory.php b/src/Client/Services/Development/DevelopmentServiceFactory.php similarity index 100% rename from src/org/nameapi/client/services/development/DevelopmentServiceFactory.php rename to src/Client/Services/Development/DevelopmentServiceFactory.php diff --git a/src/org/nameapi/client/services/development/exceptionthrower/ExceptionThrowerService.php b/src/Client/Services/Development/ExceptionThrower/ExceptionThrowerService.php similarity index 100% rename from src/org/nameapi/client/services/development/exceptionthrower/ExceptionThrowerService.php rename to src/Client/Services/Development/ExceptionThrower/ExceptionThrowerService.php diff --git a/src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorResult.php b/src/Client/Services/Email/DisposableEmailAddressDetector/DisposableEmailAddressDetectorResult.php similarity index 100% rename from src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorResult.php rename to src/Client/Services/Email/DisposableEmailAddressDetector/DisposableEmailAddressDetectorResult.php diff --git a/src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorService.php b/src/Client/Services/Email/DisposableEmailAddressDetector/DisposableEmailAddressDetectorService.php similarity index 100% rename from src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorService.php rename to src/Client/Services/Email/DisposableEmailAddressDetector/DisposableEmailAddressDetectorService.php diff --git a/src/org/nameapi/client/services/email/disposableemailaddressdetector/Maybe.php b/src/Client/Services/Email/DisposableEmailAddressDetector/Maybe.php similarity index 100% rename from src/org/nameapi/client/services/email/disposableemailaddressdetector/Maybe.php rename to src/Client/Services/Email/DisposableEmailAddressDetector/Maybe.php diff --git a/src/org/nameapi/client/services/email/emailnameparser/EmailAddressNameType.php b/src/Client/Services/Email/EmailNameParser/EmailAddressNameType.php similarity index 100% rename from src/org/nameapi/client/services/email/emailnameparser/EmailAddressNameType.php rename to src/Client/Services/Email/EmailNameParser/EmailAddressNameType.php diff --git a/src/org/nameapi/client/services/email/emailnameparser/EmailAddressParsingResultType.php b/src/Client/Services/Email/EmailNameParser/EmailAddressParsingResultType.php similarity index 100% rename from src/org/nameapi/client/services/email/emailnameparser/EmailAddressParsingResultType.php rename to src/Client/Services/Email/EmailNameParser/EmailAddressParsingResultType.php diff --git a/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserMatch.php b/src/Client/Services/Email/EmailNameParser/EmailNameParserMatch.php similarity index 100% rename from src/org/nameapi/client/services/email/emailnameparser/EmailNameParserMatch.php rename to src/Client/Services/Email/EmailNameParser/EmailNameParserMatch.php diff --git a/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserResult.php b/src/Client/Services/Email/EmailNameParser/EmailNameParserResult.php similarity index 100% rename from src/org/nameapi/client/services/email/emailnameparser/EmailNameParserResult.php rename to src/Client/Services/Email/EmailNameParser/EmailNameParserResult.php diff --git a/src/org/nameapi/client/services/email/emailnameparser/EmailNameParserService.php b/src/Client/Services/Email/EmailNameParser/EmailNameParserService.php similarity index 100% rename from src/org/nameapi/client/services/email/emailnameparser/EmailNameParserService.php rename to src/Client/Services/Email/EmailNameParser/EmailNameParserService.php diff --git a/src/org/nameapi/client/services/email/emailnameparser/NameFromEmailAddress.php b/src/Client/Services/Email/EmailNameParser/NameFromEmailAddress.php similarity index 100% rename from src/org/nameapi/client/services/email/emailnameparser/NameFromEmailAddress.php rename to src/Client/Services/Email/EmailNameParser/NameFromEmailAddress.php diff --git a/src/org/nameapi/client/services/email/EmailServiceFactory.php b/src/Client/Services/Email/EmailServiceFactory.php similarity index 100% rename from src/org/nameapi/client/services/email/EmailServiceFactory.php rename to src/Client/Services/Email/EmailServiceFactory.php diff --git a/src/org/nameapi/client/services/formatter/FormatterProperties.php b/src/Client/Services/Formatter/FormatterProperties.php similarity index 100% rename from src/org/nameapi/client/services/formatter/FormatterProperties.php rename to src/Client/Services/Formatter/FormatterProperties.php diff --git a/src/org/nameapi/client/services/formatter/FormatterResult.php b/src/Client/Services/Formatter/FormatterResult.php similarity index 100% rename from src/org/nameapi/client/services/formatter/FormatterResult.php rename to src/Client/Services/Formatter/FormatterResult.php diff --git a/src/org/nameapi/client/services/formatter/FormatterServiceFactory.php b/src/Client/Services/Formatter/FormatterServiceFactory.php similarity index 100% rename from src/org/nameapi/client/services/formatter/FormatterServiceFactory.php rename to src/Client/Services/Formatter/FormatterServiceFactory.php diff --git a/src/org/nameapi/client/services/formatter/namefieldformatter/NameFieldFormatterService.php b/src/Client/Services/Formatter/NameFieldFormatter/NameFieldFormatterService.php similarity index 100% rename from src/org/nameapi/client/services/formatter/namefieldformatter/NameFieldFormatterService.php rename to src/Client/Services/Formatter/NameFieldFormatter/NameFieldFormatterService.php diff --git a/src/org/nameapi/client/services/formatter/personnameformatter/PersonNameFormatterService.php b/src/Client/Services/Formatter/PersonNameFormatter/PersonNameFormatterService.php similarity index 100% rename from src/org/nameapi/client/services/formatter/personnameformatter/PersonNameFormatterService.php rename to src/Client/Services/Formatter/PersonNameFormatter/PersonNameFormatterService.php diff --git a/src/org/nameapi/client/services/genderizer/GenderizerServiceFactory.php b/src/Client/Services/Genderizer/GenderizerServiceFactory.php similarity index 100% rename from src/org/nameapi/client/services/genderizer/GenderizerServiceFactory.php rename to src/Client/Services/Genderizer/GenderizerServiceFactory.php diff --git a/src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderResult.php b/src/Client/Services/Genderizer/PersonGenderizer/PersonGenderResult.php similarity index 100% rename from src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderResult.php rename to src/Client/Services/Genderizer/PersonGenderizer/PersonGenderResult.php diff --git a/src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderizerService.php b/src/Client/Services/Genderizer/PersonGenderizer/PersonGenderizerService.php similarity index 100% rename from src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderizerService.php rename to src/Client/Services/Genderizer/PersonGenderizer/PersonGenderizerService.php diff --git a/src/org/nameapi/client/services/Host.php b/src/Client/Services/Host.php similarity index 100% rename from src/org/nameapi/client/services/Host.php rename to src/Client/Services/Host.php diff --git a/src/org/nameapi/client/services/matcher/AgeMatchType.php b/src/Client/Services/Matcher/AgeMatchType.php similarity index 100% rename from src/org/nameapi/client/services/matcher/AgeMatchType.php rename to src/Client/Services/Matcher/AgeMatchType.php diff --git a/src/org/nameapi/client/services/matcher/AgeMatcherResult.php b/src/Client/Services/Matcher/AgeMatcherResult.php similarity index 100% rename from src/org/nameapi/client/services/matcher/AgeMatcherResult.php rename to src/Client/Services/Matcher/AgeMatcherResult.php diff --git a/src/org/nameapi/client/services/matcher/GenderMatchType.php b/src/Client/Services/Matcher/GenderMatchType.php similarity index 100% rename from src/org/nameapi/client/services/matcher/GenderMatchType.php rename to src/Client/Services/Matcher/GenderMatchType.php diff --git a/src/org/nameapi/client/services/matcher/GenderMatcherResult.php b/src/Client/Services/Matcher/GenderMatcherResult.php similarity index 100% rename from src/org/nameapi/client/services/matcher/GenderMatcherResult.php rename to src/Client/Services/Matcher/GenderMatcherResult.php diff --git a/src/org/nameapi/client/services/matcher/MatcherServiceFactory.php b/src/Client/Services/Matcher/MatcherServiceFactory.php similarity index 100% rename from src/org/nameapi/client/services/matcher/MatcherServiceFactory.php rename to src/Client/Services/Matcher/MatcherServiceFactory.php diff --git a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatchComposition.php b/src/Client/Services/Matcher/PersonMatcher/PersonMatchComposition.php similarity index 100% rename from src/org/nameapi/client/services/matcher/personmatcher/PersonMatchComposition.php rename to src/Client/Services/Matcher/PersonMatcher/PersonMatchComposition.php diff --git a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatchType.php b/src/Client/Services/Matcher/PersonMatcher/PersonMatchType.php similarity index 100% rename from src/org/nameapi/client/services/matcher/personmatcher/PersonMatchType.php rename to src/Client/Services/Matcher/PersonMatcher/PersonMatchType.php diff --git a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherResult.php b/src/Client/Services/Matcher/PersonMatcher/PersonMatcherResult.php similarity index 100% rename from src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherResult.php rename to src/Client/Services/Matcher/PersonMatcher/PersonMatcherResult.php diff --git a/src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherService.php b/src/Client/Services/Matcher/PersonMatcher/PersonMatcherService.php similarity index 100% rename from src/org/nameapi/client/services/matcher/personmatcher/PersonMatcherService.php rename to src/Client/Services/Matcher/PersonMatcher/PersonMatcherService.php diff --git a/src/org/nameapi/client/services/matcher/PersonNameMatchType.php b/src/Client/Services/Matcher/PersonNameMatchType.php similarity index 100% rename from src/org/nameapi/client/services/matcher/PersonNameMatchType.php rename to src/Client/Services/Matcher/PersonNameMatchType.php diff --git a/src/org/nameapi/client/services/matcher/PersonNameMatcherResult.php b/src/Client/Services/Matcher/PersonNameMatcherResult.php similarity index 100% rename from src/org/nameapi/client/services/matcher/PersonNameMatcherResult.php rename to src/Client/Services/Matcher/PersonNameMatcherResult.php diff --git a/src/org/nameapi/client/services/parser/OutputPersonName.php b/src/Client/Services/Parser/OutputPersonName.php similarity index 100% rename from src/org/nameapi/client/services/parser/OutputPersonName.php rename to src/Client/Services/Parser/OutputPersonName.php diff --git a/src/org/nameapi/client/services/parser/OutputTermType.php b/src/Client/Services/Parser/OutputTermType.php similarity index 100% rename from src/org/nameapi/client/services/parser/OutputTermType.php rename to src/Client/Services/Parser/OutputTermType.php diff --git a/src/org/nameapi/client/services/parser/ParserServiceFactory.php b/src/Client/Services/Parser/ParserServiceFactory.php similarity index 100% rename from src/org/nameapi/client/services/parser/ParserServiceFactory.php rename to src/Client/Services/Parser/ParserServiceFactory.php diff --git a/src/org/nameapi/client/services/parser/personnameparser/DisputeType.php b/src/Client/Services/Parser/PersonNameParser/DisputeType.php similarity index 100% rename from src/org/nameapi/client/services/parser/personnameparser/DisputeType.php rename to src/Client/Services/Parser/PersonNameParser/DisputeType.php diff --git a/src/org/nameapi/client/services/parser/personnameparser/ParsedPerson.php b/src/Client/Services/Parser/PersonNameParser/ParsedPerson.php similarity index 100% rename from src/org/nameapi/client/services/parser/personnameparser/ParsedPerson.php rename to src/Client/Services/Parser/PersonNameParser/ParsedPerson.php diff --git a/src/org/nameapi/client/services/parser/personnameparser/ParsedPersonMatch.php b/src/Client/Services/Parser/PersonNameParser/ParsedPersonMatch.php similarity index 100% rename from src/org/nameapi/client/services/parser/personnameparser/ParsedPersonMatch.php rename to src/Client/Services/Parser/PersonNameParser/ParsedPersonMatch.php diff --git a/src/org/nameapi/client/services/parser/personnameparser/ParserDispute.php b/src/Client/Services/Parser/PersonNameParser/ParserDispute.php similarity index 100% rename from src/org/nameapi/client/services/parser/personnameparser/ParserDispute.php rename to src/Client/Services/Parser/PersonNameParser/ParserDispute.php diff --git a/src/org/nameapi/client/services/parser/personnameparser/PersonNameParserResult.php b/src/Client/Services/Parser/PersonNameParser/PersonNameParserResult.php similarity index 100% rename from src/org/nameapi/client/services/parser/personnameparser/PersonNameParserResult.php rename to src/Client/Services/Parser/PersonNameParser/PersonNameParserResult.php diff --git a/src/org/nameapi/client/services/parser/personnameparser/PersonNameParserService.php b/src/Client/Services/Parser/PersonNameParser/PersonNameParserService.php similarity index 100% rename from src/org/nameapi/client/services/parser/personnameparser/PersonNameParserService.php rename to src/Client/Services/Parser/PersonNameParser/PersonNameParserService.php diff --git a/src/org/nameapi/client/services/parser/Term.php b/src/Client/Services/Parser/Term.php similarity index 100% rename from src/org/nameapi/client/services/parser/Term.php rename to src/Client/Services/Parser/Term.php diff --git a/src/org/nameapi/client/services/riskdetector/DataItem.php b/src/Client/Services/RiskDetector/DataItem.php similarity index 100% rename from src/org/nameapi/client/services/riskdetector/DataItem.php rename to src/Client/Services/RiskDetector/DataItem.php diff --git a/src/org/nameapi/client/services/riskdetector/DetectedRisk.php b/src/Client/Services/RiskDetector/DetectedRisk.php similarity index 100% rename from src/org/nameapi/client/services/riskdetector/DetectedRisk.php rename to src/Client/Services/RiskDetector/DetectedRisk.php diff --git a/src/org/nameapi/client/services/riskdetector/DisguiseRiskType.php b/src/Client/Services/RiskDetector/DisguiseRiskType.php similarity index 100% rename from src/org/nameapi/client/services/riskdetector/DisguiseRiskType.php rename to src/Client/Services/RiskDetector/DisguiseRiskType.php diff --git a/src/org/nameapi/client/services/riskdetector/FakeRiskType.php b/src/Client/Services/RiskDetector/FakeRiskType.php similarity index 100% rename from src/org/nameapi/client/services/riskdetector/FakeRiskType.php rename to src/Client/Services/RiskDetector/FakeRiskType.php diff --git a/src/org/nameapi/client/services/riskdetector/person/PersonRiskDetectorService.php b/src/Client/Services/RiskDetector/Person/PersonRiskDetectorService.php similarity index 100% rename from src/org/nameapi/client/services/riskdetector/person/PersonRiskDetectorService.php rename to src/Client/Services/RiskDetector/Person/PersonRiskDetectorService.php diff --git a/src/org/nameapi/client/services/riskdetector/RiskDetectorResult.php b/src/Client/Services/RiskDetector/RiskDetectorResult.php similarity index 100% rename from src/org/nameapi/client/services/riskdetector/RiskDetectorResult.php rename to src/Client/Services/RiskDetector/RiskDetectorResult.php diff --git a/src/org/nameapi/client/services/riskdetector/RiskDetectorServiceFactory.php b/src/Client/Services/RiskDetector/RiskDetectorServiceFactory.php similarity index 100% rename from src/org/nameapi/client/services/riskdetector/RiskDetectorServiceFactory.php rename to src/Client/Services/RiskDetector/RiskDetectorServiceFactory.php diff --git a/src/org/nameapi/client/services/riskdetector/RiskType.php b/src/Client/Services/RiskDetector/RiskType.php similarity index 100% rename from src/org/nameapi/client/services/riskdetector/RiskType.php rename to src/Client/Services/RiskDetector/RiskType.php diff --git a/src/org/nameapi/client/services/ServiceFactory.php b/src/Client/Services/ServiceFactory.php similarity index 100% rename from src/org/nameapi/client/services/ServiceFactory.php rename to src/Client/Services/ServiceFactory.php diff --git a/src/org/nameapi/client/services/system/ping/PingService.php b/src/Client/Services/System/Ping/PingService.php similarity index 100% rename from src/org/nameapi/client/services/system/ping/PingService.php rename to src/Client/Services/System/Ping/PingService.php diff --git a/src/org/nameapi/client/services/system/SystemServiceFactory.php b/src/Client/Services/System/SystemServiceFactory.php similarity index 100% rename from src/org/nameapi/client/services/system/SystemServiceFactory.php rename to src/Client/Services/System/SystemServiceFactory.php diff --git a/src/org/nameapi/ontology/input/context/Context.php b/src/Ontology/Input/Context/Context.php similarity index 100% rename from src/org/nameapi/ontology/input/context/Context.php rename to src/Ontology/Input/Context/Context.php diff --git a/src/org/nameapi/ontology/input/context/ContextBuilder.php b/src/Ontology/Input/Context/ContextBuilder.php similarity index 100% rename from src/org/nameapi/ontology/input/context/ContextBuilder.php rename to src/Ontology/Input/Context/ContextBuilder.php diff --git a/src/org/nameapi/ontology/input/context/Priority.php b/src/Ontology/Input/Context/Priority.php similarity index 100% rename from src/org/nameapi/ontology/input/context/Priority.php rename to src/Ontology/Input/Context/Priority.php diff --git a/src/org/nameapi/ontology/input/context/TextCase.php b/src/Ontology/Input/Context/TextCase.php similarity index 100% rename from src/org/nameapi/ontology/input/context/TextCase.php rename to src/Ontology/Input/Context/TextCase.php diff --git a/src/org/nameapi/ontology/input/entities/address/AddressRelation.php b/src/Ontology/Input/Entities/Address/AddressRelation.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/AddressRelation.php rename to src/Ontology/Input/Entities/Address/AddressRelation.php diff --git a/src/org/nameapi/ontology/input/entities/address/AddressUsage.php b/src/Ontology/Input/Entities/Address/AddressUsage.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/AddressUsage.php rename to src/Ontology/Input/Entities/Address/AddressUsage.php diff --git a/src/org/nameapi/ontology/input/entities/address/InputAddress.php b/src/Ontology/Input/Entities/Address/InputAddress.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/InputAddress.php rename to src/Ontology/Input/Entities/Address/InputAddress.php diff --git a/src/org/nameapi/ontology/input/entities/address/PlaceInfo.php b/src/Ontology/Input/Entities/Address/PlaceInfo.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/PlaceInfo.php rename to src/Ontology/Input/Entities/Address/PlaceInfo.php diff --git a/src/org/nameapi/ontology/input/entities/address/StreetInfo.php b/src/Ontology/Input/Entities/Address/StreetInfo.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/StreetInfo.php rename to src/Ontology/Input/Entities/Address/StreetInfo.php diff --git a/src/org/nameapi/ontology/input/entities/address/StructuredAddress.php b/src/Ontology/Input/Entities/Address/StructuredAddress.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/StructuredAddress.php rename to src/Ontology/Input/Entities/Address/StructuredAddress.php diff --git a/src/org/nameapi/ontology/input/entities/address/StructuredAddressBuilder.php b/src/Ontology/Input/Entities/Address/StructuredAddressBuilder.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/StructuredAddressBuilder.php rename to src/Ontology/Input/Entities/Address/StructuredAddressBuilder.php diff --git a/src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfo.php b/src/Ontology/Input/Entities/Address/StructuredPlaceInfo.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfo.php rename to src/Ontology/Input/Entities/Address/StructuredPlaceInfo.php diff --git a/src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfoBuilder.php b/src/Ontology/Input/Entities/Address/StructuredPlaceInfoBuilder.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/StructuredPlaceInfoBuilder.php rename to src/Ontology/Input/Entities/Address/StructuredPlaceInfoBuilder.php diff --git a/src/org/nameapi/ontology/input/entities/address/StructuredStreetInfo.php b/src/Ontology/Input/Entities/Address/StructuredStreetInfo.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/StructuredStreetInfo.php rename to src/Ontology/Input/Entities/Address/StructuredStreetInfo.php diff --git a/src/org/nameapi/ontology/input/entities/address/StructuredStreetInfoBuilder.php b/src/Ontology/Input/Entities/Address/StructuredStreetInfoBuilder.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/StructuredStreetInfoBuilder.php rename to src/Ontology/Input/Entities/Address/StructuredStreetInfoBuilder.php diff --git a/src/org/nameapi/ontology/input/entities/address/UseForAllAddressRelation.php b/src/Ontology/Input/Entities/Address/UseForAllAddressRelation.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/address/UseForAllAddressRelation.php rename to src/Ontology/Input/Entities/Address/UseForAllAddressRelation.php diff --git a/src/org/nameapi/ontology/input/entities/contact/EmailAddress.php b/src/Ontology/Input/Entities/Contact/EmailAddress.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/contact/EmailAddress.php rename to src/Ontology/Input/Entities/Contact/EmailAddress.php diff --git a/src/org/nameapi/ontology/input/entities/contact/EmailAddressFactory.php b/src/Ontology/Input/Entities/Contact/EmailAddressFactory.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/contact/EmailAddressFactory.php rename to src/Ontology/Input/Entities/Contact/EmailAddressFactory.php diff --git a/src/org/nameapi/ontology/input/entities/contact/TelNumber.php b/src/Ontology/Input/Entities/Contact/TelNumber.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/contact/TelNumber.php rename to src/Ontology/Input/Entities/Contact/TelNumber.php diff --git a/src/org/nameapi/ontology/input/entities/contact/TelNumberFactory.php b/src/Ontology/Input/Entities/Contact/TelNumberFactory.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/contact/TelNumberFactory.php rename to src/Ontology/Input/Entities/Contact/TelNumberFactory.php diff --git a/src/org/nameapi/ontology/input/entities/person/age/AgeInfo.php b/src/Ontology/Input/Entities/Person/Age/AgeInfo.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/age/AgeInfo.php rename to src/Ontology/Input/Entities/Person/Age/AgeInfo.php diff --git a/src/org/nameapi/ontology/input/entities/person/age/AgeInfoFactory.php b/src/Ontology/Input/Entities/Person/Age/AgeInfoFactory.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/age/AgeInfoFactory.php rename to src/Ontology/Input/Entities/Person/Age/AgeInfoFactory.php diff --git a/src/org/nameapi/ontology/input/entities/person/age/BirthDate.php b/src/Ontology/Input/Entities/Person/Age/BirthDate.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/age/BirthDate.php rename to src/Ontology/Input/Entities/Person/Age/BirthDate.php diff --git a/src/org/nameapi/ontology/input/entities/person/age/BirthYear.php b/src/Ontology/Input/Entities/Person/Age/BirthYear.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/age/BirthYear.php rename to src/Ontology/Input/Entities/Person/Age/BirthYear.php diff --git a/src/org/nameapi/ontology/input/entities/person/age/BirthYearRange.php b/src/Ontology/Input/Entities/Person/Age/BirthYearRange.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/age/BirthYearRange.php rename to src/Ontology/Input/Entities/Person/Age/BirthYearRange.php diff --git a/src/org/nameapi/ontology/input/entities/person/age/YearRange.php b/src/Ontology/Input/Entities/Person/Age/YearRange.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/age/YearRange.php rename to src/Ontology/Input/Entities/Person/Age/YearRange.php diff --git a/src/org/nameapi/ontology/input/entities/person/gender/ComputedPersonGender.php b/src/Ontology/Input/Entities/Person/Gender/ComputedPersonGender.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/gender/ComputedPersonGender.php rename to src/Ontology/Input/Entities/Person/Gender/ComputedPersonGender.php diff --git a/src/org/nameapi/ontology/input/entities/person/gender/StoragePersonGender.php b/src/Ontology/Input/Entities/Person/Gender/StoragePersonGender.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/gender/StoragePersonGender.php rename to src/Ontology/Input/Entities/Person/Gender/StoragePersonGender.php diff --git a/src/org/nameapi/ontology/input/entities/person/MaritalStatus.php b/src/Ontology/Input/Entities/Person/MaritalStatus.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/MaritalStatus.php rename to src/Ontology/Input/Entities/Person/MaritalStatus.php diff --git a/src/org/nameapi/ontology/input/entities/person/name/builder/AmericanInputPersonNameBuilder.php b/src/Ontology/Input/Entities/Person/Name/Builder/AmericanInputPersonNameBuilder.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/name/builder/AmericanInputPersonNameBuilder.php rename to src/Ontology/Input/Entities/Person/Name/Builder/AmericanInputPersonNameBuilder.php diff --git a/src/org/nameapi/ontology/input/entities/person/name/builder/InputPersonNameBuilder.php b/src/Ontology/Input/Entities/Person/Name/Builder/InputPersonNameBuilder.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/name/builder/InputPersonNameBuilder.php rename to src/Ontology/Input/Entities/Person/Name/Builder/InputPersonNameBuilder.php diff --git a/src/org/nameapi/ontology/input/entities/person/name/builder/WesternInputPersonNameBuilder.php b/src/Ontology/Input/Entities/Person/Name/Builder/WesternInputPersonNameBuilder.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/name/builder/WesternInputPersonNameBuilder.php rename to src/Ontology/Input/Entities/Person/Name/Builder/WesternInputPersonNameBuilder.php diff --git a/src/org/nameapi/ontology/input/entities/person/name/InputPersonName.php b/src/Ontology/Input/Entities/Person/Name/InputPersonName.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/name/InputPersonName.php rename to src/Ontology/Input/Entities/Person/Name/InputPersonName.php diff --git a/src/org/nameapi/ontology/input/entities/person/name/NameField.php b/src/Ontology/Input/Entities/Person/Name/NameField.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/name/NameField.php rename to src/Ontology/Input/Entities/Person/Name/NameField.php diff --git a/src/org/nameapi/ontology/input/entities/person/name/types/AmericanNameFieldType.php b/src/Ontology/Input/Entities/Person/Name/Types/AmericanNameFieldType.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/name/types/AmericanNameFieldType.php rename to src/Ontology/Input/Entities/Person/Name/Types/AmericanNameFieldType.php diff --git a/src/org/nameapi/ontology/input/entities/person/name/types/CommonNameFieldType.php b/src/Ontology/Input/Entities/Person/Name/Types/CommonNameFieldType.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/name/types/CommonNameFieldType.php rename to src/Ontology/Input/Entities/Person/Name/Types/CommonNameFieldType.php diff --git a/src/org/nameapi/ontology/input/entities/person/NaturalInputPerson.php b/src/Ontology/Input/Entities/Person/NaturalInputPerson.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/NaturalInputPerson.php rename to src/Ontology/Input/Entities/Person/NaturalInputPerson.php diff --git a/src/org/nameapi/ontology/input/entities/person/NaturalInputPersonBuilder.php b/src/Ontology/Input/Entities/Person/NaturalInputPersonBuilder.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/NaturalInputPersonBuilder.php rename to src/Ontology/Input/Entities/Person/NaturalInputPersonBuilder.php diff --git a/src/org/nameapi/ontology/input/entities/person/PersonRole.php b/src/Ontology/Input/Entities/Person/PersonRole.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/PersonRole.php rename to src/Ontology/Input/Entities/Person/PersonRole.php diff --git a/src/org/nameapi/ontology/input/entities/person/PersonType.php b/src/Ontology/Input/Entities/Person/PersonType.php similarity index 100% rename from src/org/nameapi/ontology/input/entities/person/PersonType.php rename to src/Ontology/Input/Entities/Person/PersonType.php From a49230881842c1b5c495cff37f8b677485a504d5 Mon Sep 17 00:00:00 2001 From: Mark Stralka Date: Mon, 22 Mar 2021 10:00:54 -0400 Subject: [PATCH 3/9] Fixed package names --- src/Client/Services/BaseService.php | 2 +- .../Services/Development/DevelopmentServiceFactory.php | 2 +- .../ExceptionThrower/ExceptionThrowerService.php | 2 +- .../DisposableEmailAddressDetectorService.php | 2 +- .../Email/EmailNameParser/EmailNameParserService.php | 2 +- src/Client/Services/Email/EmailServiceFactory.php | 2 +- .../Services/Formatter/FormatterServiceFactory.php | 2 +- .../NameFieldFormatter/NameFieldFormatterService.php | 4 ++-- .../PersonNameFormatter/PersonNameFormatterService.php | 4 ++-- .../Services/Genderizer/GenderizerServiceFactory.php | 2 +- .../Genderizer/PersonGenderizer/PersonGenderResult.php | 2 +- .../PersonGenderizer/PersonGenderizerService.php | 6 +++--- src/Client/Services/Matcher/MatcherServiceFactory.php | 2 +- .../Matcher/PersonMatcher/PersonMatcherService.php | 4 ++-- src/Client/Services/Parser/ParserServiceFactory.php | 2 +- .../Services/Parser/PersonNameParser/ParsedPerson.php | 4 ++-- .../PersonNameParser/PersonNameParserService.php | 10 +++++----- .../RiskDetector/Person/PersonRiskDetectorService.php | 4 ++-- src/Client/Services/ServiceFactory.php | 2 +- src/Client/Services/System/Ping/PingService.php | 2 +- src/Client/Services/System/SystemServiceFactory.php | 2 +- src/Ontology/Input/Entities/Person/Name/NameField.php | 2 +- 22 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/Client/Services/BaseService.php b/src/Client/Services/BaseService.php index 16e0b76..7763f02 100644 --- a/src/Client/Services/BaseService.php +++ b/src/Client/Services/BaseService.php @@ -8,7 +8,7 @@ use Org\NameApi\Client\Fault\ServiceException; use Org\NameApi\Client\Http\RestHttpClient; use Org\NameApi\Client\Http\RestHttpClientConfig; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** * Base class for services. diff --git a/src/Client/Services/Development/DevelopmentServiceFactory.php b/src/Client/Services/Development/DevelopmentServiceFactory.php index 0afe920..4eb279c 100644 --- a/src/Client/Services/Development/DevelopmentServiceFactory.php +++ b/src/Client/Services/Development/DevelopmentServiceFactory.php @@ -3,7 +3,7 @@ namespace Org\NameApi\Client\Services\Development; use Org\NameApi\Client\Services\Development\ExceptionThrower\ExceptionThrowerService; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** * Provides access to the system-related services. diff --git a/src/Client/Services/Development/ExceptionThrower/ExceptionThrowerService.php b/src/Client/Services/Development/ExceptionThrower/ExceptionThrowerService.php index 5b46f44..f82257c 100644 --- a/src/Client/Services/Development/ExceptionThrower/ExceptionThrowerService.php +++ b/src/Client/Services/Development/ExceptionThrower/ExceptionThrowerService.php @@ -4,7 +4,7 @@ use Org\NameApi\Client\Fault\ServiceException; use Org\NameApi\Client\Services\BaseService; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** diff --git a/src/Client/Services/Email/DisposableEmailAddressDetector/DisposableEmailAddressDetectorService.php b/src/Client/Services/Email/DisposableEmailAddressDetector/DisposableEmailAddressDetectorService.php index 2495cb6..c6aa515 100644 --- a/src/Client/Services/Email/DisposableEmailAddressDetector/DisposableEmailAddressDetectorService.php +++ b/src/Client/Services/Email/DisposableEmailAddressDetector/DisposableEmailAddressDetectorService.php @@ -4,7 +4,7 @@ use Org\NameApi\Client\Fault\ServiceException; use Org\NameApi\Client\Services\BaseService; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** * This is the service class for the web service offered at diff --git a/src/Client/Services/Email/EmailNameParser/EmailNameParserService.php b/src/Client/Services/Email/EmailNameParser/EmailNameParserService.php index e8cc7b6..228d5cf 100644 --- a/src/Client/Services/Email/EmailNameParser/EmailNameParserService.php +++ b/src/Client/Services/Email/EmailNameParser/EmailNameParserService.php @@ -4,7 +4,7 @@ use Org\NameApi\Client\Fault\ServiceException; use Org\NameApi\Client\Services\BaseService; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** * This is the service class for the web service offered at diff --git a/src/Client/Services/Email/EmailServiceFactory.php b/src/Client/Services/Email/EmailServiceFactory.php index cd16067..7a477da 100644 --- a/src/Client/Services/Email/EmailServiceFactory.php +++ b/src/Client/Services/Email/EmailServiceFactory.php @@ -4,7 +4,7 @@ use Org\NameApi\Client\Services\Email\DisposableEmailAddressDetector\DisposableEmailAddressDetectorService; use Org\NameApi\Client\Services\Email\EmailNameParser\EmailNameParserService; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** * Provides access to the email-related services. diff --git a/src/Client/Services/Formatter/FormatterServiceFactory.php b/src/Client/Services/Formatter/FormatterServiceFactory.php index 6e8ed5f..d55001f 100644 --- a/src/Client/Services/Formatter/FormatterServiceFactory.php +++ b/src/Client/Services/Formatter/FormatterServiceFactory.php @@ -4,7 +4,7 @@ use Org\NameApi\Client\Services\Formatter\NameFieldFormatter\NameFieldFormatterService; use Org\NameApi\Client\Services\Formatter\PersonNameFormatter\PersonNameFormatterService; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** * Provides access to the formatter-related services. diff --git a/src/Client/Services/Formatter/NameFieldFormatter/NameFieldFormatterService.php b/src/Client/Services/Formatter/NameFieldFormatter/NameFieldFormatterService.php index b989e61..068c75c 100644 --- a/src/Client/Services/Formatter/NameFieldFormatter/NameFieldFormatterService.php +++ b/src/Client/Services/Formatter/NameFieldFormatter/NameFieldFormatterService.php @@ -5,8 +5,8 @@ use Org\NameApi\Client\Services\BaseService; use Org\NameApi\Client\Services\Formatter\FormatterProperties; use Org\NameApi\Client\Services\Formatter\FormatterResult; -use Org\NameApi\ontology\input\Context\Context; -use Org\NameApi\ontology\input\entities\person\Name\NameField; +use Org\NameApi\Ontology\Input\Context\Context; +use Org\NameApi\Ontology\Input\Entities\Person\Name\NameField; /** diff --git a/src/Client/Services/Formatter/PersonNameFormatter/PersonNameFormatterService.php b/src/Client/Services/Formatter/PersonNameFormatter/PersonNameFormatterService.php index 0a72d2b..95c8c2e 100644 --- a/src/Client/Services/Formatter/PersonNameFormatter/PersonNameFormatterService.php +++ b/src/Client/Services/Formatter/PersonNameFormatter/PersonNameFormatterService.php @@ -6,8 +6,8 @@ use Org\NameApi\Client\Services\BaseService; use Org\NameApi\Client\Services\Formatter\FormatterProperties; use Org\NameApi\Client\Services\Formatter\FormatterResult; -use Org\NameApi\ontology\input\Context\Context; -use Org\NameApi\ontology\input\entities\person\NaturalInputPerson; +use Org\NameApi\Ontology\Input\Context\Context; +use Org\NameApi\Ontology\Input\Entities\Person\NaturalInputPerson; /** * This is the service class for the web service offered at diff --git a/src/Client/Services/Genderizer/GenderizerServiceFactory.php b/src/Client/Services/Genderizer/GenderizerServiceFactory.php index 806d52a..514d99c 100644 --- a/src/Client/Services/Genderizer/GenderizerServiceFactory.php +++ b/src/Client/Services/Genderizer/GenderizerServiceFactory.php @@ -2,7 +2,7 @@ namespace Org\NameApi\Client\Services\Genderizer; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** * Provides access to the genderizer-related services. diff --git a/src/Client/Services/Genderizer/PersonGenderizer/PersonGenderResult.php b/src/Client/Services/Genderizer/PersonGenderizer/PersonGenderResult.php index 107117c..5c25693 100644 --- a/src/Client/Services/Genderizer/PersonGenderizer/PersonGenderResult.php +++ b/src/Client/Services/Genderizer/PersonGenderizer/PersonGenderResult.php @@ -2,7 +2,7 @@ namespace Org\NameApi\Client\Services\Genderizer\PersonGenderizer; -use Org\NameApi\ontology\input\entities\person\gender\ComputedPersonGender; +use Org\NameApi\Ontology\Input\Entities\Person\Gender\ComputedPersonGender; class PersonGenderResult { diff --git a/src/Client/Services/Genderizer/PersonGenderizer/PersonGenderizerService.php b/src/Client/Services/Genderizer/PersonGenderizer/PersonGenderizerService.php index 1e1fcff..1eacb52 100644 --- a/src/Client/Services/Genderizer/PersonGenderizer/PersonGenderizerService.php +++ b/src/Client/Services/Genderizer/PersonGenderizer/PersonGenderizerService.php @@ -4,9 +4,9 @@ use Org\NameApi\Client\Fault\ServiceException; use Org\NameApi\Client\Services\BaseService; -use Org\NameApi\ontology\input\Context\Context; -use Org\NameApi\ontology\input\entities\person\gender\ComputedPersonGender; -use Org\NameApi\ontology\input\entities\person\NaturalInputPerson; +use Org\NameApi\Ontology\Input\Context\Context; +use Org\NameApi\Ontology\Input\Entities\Person\Gender\ComputedPersonGender; +use Org\NameApi\Ontology\Input\Entities\Person\NaturalInputPerson; /** * This is the service class for the web service offered at diff --git a/src/Client/Services/Matcher/MatcherServiceFactory.php b/src/Client/Services/Matcher/MatcherServiceFactory.php index c53ac44..bd3d60f 100644 --- a/src/Client/Services/Matcher/MatcherServiceFactory.php +++ b/src/Client/Services/Matcher/MatcherServiceFactory.php @@ -2,7 +2,7 @@ namespace Org\NameApi\Client\Services\Matcher; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** * Provides access to the matcher-related services. diff --git a/src/Client/Services/Matcher/PersonMatcher/PersonMatcherService.php b/src/Client/Services/Matcher/PersonMatcher/PersonMatcherService.php index 46ca151..fdcc320 100644 --- a/src/Client/Services/Matcher/PersonMatcher/PersonMatcherService.php +++ b/src/Client/Services/Matcher/PersonMatcher/PersonMatcherService.php @@ -10,8 +10,8 @@ use Org\NameApi\Client\Services\Matcher\GenderMatchType; use Org\NameApi\Client\Services\Matcher\PersonNameMatcherResult; use Org\NameApi\Client\Services\Matcher\PersonNameMatchType; -use Org\NameApi\ontology\input\Context\Context; -use Org\NameApi\ontology\input\entities\person\NaturalInputPerson; +use Org\NameApi\Ontology\Input\Context\Context; +use Org\NameApi\Ontology\Input\Entities\Person\NaturalInputPerson; /** * This is the service class for the web service offered at diff --git a/src/Client/Services/Parser/ParserServiceFactory.php b/src/Client/Services/Parser/ParserServiceFactory.php index 7cf4e94..fe0e249 100644 --- a/src/Client/Services/Parser/ParserServiceFactory.php +++ b/src/Client/Services/Parser/ParserServiceFactory.php @@ -2,7 +2,7 @@ namespace Org\NameApi\Client\Services\Parser; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** * Provides access to the parser-related services. diff --git a/src/Client/Services/Parser/PersonNameParser/ParsedPerson.php b/src/Client/Services/Parser/PersonNameParser/ParsedPerson.php index b5fcef1..fb2eaee 100644 --- a/src/Client/Services/Parser/PersonNameParser/ParsedPerson.php +++ b/src/Client/Services/Parser/PersonNameParser/ParsedPerson.php @@ -4,8 +4,8 @@ use Org\NameApi\Client\Services\Genderizer\PersonGenderizer\PersonGenderResult; use Org\NameApi\Client\Services\Parser\OutputPersonName; -use Org\NameApi\ontology\input\entities\person\PersonRole; -use Org\NameApi\ontology\input\entities\person\PersonType; +use Org\NameApi\Ontology\Input\Entities\Person\PersonRole; +use Org\NameApi\Ontology\Input\Entities\Person\PersonType; class ParsedPerson diff --git a/src/Client/Services/Parser/PersonNameParser/PersonNameParserService.php b/src/Client/Services/Parser/PersonNameParser/PersonNameParserService.php index 80f905b..3cb40f6 100644 --- a/src/Client/Services/Parser/PersonNameParser/PersonNameParserService.php +++ b/src/Client/Services/Parser/PersonNameParser/PersonNameParserService.php @@ -8,11 +8,11 @@ use Org\NameApi\Client\Services\Parser\OutputPersonName; use Org\NameApi\Client\Services\Parser\OutputTermType; use Org\NameApi\Client\Services\Parser\Term; -use Org\NameApi\ontology\input\Context\Context; -use Org\NameApi\ontology\input\entities\person\gender\ComputedPersonGender; -use Org\NameApi\ontology\input\entities\person\NaturalInputPerson; -use Org\NameApi\ontology\input\entities\person\PersonRole; -use Org\NameApi\ontology\input\entities\person\PersonType; +use Org\NameApi\Ontology\Input\Context\Context; +use Org\NameApi\Ontology\Input\Entities\Person\Gender\ComputedPersonGender; +use Org\NameApi\Ontology\Input\Entities\Person\NaturalInputPerson; +use Org\NameApi\Ontology\Input\Entities\Person\PersonRole; +use Org\NameApi\Ontology\Input\Entities\Person\PersonType; /** diff --git a/src/Client/Services/RiskDetector/Person/PersonRiskDetectorService.php b/src/Client/Services/RiskDetector/Person/PersonRiskDetectorService.php index 937cc6c..0214008 100644 --- a/src/Client/Services/RiskDetector/Person/PersonRiskDetectorService.php +++ b/src/Client/Services/RiskDetector/Person/PersonRiskDetectorService.php @@ -9,8 +9,8 @@ use Org\NameApi\Client\Services\RiskDetector\DisguiseRiskType; use Org\NameApi\Client\Services\RiskDetector\FakeRiskType; use Org\NameApi\Client\Services\RiskDetector\RiskDetectorResult; -use Org\NameApi\ontology\input\Context\Context; -use Org\NameApi\ontology\input\entities\person\NaturalInputPerson; +use Org\NameApi\Ontology\Input\Context\Context; +use Org\NameApi\Ontology\Input\Entities\Person\NaturalInputPerson; /** diff --git a/src/Client/Services/ServiceFactory.php b/src/Client/Services/ServiceFactory.php index 417ed20..5e4cab3 100644 --- a/src/Client/Services/ServiceFactory.php +++ b/src/Client/Services/ServiceFactory.php @@ -2,7 +2,7 @@ namespace Org\NameApi\Client\Services; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** * diff --git a/src/Client/Services/System/Ping/PingService.php b/src/Client/Services/System/Ping/PingService.php index 6072c74..6e9956b 100644 --- a/src/Client/Services/System/Ping/PingService.php +++ b/src/Client/Services/System/Ping/PingService.php @@ -4,7 +4,7 @@ use Org\NameApi\Client\Fault\ServiceException; use Org\NameApi\Client\Services\BaseService; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** diff --git a/src/Client/Services/System/SystemServiceFactory.php b/src/Client/Services/System/SystemServiceFactory.php index 81aef43..b0ad9f0 100644 --- a/src/Client/Services/System/SystemServiceFactory.php +++ b/src/Client/Services/System/SystemServiceFactory.php @@ -3,7 +3,7 @@ namespace Org\NameApi\Client\Services\System; use Org\NameApi\Client\Services\System\Ping\PingService; -use Org\NameApi\ontology\input\Context\Context; +use Org\NameApi\Ontology\Input\Context\Context; /** * Provides access to the system-related services. diff --git a/src/Ontology/Input/Entities/Person/Name/NameField.php b/src/Ontology/Input/Entities/Person/Name/NameField.php index a466e55..2666261 100644 --- a/src/Ontology/Input/Entities/Person/Name/NameField.php +++ b/src/Ontology/Input/Entities/Person/Name/NameField.php @@ -8,7 +8,7 @@ * The content of a form field or database field, as input sent to the web service. * It contains the string value, and the field type. * - * @package Org\NameApi\Ontology\Input\Entities\Person\name + * @package Org\NameApi\Ontology\Input\Entities\Person\Name */ class NameField { From 344f2f282747737db68811834bba19e49fbfb75f Mon Sep 17 00:00:00 2001 From: Mark Stralka Date: Thu, 25 Mar 2021 11:03:34 -0400 Subject: [PATCH 4/9] MLD-2373, MLD-2365 fixed import --- src/Client/Fault/ServiceException.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Client/Fault/ServiceException.php b/src/Client/Fault/ServiceException.php index 24b6a88..a3b792a 100644 --- a/src/Client/Fault/ServiceException.php +++ b/src/Client/Fault/ServiceException.php @@ -3,6 +3,7 @@ namespace Org\NameApi\Client\Fault; use Exception; +use Org\NameApi\Client\Http\HttpResponseData; /** * This Exception, or a subtype of it, is thrown in case something did not go as planned. @@ -28,7 +29,10 @@ class ServiceException extends Exception * @param HttpResponseData $httpData * @param Exception $cause */ - public function __construct($message, FaultInfo $faultInfo = null, HttpResponseData $httpData = null, $cause = null) + public function __construct($message, + FaultInfo $faultInfo = null, + HttpResponseData $httpData = null, + $cause = null) { parent::__construct($message, 0, $cause); $this->faultInfo = $faultInfo; From 9c56c689618aa2e518666eaff01f8c37bbeb003d Mon Sep 17 00:00:00 2001 From: Mark Stralka Date: Thu, 25 Mar 2021 12:30:31 -0400 Subject: [PATCH 5/9] make the "standard" host use HTTPS --- src/Client/Services/Host.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client/Services/Host.php b/src/Client/Services/Host.php index e5d81d6..9d3fc4e 100644 --- a/src/Client/Services/Host.php +++ b/src/Client/Services/Host.php @@ -39,7 +39,7 @@ public function __construct($protocol, $hostName, $portNumber) public static function standard() { - return new Host('http', 'api.nameapi.org', 80); + return new Host('https', 'api.nameapi.org', 80); } public static function http($hostName) From e7c62dfce4a32bf3ea46f08b2d3e0de48647a7a5 Mon Sep 17 00:00:00 2001 From: Mark Stralka Date: Thu, 25 Mar 2021 12:32:38 -0400 Subject: [PATCH 6/9] make the "standard" host use HTTPS --- src/Client/Services/Host.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client/Services/Host.php b/src/Client/Services/Host.php index 9d3fc4e..ddb18f5 100644 --- a/src/Client/Services/Host.php +++ b/src/Client/Services/Host.php @@ -39,7 +39,7 @@ public function __construct($protocol, $hostName, $portNumber) public static function standard() { - return new Host('https', 'api.nameapi.org', 80); + return new Host('https', 'api.nameapi.org', 443); } public static function http($hostName) From eb0aa24cd88d949519df979bb66ec972f74a6ee1 Mon Sep 17 00:00:00 2001 From: Mark Stralka Date: Thu, 25 Mar 2021 12:41:51 -0400 Subject: [PATCH 7/9] Reverted standard to http and bumped default API version from 5.0 to 5.3 --- src/Client/Services/Host.php | 2 +- src/Client/Services/ServiceFactory.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Client/Services/Host.php b/src/Client/Services/Host.php index ddb18f5..e5d81d6 100644 --- a/src/Client/Services/Host.php +++ b/src/Client/Services/Host.php @@ -39,7 +39,7 @@ public function __construct($protocol, $hostName, $portNumber) public static function standard() { - return new Host('https', 'api.nameapi.org', 443); + return new Host('http', 'api.nameapi.org', 80); } public static function http($hostName) diff --git a/src/Client/Services/ServiceFactory.php b/src/Client/Services/ServiceFactory.php index 5e4cab3..509d37f 100644 --- a/src/Client/Services/ServiceFactory.php +++ b/src/Client/Services/ServiceFactory.php @@ -61,7 +61,7 @@ public function __construct($apiKey, Context $context, Host $host = null, $apiVe $this->host = $host; } if ($apiVersion == null) { - $this->apiVersion = '5.0'; + $this->apiVersion = '5.3'; } else { $this->apiVersion = $apiVersion; } From 97eea8525bf13780630480fe674c51cdaaa52a16 Mon Sep 17 00:00:00 2001 From: Mark Stralka Date: Wed, 30 Mar 2022 18:30:10 -0400 Subject: [PATCH 8/9] Added toArray() functions to Context and NaturalInputPerson and modified the PersonNameParserService to use these functions because the API throws a 500 exception if the payload has attributes with NULL values. --- .../PersonNameParserService.php | 4 +- src/Ontology/Input/Context/Context.php | 30 +++++-- .../Entities/Person/NaturalInputPerson.php | 86 ++++++++++++++----- 3 files changed, 91 insertions(+), 29 deletions(-) diff --git a/src/Client/Services/Parser/PersonNameParser/PersonNameParserService.php b/src/Client/Services/Parser/PersonNameParser/PersonNameParserService.php index 3cb40f6..d33464d 100644 --- a/src/Client/Services/Parser/PersonNameParser/PersonNameParserService.php +++ b/src/Client/Services/Parser/PersonNameParser/PersonNameParserService.php @@ -38,7 +38,7 @@ public function __construct($apiKey, Context $context, $baseUrl) /** - * @param NaturalInputPerson $person + * @param NaturalInputPerson $person * @return PersonNameParserResult * @throws ServiceException */ @@ -50,7 +50,7 @@ public function parse(NaturalInputPerson $person) list($response, $httpResponseData) = $this->restHttpClient->callApiPost( PersonNameParserService::$RESOURCE_PATH, $queryParams, $headerParams, - array('inputPerson' => $person, 'context' => $this->context) + array('inputPerson' => $person->toArray(), 'context' => $this->context->toArray()) ); try { diff --git a/src/Ontology/Input/Context/Context.php b/src/Ontology/Input/Context/Context.php index af39cd4..9fabcd8 100644 --- a/src/Ontology/Input/Context/Context.php +++ b/src/Ontology/Input/Context/Context.php @@ -11,17 +11,17 @@ class Context public $properties = null; /** - * @param priority $priority - * @param string $place - * @param TextCase $textCase - * @param array $properties + * @param priority $priority + * @param string $place + * @param TextCase $textCase + * @param array $properties * @access public */ public function __construct($priority, $place, $textCase, $properties) { - $this->priority = ($priority == null) ? null : (string)$priority; + $this->priority = ($priority == null) ? null : (string) $priority; $this->place = $place; - $this->textCase = ($textCase == null) ? null : (string)$textCase; + $this->textCase = ($textCase == null) ? null : (string) $textCase; $this->properties = isset($properties) ? $properties : array(); } @@ -61,4 +61,22 @@ public function getProperties() { return $this->properties; } + + public function toArray() + { + $ret = array(); + if ($this->priority) { + $ret['priority'] = $this->priority; + } + if ($this->place) { + $ret['place'] = $this->place; + } + if ($this->textCase) { + $ret['textCase'] = $this->textCase; + } + if ($this->properties) { + $ret['properties'] = $this->properties; + } + return $ret; + } } diff --git a/src/Ontology/Input/Entities/Person/NaturalInputPerson.php b/src/Ontology/Input/Entities/Person/NaturalInputPerson.php index 30a12af..0e7e96a 100644 --- a/src/Ontology/Input/Entities/Person/NaturalInputPerson.php +++ b/src/Ontology/Input/Entities/Person/NaturalInputPerson.php @@ -61,30 +61,35 @@ class NaturalInputPerson /** * Use the {@link NaturalInputPersonBuilder} to create this. * - * @param InputPersonName|null $personName - * @param storagePersonGender $gender - * @param AgeInfo|null $ageInfo - * @param MaritalStatus $maritalStatus - * @param string[]|null $nationalities - * @param string[]|null $nativeLanguages - * @param string|null $correspondenceLanguage - * @param string|null $religion - * @param AddressRelation[]|null $addresses - * @param TelNumber[]|null $telNumbers - * @param EmailAddress[]|null $emailAddresses + * @param InputPersonName|null $personName + * @param storagePersonGender $gender + * @param AgeInfo|null $ageInfo + * @param MaritalStatus $maritalStatus + * @param string[]|null $nationalities + * @param string[]|null $nativeLanguages + * @param string|null $correspondenceLanguage + * @param string|null $religion + * @param AddressRelation[]|null $addresses + * @param TelNumber[]|null $telNumbers + * @param EmailAddress[]|null $emailAddresses */ - public function __construct(InputPersonName $personName, $gender, - $ageInfo, $maritalStatus, - $nationalities, $nativeLanguages, - $correspondenceLanguage, - $religion, - $addresses, - $telNumbers, $emailAddresses) - { + public function __construct( + InputPersonName $personName, + $gender, + $ageInfo, + $maritalStatus, + $nationalities, + $nativeLanguages, + $correspondenceLanguage, + $religion, + $addresses, + $telNumbers, + $emailAddresses + ) { $this->personName = $personName; - $this->gender = ($gender != null) ? (string)$gender : null; + $this->gender = ($gender != null) ? (string) $gender : null; $this->ageInfo = $ageInfo; - $this->maritalStatus = ($maritalStatus != null) ? (string)$maritalStatus : null; + $this->maritalStatus = ($maritalStatus != null) ? (string) $maritalStatus : null; $this->nationalities = $nationalities; $this->nativeLanguages = $nativeLanguages; $this->correspondenceLanguage = $correspondenceLanguage; @@ -102,4 +107,43 @@ static function builder() return new NaturalInputPersonBuilder(); } + public function toArray() + { + $ret = array(); + $ret['type'] = $this->type; + if ($this->personName) { + $ret['personName'] = $this->personName; + } + if ($this->gender) { + $ret['gender'] = $this->gender; + } + if ($this->ageInfo) { + $ret['ageInfo'] = $this->ageInfo; + } + if ($this->maritalStatus) { + $ret['maritalStatus'] = $this->maritalStatus; + } + if ($this->nationalities) { + $ret['nationalities'] = $this->nationalities; + } + if ($this->nativeLanguages) { + $ret['nativeLanguages'] = $this->nativeLanguages; + } + if ($this->correspondenceLanguage) { + $ret['correspondenceLanguage'] = $this->correspondenceLanguage; + } + if ($this->religion) { + $ret['religion'] = $this->religion; + } + if ($this->addresses) { + $ret['addresses'] = $this->addresses; + } + if ($this->telNumbers) { + $ret['telNumbers'] = $this->telNumbers; + } + if ($this->emailAddresses) { + $ret['emailAddresses'] = $this->emailAddresses; + } + return $ret; + } } From edfdb062aff2bab08ea9e8530f36a6f9d537f037 Mon Sep 17 00:00:00 2001 From: Mark Stralka Date: Wed, 30 Mar 2022 22:56:55 -0400 Subject: [PATCH 9/9] Manually set the timeout to 10 seconds --- src/Client/Services/BaseService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Client/Services/BaseService.php b/src/Client/Services/BaseService.php index 7763f02..09ae659 100644 --- a/src/Client/Services/BaseService.php +++ b/src/Client/Services/BaseService.php @@ -36,6 +36,7 @@ public function __construct($apiKey, Context $context, $baseUrl) $configuration = new RestHttpClientConfig(); $configuration->setApiKey($apiKey); $configuration->setBaseUrl($baseUrl); + $configuration->setCurlTimeout(10); $this->restHttpClient = new RestHttpClient($configuration); }