Filter the given result

@param Result $result

@return Result
501181
protected function filterResult(Result $result)
    {
        $request = $result->getData('request') ?: array();
        if (!is_array($request)) {
            $request = $this->removeNS($request);
            $request = $this->serializer->decode($request, 'xml');

            if (isset($request['transactionRequest']['payment']['creditCard'])) {
                $request['transactionRequest']['payment']['creditCard'] = '[filtered]';
            }
            if (isset($request['transactionRequest']['payment']['trackData'])) {
                $request['transactionRequest']['payment']['trackData'] = '[filtered]';
            }

        }

        $result->setData('request', $request);

        return $result;
    }
1281060
public static function instance($result, $client = null)
    {
        if ((array)$result['$data'] === $result['$data']
            && isset($result['$data']['results'])
            && isset($result['$data']['count'])) {
            return new Collection($result, $client);
        }
        
        return new Record($result, $client);
    }
614604
protected function getFirst($result = [])
    {

        if (array_key_exists("hits", $result) && count($result["hits"]["hits"])) {

            $data = $result["hits"]["hits"];

            if ($this->model) {
                $model = new $this->model($data[0]["_source"], true);
            } else {
                $model = new Model($data[0]["_source"], true);
                $model->setConnection($model->getConnection());
                $model->setIndex($data[0]["_index"]);
                $model->setType($data[0]["_type"]);
            }

            // match earlier version

            $model->_index = $data[0]["_index"];
            $model->_type = $data[0]["_type"];
            $model->_id = $data[0]["_id"];
            $model->_score = $data[0]["_score"];

            $new = $model;

        } else {
            $new = NULL;
        }

        return $new;
    }
1134187
private function format(DiffResult $result)
    {
        $serializer = SerializerBuilder::create()->build();

        return $serializer->serialize($result, 'json');
    }
1194021
public function parserResult($result)
    {
        if ($this->presenter instanceof PresenterInterface) {
            if ($result instanceof Collection || $result instanceof LengthAwarePaginator) {
                $result->each(function ($model) {
                    if ($model instanceof Presentable) {
                        $model->setPresenter($this->presenter);
                    }

                    return $model;
                });
            } elseif ($result instanceof Presentable) {
                $result = $result->setPresenter($this->presenter);
            }

            if (!$this->skipPresenter) {
                return $this->presenter->present($result);
            }
        }

        return $result;
    }
481795
protected function getFilterFields(&$result) {
        if(!empty($this->_filter)) {
            foreach ($this->_filter as $field=>$filter){
                if(isset($result[$field])) {
                    $fun  =  $filter[1];
                    if(!empty($fun)) {
                        if(isset($filter[2]) && $filter[2]){
                            // 传递整个数据对象作为参数
                            $result[$field]  =  call_user_func($fun,$result);
                        }else{
                            // 传递字段的值作为参数
                            $result[$field]  =  call_user_func($fun,$result[$field]);
                        }
                    }
                }
            }
        }
        return $result;
    }
995643
public function reformatResult($result)
    {
        $collection = new Collection($result);
        
        switch ($this->format) {
            case 'json':
                return $collection->toJson();
                break;

            case 'object':
               return json_decode(json_encode($collection->toArray()), false);
               break;

            default:
                return $collection->toArray();
                break;
        }
    }
1215960
public function encodeResult($result)
	{
		$string = $this->encoder->encodeResult($result);

		return $this->encrypt($string);
	}
138239
public function visit(
        ResultInterface $result,
        ResponseInterface $response,
        Parameter $param
    ) {
        // Retrieving a single header by name
        $name = $param->getName();
        if ($header = $response->getHeader($param->getWireName())) {
            if (is_array($header)) {
                $header = array_shift($header);
            }
            $result[$name] = $param->filter($header);
        }

        return $result;
    }
521807
public function onResult(\pq\Result $result = null) {
		if ($result && $result->status != \pq\Result::TUPLES_OK) {
			return $result;
		}
		
		$rowset = $this->getRowsetPrototype();
		if (is_callable($rowset)) {
			return $rowset($result);
		} elseif ($rowset) {
			return new $rowset($this, $result);
		}
		
		return $result;
	}
135220
public function fetchResponse($response, $result)
    {
        if ($result == 'obj') {
            return $response->fetchAll(\PDO::FETCH_OBJ);
        } elseif ($result == 'array_num') {
            return $response->fetchAll(\PDO::FETCH_NUM);
        } elseif ($result == 'array_assoc') {
            return $response->fetchAll(\PDO::FETCH_ASSOC);
        }
    }
1092656
public function prune(array $results)
    {
        $mean = array_sum($results) / count($results);
        $deviation = $this->deviations * $this->standardDeviation($results);
        $lower = $mean - $deviation;
        $upper = $mean + $deviation;

        return array_values(array_filter($results, function ($val) use ($lower, $upper) {
                return $val >= $lower && $val <= $upper;
            }));
    }
171687
private function processResult(array $result)
    {
        $this->checkResponseStatus($result['http_code']);

        // Get decoded response data
        $responseArr = json_decode($result['response'], true);

        $this->checkJsonError();

        return $responseArr;
    }
709941
protected function doApplyFilters(array $results, Server $server)
    {

        // Loop over the filters
        foreach ($this->options['filters'] as $filterOptions) {
            // Try to do this filter
            try {
                // Make a new reflection class
                $class = new \ReflectionClass(sprintf('GameQ\\Filters\\%s', ucfirst($filterOptions['filter'])));

                // Create a new instance of the filter class specified
                $filter = $class->newInstanceArgs([$filterOptions['options']]);

                // Apply the filter to the data
                $results = $filter->apply($results, $server);
            } catch (\ReflectionException $e) {
                // Invalid, skip it
                continue;
            }
        }

        return $results;
    }
845620
protected function finalize($result) {
        $this->eagerLoad = [];
        $this->criteria->reset();
        $this->scope = null;
        return $result;
    }
601501
public function addResult(Result $result): self
    {
        $handler = $result->getHandlerName();
        $this->results[$handler][] = $result;

        return $this;
    }
114927
public function result(array $result = null)
    {
        if (null === $result) {
            return array_reduce($this->names(), function ($carry, $feature) {
                $carry[$feature] = isset($this->preserveResult[$feature])
                    ? $this->preserveResult[$feature]
                    : $this->isActive($feature);

                return $carry;
            }, []);
        }

        // Note: Cannot using array_filter with ARRAY_FILTER_USE_KEY, because using PHP 5.5
        $result = array_intersect_key($result, array_flip($this->names()));

        $this->preserveResult = array_merge($this->preserveResult, $result);

        return $this;
    }