@param mixed $result

@return mixed
502356
protected function done($result = null)
    {
        if ($result === null) {
            $this->event('error', $this->error());
        }

        $this->event('done', $result);
        $this->event = null;

        return $result;
    }
791818
protected function checkReturn($result)
    {
        // 返回[ServerRequestInterface $req, ResponseInterface $res]
        if (!is_array($result) ||
            $result[0] instanceof ServerRequestInterface === false ||
            $result[1] instanceof ResponseInterface === false) {
            throw new \UnexpectedValueException(
                i18n(
                    'Middleware must return a array, the first element is %s and then second is %s.',
                    ServerRequestInterface::class,
                    ResponseInterface::class
                )
            );
        }
    }
448754
protected function response($result)
    {
        $response = $this->container->get(Application::RESPONSE);

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

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

        return $response;
    }
479174
protected function result(&$result)
    {
        if (!empty($this->options['json'])) {
            $this->jsonResult($result, $this->options['json'], true);
        }

        if (!empty($this->options['with_attr'])) {
            $this->getResultAttr($result, $this->options['with_attr']);
        }
    }
1072669
private function determineState($result)
    {
        foreach ($this->config['acceptors'] as $acceptor) {
            $matcher = 'matches' . ucfirst($acceptor['matcher']);
            if ($this->{$matcher}($result, $acceptor)) {
                return $acceptor['state'];
            }
        }

        return $result instanceof \Exception ? 'failed' : 'retry';
    }
614075
public function write(&$result)
    {
        $container = $this->accessor->getPropertyValue($result, $this->definition->container());
        if (empty($container)) {
            $conditions = [];
            foreach ($this->definition->keys() as $local => $foreign) {
                $conditions[$foreign][] = $this->accessor->getPropertyValue($result, $local);
            }

            $this->cleanup($this->definition->entity(), [], $conditions);
            return $result;
        }

        $this->assertArrayAccess($container);

        foreach ($container as $relEntity) {
            foreach ($this->definition->keys() as $local => $foreign) {
                $this->accessor->setPropertyValue($relEntity, $foreign, $this->accessor->getPropertyValue($result, $local));
            }

            $this->storage->write($relEntity, $this->definition->entity())->execute();
        }

        $this->accessor->setPropertyValue($result, $this->definition->container(), $container);

        $conditions = [];
        foreach ($this->definition->keys() as $local => $foreign) {
            $conditions[$foreign] = $this->accessor->getPropertyValue($result, $local);
        }

        $this->cleanup($this->definition->entity(), $container, $conditions);

        return $result;
    }
487245
public function delete(&$result)
    {
        $container = $this->accessor->getPropertyValue($result, $this->definition->container());
        if (empty($container)) {
            return $result;
        }

        foreach ($container as $entity) {
            $mediator = [];

            foreach ($this->definition->localKeys() as $local => $foreign) {
                $mediator[$foreign] = $this->accessor->getPropertyValue($result, $local);
            }

            foreach ($this->definition->foreignKeys() as $foreign => $local) {
                $mediator[$foreign] = $this->accessor->getPropertyValue($entity, $local);
            }

            $this->storage->delete($mediator, $this->definition->mediator())->execute();

        }
        $this->accessor->setPropertyValue($result, $this->definition->container(), $container);

        return $result;
    }
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;
    }
1131342
public function fetchResult($result)
    {
        $fetchMode = $this->fetchMode;
        switch ($fetchMode) {
            case PDO::FETCH_ASSOC:
                return $result->result_array();
            case PDO::FETCH_OBJ:
                return $result->result();
        }

        throw new \BadMethodCallException("Unsupported fetch mode '$fetchMode'.");
    }
399135
public static function group(array $result): array
    {
        $firstRow = current($result);
        if (empty($firstRow)) {
            return $result;
        }

        $dataKeys = array_keys($firstRow);
        $groupKey = array_shift($dataKeys);

        $rows = [];
        foreach ($result as $row) {
            $index = $row[$groupKey];
            unset($row[$groupKey]);

            $rows[$index][] = $row;
        }

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

            return $result->name;

        }, $results));
    }
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;
	}
842746
protected function _makeResult(array $result) {
        return Result::make($result, $this->getClient())->setModelClass($this->_fullModelClassNamePattern());
    }
1035510
protected function _makeMultiGetResult(array $result) {
        return MultiGetResult::make($result, $this->getClient())->setModelClass($this->_fullModelClassNamePattern());
    }
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;
        }
    }
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;
    }
1330191
protected function prepareResponse($result)
    {
        $this->checkForCurlErrors();

        $response = array();
        $response["data"] = $this->getSerializer()->deserialize($result);
        $response["status"] = $this->getStatusCode();


        if ($response['status'] >= 400 && $response['status'] < 500) {
            $statusCode = $response['status'];
            $exceptionText = "{$statusCode} Client Exception: {$result}";

            throw new ClientErrorException($exceptionText, $statusCode);
        } else if ($response['status'] >= 500) {
            $statusCode = $response['status'];
            $exceptionText = "{$statusCode} Server Exception: {$result}";

            throw new ServerErrorException($exceptionText, $statusCode);
        }

        return $response;
    }