protected function stripMetadata(array $array, $stripped = [])
    {
        $allowed = ['id', '__children'];
        foreach ($array as $item) {
            if (count($item['__children'])) {
                $item['__children'] = $this->stripMetadata($item['__children'], $stripped);
            }

            $stripped[] = array_intersect_key($item, array_flip($allowed));
        }

        return $stripped;
    }
protected function stripMetadata(array $array, $stripped = [])
    {
        $allowed = ['id', '__children'];
        foreach ($array as $item) {
            if (count($item['__children'])) {
                $item['__children'] = $this->stripMetadata($item['__children'], $stripped);
            }

            $stripped[] = array_intersect_key($item, array_flip($allowed));
        }

        return $stripped;
    }
protected function stripMetadata ( array $ array , $ stripped = [ ] ) { $ allowed = [ 'id' , '__children' ] ; foreach ( $ array as $ item ) { if ( count ( $ item [ '__children' ] ) ) { $ item [ '__children' ] = $ this -> stripMetadata ( $ item [ '__children' ] , $ stripped ) ; } $ stripped [ ] = array_intersect_key ( $ item , array_flip ( $ allowed ) ) ; } return $ stripped ; }
Strips metadata that should not be stored

@param array $array
@param array $stripped
@return array
Strips metadata that should not be stored