|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace org\nameapi\client\services; |
| 4 | + |
| 5 | +use org\nameapi\ontology\input\context\Context; |
| 6 | + |
| 7 | +require_once('system/SystemServiceFactory.php'); |
| 8 | +require_once('parser/NameParserServiceFactory.php'); |
| 9 | +require_once('genderizer/GenderizerServiceFactory.php'); |
| 10 | +require_once('matcher/MatcherServiceFactory.php'); |
| 11 | +require_once('formatter/FormatterServiceFactory.php'); |
| 12 | +require_once('email/EmailServiceFactory.php'); |
| 13 | + |
| 14 | +require_once(__DIR__.'/../commonwsdl/exception/FaultBean.php'); |
| 15 | +require_once(__DIR__.'/../commonwsdl/PriceArguments.php'); |
| 16 | +require_once(__DIR__.'/../commonwsdl/PriceResponse.php'); |
| 17 | + |
| 18 | +require_once(__DIR__.'/../../ontology/input/context/Context.php'); |
| 19 | +require_once(__DIR__.'/../../ontology/input/entities/contact/EmailAddressFactory.php'); |
| 20 | +require_once(__DIR__.'/../../ontology/input/entities/contact/TelNumberFactory.php'); |
| 21 | +require_once(__DIR__.'/../../ontology/input/entities/person/NaturalInputPersonBuilder.php'); |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +/** |
| 26 | + * |
| 27 | + */ |
| 28 | +class ServiceFactory { |
| 29 | + |
| 30 | + private $context; |
| 31 | + private $systemServiceFactory; |
| 32 | + private $nameParserServiceFactory; |
| 33 | + private $genderizerServiceFactory; |
| 34 | + private $matcherServiceFactory; |
| 35 | + private $formatterServiceFactory; |
| 36 | + private $emailServiceFactory; |
| 37 | + |
| 38 | + |
| 39 | + /** |
| 40 | + */ |
| 41 | + public function __construct(Context $context) { |
| 42 | + $this->context = $context; |
| 43 | + } |
| 44 | + |
| 45 | + |
| 46 | + /** |
| 47 | + * @return system\SystemServiceFactory |
| 48 | + */ |
| 49 | + public function systemServices() { |
| 50 | + if ($this->systemServiceFactory==null) { |
| 51 | + $this->systemServiceFactory = new system\SystemServiceFactory($this->context); |
| 52 | + } |
| 53 | + return $this->systemServiceFactory; |
| 54 | + } |
| 55 | + |
| 56 | + /** |
| 57 | + * @return parser\NameParserServiceFactory |
| 58 | + */ |
| 59 | + public function nameParserServiceFactory() { |
| 60 | + if ($this->nameParserServiceFactory==null) { |
| 61 | + $this->nameParserServiceFactory = new parser\NameParserServiceFactory($this->context); |
| 62 | + } |
| 63 | + return $this->nameParserServiceFactory; |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * @return genderizer\GenderizerServiceFactory |
| 68 | + */ |
| 69 | + public function genderizerServiceFactory() { |
| 70 | + if ($this->genderizerServiceFactory==null) { |
| 71 | + $this->genderizerServiceFactory = new genderizer\GenderizerServiceFactory($this->context); |
| 72 | + } |
| 73 | + return $this->genderizerServiceFactory; |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * @return matcher\MatcherServiceFactory |
| 78 | + */ |
| 79 | + public function matcherServiceFactory() { |
| 80 | + if ($this->matcherServiceFactory==null) { |
| 81 | + $this->matcherServiceFactory = new matcher\MatcherServiceFactory($this->context); |
| 82 | + } |
| 83 | + return $this->matcherServiceFactory; |
| 84 | + } |
| 85 | + |
| 86 | + /** |
| 87 | + * @return formatter\FormatterServiceFactory |
| 88 | + */ |
| 89 | + public function formatterServiceFactory() { |
| 90 | + if ($this->formatterServiceFactory==null) { |
| 91 | + $this->formatterServiceFactory = new formatter\FormatterServiceFactory($this->context); |
| 92 | + } |
| 93 | + return $this->formatterServiceFactory; |
| 94 | + } |
| 95 | + |
| 96 | + /** |
| 97 | + * @return email\EmailServiceFactory |
| 98 | + */ |
| 99 | + public function emailServiceFactory() { |
| 100 | + if ($this->emailServiceFactory==null) { |
| 101 | + $this->emailServiceFactory = new email\EmailServiceFactory($this->context); |
| 102 | + } |
| 103 | + return $this->emailServiceFactory; |
| 104 | + } |
| 105 | + |
| 106 | + |
| 107 | + public static $classmap = array( |
| 108 | + 'soapContext' => 'org\nameapi\ontology\input\context\Context', |
| 109 | + |
| 110 | + 'faultBean' => 'org\nameapi\client\commonwsdl\exception\FaultBean', |
| 111 | + |
| 112 | + 'price' => 'org\nameapi\client\commonwsdl\PriceArguments', |
| 113 | + 'priceResponse' => 'org\nameapi\client\commonwsdl\PriceResponse', |
| 114 | + |
| 115 | + 'soapSimpleNaturalPerson' => '\org\nameapi\ontology\input\entities\person\NaturalInputPerson', |
| 116 | + 'soapPersonName' => '\org\nameapi\ontology\input\entities\person\name\InputPersonName', |
| 117 | + 'soapFieldOrTypeBasedTerm' => '\org\nameapi\ontology\input\entities\person\name\NameField', |
| 118 | + 'soapAgeInfo' => '\org\nameapi\ontology\input\entities\person\age\AgeInfo', |
| 119 | + //'soapAddressRelation' => '\org\nameapi\soapAddressRelation', |
| 120 | + //'soapAddress' => '\org\nameapi\soapAddress', |
| 121 | + //'soapStreetInfo' => '\org\nameapi\soapStreetInfo', |
| 122 | + 'soapEmailAddress' => '\org\nameapi\ontology\input\entities\contact\EmailAddress', |
| 123 | + 'soapTelNumber' => '\org\nameapi\ontology\input\entities\contact\TelNumber', |
| 124 | + |
| 125 | +// 'properties' => '\org\nameapi\properties', |
| 126 | +// 'entry' => '\org\nameapi\entry', |
| 127 | + ); |
| 128 | + |
| 129 | +} |
0 commit comments