public function arrayFilterRecursive(array $array)
    {
        foreach ($array as &$value) {
            if (is_array($value)) {
                /** @var $value array */
                $value = count($value) === 1 && array_key_exists(0, $value) && is_string($value[ 0 ]) &&
                $this->variable->isEmpty(trim($value[ 0 ])) ? $value[ 0 ] : $this->arrayFilterRecursive($value);
            }
        }

        return array_filter($array, function ($value) {
            return ! $this->variable->isEmpty($value) &&
                ! (is_string($value) && $this->variable->isEmpty(trim($value)));
        });
    }
public function arrayFilterRecursive(array $array)
    {
        foreach ($array as &$value) {
            if (is_array($value)) {
                /** @var $value array */
                $value = count($value) === 1 && array_key_exists(0, $value) && is_string($value[ 0 ]) &&
                $this->variable->isEmpty(trim($value[ 0 ])) ? $value[ 0 ] : $this->arrayFilterRecursive($value);
            }
        }

        return array_filter($array, function ($value) {
            return ! $this->variable->isEmpty($value) &&
                ! (is_string($value) && $this->variable->isEmpty(trim($value)));
        });
    }
public function arrayFilterRecursive ( array $ array ) { foreach ( $ array as & $ value ) { if ( is_array ( $ value ) ) { /** @var $value array */ $ value = count ( $ value ) === 1 && array_key_exists ( 0 , $ value ) && is_string ( $ value [ 0 ] ) && $ this -> variable -> isEmpty ( trim ( $ value [ 0 ] ) ) ? $ value [ 0 ] : $ this -> arrayFilterRecursive ( $ value ) ; } } return array_filter ( $ array , function ( $ value ) { return ! $ this -> variable -> isEmpty ( $ value ) && ! ( is_string ( $ value ) && $ this -> variable -> isEmpty ( trim ( $ value ) ) ) ; } ) ; }
Method to filter empty elements from XML

@param array $array

@return array
Method to filter empty elements from XML