-
Notifications
You must be signed in to change notification settings - Fork 1
fix: implement upstream lookup logic for sites on php 7.4 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,34 +111,35 @@ public static function make(): self | |
| * @return string | ||
| */ | ||
| private function parseURLvariables(): string | ||
| { | ||
| $params = [ | ||
| 'postcode' => $this->zip, | ||
| 'type' => 'adres' | ||
| ]; | ||
|
|
||
| if (empty($this->homeNumberAddition)) { | ||
| $params = array_merge($params, [ | ||
| 'huis_nlt' => $this->homeNumber, | ||
| ]); | ||
| } else { | ||
| $params = array_merge($params, [ | ||
| 'huisnummer' => $this->homeNumber, | ||
| 'huisletter' => $this->homeNumberAddition, | ||
| ]); | ||
| } | ||
| { | ||
| $arg_and = ['type:adres']; | ||
| $arg_or = []; | ||
|
|
||
| $filteredParameters = array_filter( | ||
| $params, | ||
| function ($item) { | ||
| return !empty($item); | ||
| } | ||
| ); | ||
| if (!empty($this->zip)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. De class properties zijn niet typed helaas maar de postcode dient altijd een string te zijn. |
||
| $arg_and[] = "postcode:{$this->zip}"; | ||
| } | ||
|
|
||
| $query = http_build_query($filteredParameters, null, '%20and%20'); | ||
| $query = str_replace('=', ':', $query); | ||
| return sprintf('%s%s', $this->url, $query); | ||
| } | ||
| if (!empty($this->homeNumber)) { | ||
| $arg_and[] = "huisnummer:{$this->homeNumber}"; | ||
| } | ||
|
|
||
| if (!empty($this->homeNumberAddition)) { | ||
| $addition = strtoupper($this->homeNumberAddition); | ||
|
|
||
| $arg_or[] = [ | ||
| "huisnummertoevoeging:{$addition}", | ||
| "huisletter:{$addition}", | ||
| ]; | ||
| } | ||
|
|
||
| $arg_or = array_map(function ($group) { | ||
| return '( ' . implode(' or ', $group) . ' )'; | ||
| }, $arg_or); | ||
|
|
||
| $query = implode(' and ', array_merge($arg_and, $arg_or)); | ||
|
|
||
| return $this->url . urlencode($query); | ||
| } | ||
|
|
||
| /** | ||
| * Actually execute the remote request. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,7 @@ | |
| define('GF_BAG_LANGUAGE_DOMAIN', GF_BAG_SLUG); | ||
| define('GF_BAG_DIR', basename(__DIR__)); | ||
| define('GF_BAG_ROOT_PATH', __DIR__); | ||
| define('GF_BAG_VERSION', '1.1.3'); | ||
| define('GF_BAG_VERSION', '1.1.6'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ik zou de versie niet bijwerken in deze PR. Mocht iemand in de tussentijd een andere versie releasen dan ontstaat daar weer een conflict. |
||
|
|
||
| /** | ||
| * Bootstrap WordPress Mock. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mierenneuken maar snake_case vs camelCase 🐜