findologic / findologic-api

Library for sending requests to the Findologic API
MIT License
1 stars 3 forks source link

Return null for non-existing values in the XML/JSON response #22

Closed TheKeymaster closed 5 years ago

TheKeymaster commented 5 years ago

If values to not exist, they may return null instead of '', 0 or 0.0.

This change was made to make sure if I call:

$filters = $xmlResponse->getFilters();

foreach ($filters as $filter) {
    foreach ($filter->getItems() as $item) {
        // Before: $test = 0
        // Now: $test = null
        $test = $item->getFrequency() 
    }
}

This meant that some filters returned values, that they did not even have. This is now fixed.

Fixes #25.

codecov[bot] commented 5 years ago

Codecov Report

Merging #22 into dev will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##              dev    #22   +/-   ##
=====================================
  Coverage     100%   100%           
- Complexity    182    191    +9     
=====================================
  Files          26     27    +1     
  Lines         501    514   +13     
=====================================
+ Hits          501    514   +13
Impacted Files Coverage Δ Complexity Δ
src/FINDOLOGIC/Api/Helpers/ParameterBuilder.php 100% <ø> (ø) 42 <0> (?)
...c/FINDOLOGIC/Api/Validators/ParameterValidator.php 100% <ø> (ø) 9 <0> (?)
src/FINDOLOGIC/Api/FindologicApi.php 100% <ø> (ø) 23 <0> (?)
...OLOGIC/Api/Exceptions/ServiceNotAliveException.php 100% <ø> (ø) 1 <0> (?)
src/FINDOLOGIC/Api/Validators/ConfigValidator.php 100% <ø> (ø) 4 <0> (?)
...FINDOLOGIC/Api/Exceptions/ParamNotSetException.php 100% <ø> (ø) 1 <0> (?)
src/FINDOLOGIC/Api/Definitions/OrderType.php 100% <ø> (ø) 1 <0> (?)
src/FINDOLOGIC/Api/Objects/JsonResponse.php 100% <ø> (ø) 4 <0> (?)
src/FINDOLOGIC/Api/Exceptions/ConfigException.php 100% <ø> (ø) 1 <0> (?)
src/FINDOLOGIC/Api/Definitions/BlockType.php 100% <ø> (ø) 1 <0> (?)
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update dcf2d5a...495f825. Read the comment docs.

TheKeymaster commented 5 years ago

@TheKeymaster (myself) make sure to take care of this comment: https://github.com/TheKeymaster/findologic-api/pull/13/files/bf5b931d893525d129d9237e33a8f48019aea9e3#r244041605.

TheKeymaster commented 5 years ago

@TheKeymaster please make sure to respect this comment before merging.

TheKeymaster commented 5 years ago

@howard I would be ready for a second round.