Skip to content

Commit 06e0faa

Browse files
committed
Replaced toString() methods with (string) casting, kept __toString(). This seems to be more PHP-like.
1 parent ac96828 commit 06e0faa

File tree

25 files changed

+33
-80
lines changed

25 files changed

+33
-80
lines changed

src/org/nameapi/client/services/email/disposableemailaddressdetector/DisposableEmailAddressDetectorService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* HOW TO USE:
1616
* $deaDetector = $myServiceFactory->emailServices()->disposableEmailAddressDetector();
1717
* $result = $deaDetector->isDisposable("[email protected]");
18-
* echo $result->getDisposable()->toString()); //will print 'YES'
18+
* echo (string)$result->getDisposable()); //prints 'YES'
1919
*/
2020
class DisposableEmailAddressDetectorService {
2121

src/org/nameapi/client/services/email/disposableemailaddressdetector/Maybe.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ public function __construct($value) {
2525

2626

2727

28-
public function toString() {
29-
return $this->value;
30-
}
3128
public function __toString() {
32-
return $this->toString();
29+
return $this->value;
3330
}
3431

3532
}

src/org/nameapi/client/services/email/emailnameparser/EmailAddressNameType.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ public function __construct($value) {
2424
}
2525

2626

27-
public function toString() {
28-
return $this->value;
29-
}
3027
public function __toString() {
31-
return $this->toString();
28+
return $this->value;
3229
}
3330

3431
}

src/org/nameapi/client/services/email/emailnameparser/EmailAddressParsingResultType.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,8 @@ public function __construct($value) {
5757
}
5858

5959

60-
public function toString() {
61-
return $this->value;
62-
}
6360
public function __toString() {
64-
return $this->toString();
61+
return $this->value;
6562
}
6663

6764
}

src/org/nameapi/client/services/email/emailnameparser/EmailNameParserService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* HOW TO USE:
1515
* $emailNameParser = $myServiceFactory->emailServices()->emailNameParser();
1616
* $result = $emailNameParser->parse("[email protected]");
17-
* echo $result->getDisposable()->toString()); //will print 'YES'
17+
* echo (string)$result->getDisposable()); //prints 'YES'
1818
*/
1919
class EmailNameParserService {
2020

src/org/nameapi/client/services/email/emailnameparser/NameFromEmailAddress.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,9 @@ public function getNameType() {
4242

4343

4444
public function __toString() {
45-
// $ret = 'NameFromEmailAddress{';
46-
// $ret .= 'name='.$this->name;
47-
// $ret .= ', nameType='.$this->nameType;
48-
// return $ret.'}';
49-
5045
$ret = $this->name;
51-
if ($this->nameType->toString()!='NAME') {
52-
$ret .= ' (type='.$this->nameType->toString().')';
46+
if ((string)$this->nameType != 'NAME') {
47+
$ret .= ' (type=' . (string)$this->nameType .')';
5348
}
5449
return $ret;
5550
}

src/org/nameapi/client/services/genderizer/persongenderizer/PersonGenderizerService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* HOW TO USE:
1717
* $personGenderizer = $myServiceFactory->genderizerServices()->personGenderizer();
1818
* $personGenderResult = $personGenderizer->assess($inputPerson);
19-
* echo $personGenderResult->getGender()->toString(); //will print 'MALE'
19+
* echo (string)$personGenderResult->getGender(); //prints 'MALE'
2020
*/
2121
class PersonGenderizerService {
2222

src/org/nameapi/client/services/matcher/AgeMatch.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@ public function __construct($value) {
2424

2525

2626

27-
public function toString() {
28-
return $this->value;
29-
}
3027
public function __toString() {
31-
return $this->toString();
28+
return $this->value;
3229
}
3330

3431
}

src/org/nameapi/client/services/matcher/GenderMatchType.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@ public function __construct($value) {
2323
}
2424

2525

26-
public function toString() {
27-
return $this->value;
28-
}
2926
public function __toString() {
30-
return $this->toString();
27+
return $this->value;
3128
}
3229

3330
}

src/org/nameapi/client/services/matcher/PersonNameMatchType.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@ public function __construct($value) {
2323
}
2424

2525

26-
public function toString() {
27-
return $this->value;
28-
}
2926
public function __toString() {
30-
return $this->toString();
27+
return $this->value;
3128
}
3229

3330
}

0 commit comments

Comments
 (0)