src/PrestashopWebService.php
private function checkForUselessNodes(SimpleXMLElement $resource, $data)
    {
        $uselessNodes = [];
        foreach ($resource as $key => $value) {
            if (!array_key_exists($key, $data)) {
                $uselessNodes[] = $key;
            }
        }
        foreach ($uselessNodes as $key) {
            unset($resource->$key);
        }
    }
private function checkForUselessNodes(SimpleXMLElement $resource, $data)
    {
        $uselessNodes = [];
        foreach ($resource as $key => $value) {
            if (!array_key_exists($key, $data)) {
                $uselessNodes[] = $key;
            }
        }
        foreach ($uselessNodes as $key) {
            unset($resource->$key);
        }
    }
private function checkForUselessNodes ( SimpleXMLElement $ resource , $ data ) { $ uselessNodes = [ ] ; foreach ( $ resource as $ key => $ value ) { if ( ! array_key_exists ( $ key , $ data ) ) { $ uselessNodes [ ] = $ key ; } } foreach ( $ uselessNodes as $ key ) { unset ( $ resource -> $ key ) ; } }
Remove XML first level nodes that are not present int the data array
@param SimpleXMLElement $resource
@param $data
Remove XML first level nodes that are not present int the data array