过滤webservice返回的结果.

@param  array    $result

@return array
@throws \Xjtuana\XjtuWs\WebService\XjtuWebServiceException
765819
protected function filterResult(array $result) {
        foreach($result as $index => $user) {
            if (!is_object($user)) {
                throw new XjtuWebServiceException('Invalid response from web service server.');
            }
            foreach($user as $key => $val ) {
                if (!in_array($key, $this->fields) || in_array($key, $this->filter)) {
                    unset($user->$key);
                }
            }
            
            // $result[$index] = (array) $user;
        }
        return $result;
    }
17575
public static function listToEntity(array $result, string $className): array
    {
        $entities = [];
        foreach ($result as $data) {
            if (!\is_array($data)) {
                continue;
            }
            $entities[] = self::arrayToEntity($data, $className);
        }

        return $entities;
    }
298754
final public static function adapter($result)
    {
        if (is_array($result)) {
            $arr = [];
            foreach ($result as $key => $value) {
                $arr[$key] = self::makeObject($value);
            }
            return $arr;
        }

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

        return $serializer->serialize($result, 'json');
    }
637729
private function resultToResponse($result) : Response
	{
		switch (true) {
			// Response object
			case $result instanceof Response:
				return $result;
			// String -> transform to response
			case is_string($result) || is_numeric($result):
				return new Response($result);
			// Array -> transform to json response
			case is_array($result) || is_object($result):
				return new JsonResponse($result);
			default:
				throw new Exception('Invalid route handler return value');
		}
	}
204708
protected function collectionFromResult($result)
    {
        // If we have one result which is not an assoc array, make it the first element of an array for the
        // collectionFromResult function so we always return a collection from filter
        if ((bool) count(array_filter(array_keys($result), 'is_string'))) {
            $result = [$result];
        }

        $class = $this->class;
        $collection = [];

        foreach ($result as $r) {
            $collection[] = new $class($this->connection, $r);
        }

        return $collection;
    }
295430
public function fetchAssoc($result = null)
    {
        $result = $result ? $result : $this->getResult();

        $rows = [];

        if ($result->rowCount() > 0) {
            $results = $result->fetchAll(\PDO::FETCH_ASSOC);
            foreach ($results as $key => $value) {
                $rows[$key] = $value;
            }
        }

        return $rows;
    }
949521
protected function arrayToXml($result, &$xml)
	{
		foreach ($result as $key => $value) {
			if (is_array($value)) {
				if (!is_numeric($key)) {
					$subnode = $xml->addChild((string) $key);
				} else {
					$subnode = $xml->addChild('item_' . $key);
				}
				$this->arrayToXml($value, $subnode);
			} else {
				$xml->addChild($key, $value);
			}
		}
	}
845375
public function serialiseResult($executionResult)
    {
        // Format object
        if (!empty($executionResult->errors)) {
            return [
                'data' => $executionResult->data,
                'errors' => array_map($this->errorFormatter, $executionResult->errors),
            ];
        } else {
            return [
                'data' => $executionResult->data,
            ];
        }
    }
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;
    }
850306
protected function result($result)
    {
        $this->result =
            $result instanceof Result
                ? $result
                : new Result($result['healthy'], $result['exception_message']);

        return $this->result;
    }
368064
protected function processResult(array $results)
    {
        foreach ($results as $key => $entity) {

            if (!empty($entity['data'])) {

                $entity['data'] = $this->decorator->denormalizeValue($entity['data']);
                $results[$key] = $entity;
            }
        }

        return $results;
    }
217979
protected function prepareAccessTokenResponse(array $result)
    {
        if ($this->getAccessTokenResourceOwnerId() !== null) {
            $result['resource_owner_id'] = $this->getValueByKey(
                $result,
                $this->getAccessTokenResourceOwnerId()
            );
        }
        return $result;
    }
1241759
public function serialize($result)
    {
        try {
            // array is serialized as an object {"0":{...},"1":{...},...} when data contains an empty objects
            // we serialize each item because we can assume this bug affects only root array element
            if (is_array($result) && array_keys($result) === range(0, count($result) - 1)) {
                $result = array_map(
                    function ($item) {
                        return $this->serializeContent($item);
                    },
                    $result
                );

                return '['.implode(',', array_filter($result)).']';
            }

            return $this->serializeContent($result);
        } catch (\Exception $e) {
            throw new SerializationException($e);
        }
    }
53251
private function parseJson($result)
    {
        $json = json_decode($result, true);
        if (empty($json) || !empty($json['errcode'])) {
            $this->errCode = isset($json['errcode']) ? $json['errcode'] : '505';
            $this->errMsg = isset($json['errmsg']) ? $json['errmsg'] : '无法解析接口返回内容！';
            return false;
        }
        return $json;
    }
448754
protected function response($result)
    {
        $response = $this->container->get(Application::RESPONSE);

        if ($result instanceof ResponseInterface)
        {
            return $result;
        }

        $response->stream()->write($result);

        return $response;
    }
120962
public function processColumnListing($results)
    {
        return array_values(array_map(function ($result)
        {
            $result = (object) $result;

            return $result->name;

        }, $results));
    }