Generic outptu filtering method for multiple records of data.

@param object|array $data

@return array
511154
protected function outputMany($data)
    {
        if (is_object($data)) {
            $data = $data->getRows();
        }

        $output = array();
        foreach ($data as $row) {
            $output[] = $this->outputOne($row);
        }

        return $output;
    }
932160
public function filterColumns(array $data) {
        $testCols = array_fill_keys($this->info(Zend_Db_Table_Abstract::COLS), null);
        $testCols[self::PASSWORD_COLUMN] = null;
        $testCols[self::IMAGE_URL_COLUMN] = null;
        return array_intersect_key($data, $testCols);
    }
111489
private function convertArrayObjects($data)
    {
        if ($data instanceof \ArrayObject || $data instanceof \stdClass) {
            $data = (array) $data;
        }
        if (\is_array($data)) {
            foreach ($data as $k => $v) {
                $data[$k] = $this->convertArrayObjects($v);
            }
        }

        return $data;
    }
42813
protected function filter(array $data): array
    {
        return array_filter($data, function ($item) {
            if (is_array($item)) {
                return $this->filter($item);
            }
            $item = trim($item);
            //防止字符串'0'
            return is_numeric($item) || !empty($item);
        });
    }
564230
private function convertObjectToArray($data)
    {
        $converted = [];
        foreach($data as $key => $value) {
            if(is_object($value)) {
                $converted[$key] = $this->convertObjectToArray($value);
            } else {
                $converted[$key] = $value;
            }
        }

        return $converted;
    }
104478
protected function cleanFormData(array $data)
    {
        foreach ($data as $key => $value) {
            if (\is_array($value)) {
                $data[$key] = $this->cleanFormData($value);
            } elseif (\is_object($value)) {
                unset($data[$key]);
            }
        }

        return $data;
    }
921957
protected function unformatPayloadData(array $data)
    {
        $unformattedData = array();

        foreach ($data as $key => $value) {
            $newKey = $this->deserializeColumnName($key);

            if (is_array($value)) {
                $newValue = $this->unformatPayloadData($value);
            } else {
                $newValue = $value;
            }

            $unformattedData[$newKey] = $newValue;
        }

        return $unformattedData;
    }
1007794
private function getValues(&$data) {
        $values = [];
        foreach ($data as $i => $row) {
            $skipImport = isset($this->skipImport) ? call_user_func($this->skipImport, $row) : false;
            if (!$skipImport) {
                foreach ($this->configs as $config) {
                    $value = call_user_func($config['value'], $row);
                    $values[$i][$config['attribute']] = $value;
                }
            }
        }
        //Filter unique values by unique attributes
        $values = $this->filterUniqueValues($values);
        return $values;
    }
78888
public static function deserializeObject(array $data)
    {
        /** @var Bulk $result */
        $result = parent::deserializeObject($data);
        $result->maxOperations = $data['maxOperations'];
        $result->maxPayloadSize = $data['maxPayloadSize'];

        return $result;
    }
300871
public static function REMOVE_EMPTY( array $data)
	{
		$a = array();
	    foreach ($data as $key => $value) {
	       $a[$key] = is_array($value)?array_filter($value):$value;
	    }
	    return array_filter($a);
	}
560395
protected function asArray($data)
  {
    $array = [];
    
    foreach(get_object_vars((object)$data) as $k => $v){
      if ( is_object($v) ){
        $array[$k] = $this->asArray($v);
      }
      else {
        $array[$k] = $v;
      }
    }
    
    return $array;
  }
721071
public static function filter_input(array $data, array $filters)
    {
        $gump = self::get_instance();

        return $gump->filter($data, $filters);
    }
643872
public function filter($data)
    {
        // filtering and sorting
        if ($this->options['plugins-only']) {
            unset($data['themes']);
        }
        if ($this->options['themes-only']) {
            unset($data['plugins']);
        }

        $filter = [
            $this->options['filter'],
            $this->options['installed-only'],
            $this->options['updates-only'],
            $this->options['desc']
        ];

        if (\count(array_filter($filter))) {
            foreach ($data as $type => $packages) {
                foreach ($packages as $slug => $package) {
                    $filter = true;

                    // Filtering by string
                    if ($this->options['filter']) {
                        $filter = preg_grep('/(' . implode('|', $this->options['filter']) . ')/i', [$slug, $package->name]);
                    }

                    // Filtering updatables only
                    if ($filter && $this->options['installed-only']) {
                        $method = ucfirst(preg_replace('/s$/', '', $package->package_type));
                        $function = 'is' . $method . 'Installed';
                        $filter = $this->gpm->{$function}($package->slug);
                    }

                    // Filtering updatables only
                    if ($filter && $this->options['updates-only']) {
                        $method = ucfirst(preg_replace('/s$/', '', $package->package_type));
                        $function = 'is' . $method . 'Updatable';
                        $filter = $this->gpm->{$function}($package->slug);
                    }

                    if (!$filter) {
                        unset($data[$type][$slug]);
                    }
                }
            }
        }

        return $data;
    }
972141
private function order(array $data)
    {
        $filteredData = $this->filterOrderable($data);

        if (!empty($filteredData)) {
            uasort(
                $filteredData,
                function (OrderedNormalizerInterface $a, OrderedNormalizerInterface $b) {
                    return $a->getOrder() > $b->getOrder();
                }
            );

            return array_merge($filteredData, array_diff_key($data, $filteredData));
        }

        return $data;
    }
845606
private static function separate(array $data)
    {
        $array = [];

        foreach ($data as $provider) {

            if(($bool = self::isDelim($provider)) === false) {
                $array['required'][] = $provider;
            }
            else {
                if ($bool[1] === 'true') {
                    $array['required'][] = strval($bool[0]);
                } else {
                    $array['hidden'][] = strval($bool[0]);
                }
            }
        }

        return $array;

    }
417215
private function filterArray(array $data, array $options)
    {
        $this->sanitized = true;

        return filter_var_array($data, $options, true);
    }
310584
protected function filterFields(array $data): array
    {
        $fields = $this->getFilterFields();

        if ($fields === null) {
            return $data;
        }

        return array_intersect_key(
            $data,
            array_flip(
                iterator_to_array($fields)
            )
        );
    }