Skip to content

Commit c04775f

Browse files
author
Zack Teska
committed
updated readme
1 parent b0c41d8 commit c04775f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,19 @@ $address->toArray();
105105
'204 SE Smith St',
106106
'Harrisburg, OR 97446'
107107
]
108-
```
108+
```
109+
110+
### Hashing
111+
If you only need to make use of a consistent way of hashing (e.g. if you're starting with a dependable 5-part address, such as from a 3rd party service), you can build a `SimpleAddress`.
112+
113+
```php
114+
<?php
115+
use ZeroDaHero\SimpleAddress;
116+
117+
$address = new SimpleAddress('1234 Main St NE', null, 'Minneapolis', 'MN', '55401');
118+
$address->getHash(); // full hash minus zip
119+
$address->getFullHash(); // full hash including zip
120+
121+
// CANNOT hash street, since the component parts don't exist
122+
$address->getStreetHash(); // throws exception
123+
```

tests/SimpleAddressTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ public function testHashesAddress()
1919
$this->assertEquals('c4ced80b9489911b4a66712470833242597aa032', $address->getFullHash());
2020

2121
$this->expectException(AddressNotNormalizedException::class);
22-
$this->assertEquals('f7f77f11493cccb50c5827dff7cb8b26d31f8442', $address->getStreetHash());
22+
$address->getStreetHash();
2323
}
2424
}

0 commit comments

Comments
 (0)