Skip to content

Commit

Permalink
Remove deprecated calls
Browse files Browse the repository at this point in the history
  • Loading branch information
simitter committed Nov 8, 2024
1 parent 3df43cf commit 3f1fb81
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 158 deletions.
16 changes: 0 additions & 16 deletions src/Justimmo/Api/JustimmoApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,22 +182,6 @@ public function callFederalStates(array $params = array())
return $this->call('objekt/bundeslaender', $params);
}

/**
* @inheritdoc
*/
public function callZipCodes(array $params = array())
{
return $this->call('objekt/plzsUndOrte', $params);
}

/**
* @inheritdoc
*/
public function callRegions(array $params = array())
{
return $this->call('objekt/regionen', $params);
}

/**
* @inheritdoc
*/
Expand Down
22 changes: 0 additions & 22 deletions src/Justimmo/Api/JustimmoApiInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,28 +104,6 @@ public function callCountries(array $params = array());
*/
public function callFederalStates(array $params = array());

/**
* retrieve a zip code list
*
* @deprecated
*
* @param array $params
*
* @return string
*/
public function callZipCodes(array $params = array());

/**
* retrieve a region list
*
* @deprecated - This call is deprecated and will be replaced with political districts in 2.0
*
* @param array $params
*
* @return string
*/
public function callRegions(array $params = array());

/**
* Retrieve tenant data
*
Expand Down
10 changes: 0 additions & 10 deletions src/Justimmo/Api/JustimmoNullApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,6 @@ public function callFederalStates(array $params = array())
return $this->emptyXML();
}

public function callZipCodes(array $params = array())
{
return $this->emptyXML();
}

public function callRegions(array $params = array())
{
return $this->emptyXML();
}

public function callRealtyTypes(array $params = array())
{
return $this->emptyXML();
Expand Down
28 changes: 0 additions & 28 deletions src/Justimmo/Model/Query/BasicDataQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,34 +120,6 @@ public function findFederalStates()
return $return;
}

/**
* @return array
*/
public function findZipCodes()
{
$response = $this->api->callZipCodes($this->params);

$return = $this->wrapper->transformZipCodes($response);

$this->clear();

return $return;
}

/**
* @return array
*/
public function findRegions()
{
$response = $this->api->callRegions($this->params);

$return = $this->wrapper->transformRegions($response);

$this->clear();

return $return;
}

/**
* @return array
*/
Expand Down
4 changes: 0 additions & 4 deletions src/Justimmo/Model/Wrapper/BasicDataWrapperInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ public function transformCountries($data);

public function transformFederalStates($data);

public function transformZipCodes($data);

public function transformRegions($data);

public function transformRealtyTypes($data);

public function transformRealtyCategories($data);
Expand Down
31 changes: 0 additions & 31 deletions src/Justimmo/Model/Wrapper/V1/BasicDataWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,6 @@ public function transformFederalStates($data)
return $return;
}

public function transformZipCodes($data)
{
$xml = new \SimpleXMLElement($data);

$return = array();
foreach ($xml->postleitzahl as $postleitzahl) {
$return[] = array(
'id' => ((string) $postleitzahl->id === '') ? null : (int) $postleitzahl->id,
'countryId' => ((string) $postleitzahl->landid === '') ? null : (int) $postleitzahl->landid,
'regionId' => ((string) $postleitzahl->regionid === '') ? null : (int) $postleitzahl->regionid,
'zipCode' => trim((string) $postleitzahl->plz),
'place' => trim((string) $postleitzahl->ort),
'federalStateId' => ((string) $postleitzahl->bundeslandid === '') ? null : (int) $postleitzahl->bundeslandid,
);
}

return $return;
}

public function transformRegions($data)
{
$xml = new \SimpleXMLElement($data);

$return = array();
foreach ($xml->region as $region) {
$return[(int) $region->id] = trim((string) $region->name);
}

return $return;
}

public function transformRealtyTypes($data)
{
$xml = new \SimpleXMLElement($data);
Expand Down
47 changes: 0 additions & 47 deletions tests/Justimmo/Tests/Wrapper/V1/BasicDataWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,53 +36,6 @@ public function testFederalStates()
$this->assertEquals('05', $list[130]['fipsCode']);
}

public function testZipCodes()
{
$list = $this->wrapper->transformZipCodes($this->getFixtures('v1/zip_codes.xml'));

$this->assertEquals(128, count($list));

$rowEmptyZipId = $list[0];
$this->assertNull($rowEmptyZipId['id']);
$this->assertEquals('Santa Ponça', $rowEmptyZipId['place']);
$this->assertEquals(69, $rowEmptyZipId['countryId']);
$this->assertNull($rowEmptyZipId['regionId']);
$this->assertEquals('07180', $rowEmptyZipId['zipCode']);
$this->assertEquals(4248, $rowEmptyZipId['federalStateId']);

$row537 = $this->getRowById($list, 537);
$this->assertEquals(537, $row537['id']);
$this->assertEquals('Lofer', $row537['place']);
$this->assertEquals(17, $row537['countryId']);
$this->assertEquals(115, $row537['regionId']);
$this->assertEquals('5090', $row537['zipCode']);
$this->assertEquals(130, $row537['federalStateId']);
}

private function getRowById($data, $id)
{
$match = null;
foreach ($data as $row) {
if ($row['id'] === $id) {
$match = $row;
break;
}
}

return $match;
}

public function testRegions()
{
$list = $this->wrapper->transformRegions($this->getFixtures('v1/regions.xml'));

$this->assertEquals(23, count($list));
$this->assertEquals('17., Hernals', $list[34]);
$this->assertEquals('12., Meidling', $list[68]);
$this->assertEquals('2., Leopoldstadt', $list[58]);
$this->assertEquals('22., Donaustadt', $list[12]);
}

public function testRealtyTypes()
{
$list = $this->wrapper->transformRealtyTypes($this->getFixtures('v1/realty_types.xml'));
Expand Down

0 comments on commit 3f1fb81

Please sign in to comment.