Apply this filter

@param array         $result
@param \GameQ\Server $server

@return array
540759
public function apply(array $result, Server $server)
    {

        // No result passed so just return
        if (empty($result)) {
            return $result;
        }

        //$data = [];
        //$data['raw'][ $server->id() ] = $result;

        // Switch based on the base (not game) protocol
        switch ($server->protocol()->getProtocol()) {
            case 'quake2':
            case 'quake3':
            case 'doom3':
                array_walk_recursive($result, [$this, 'stripQuake']);
                break;
            case 'unreal2':
            case 'ut3':
            case 'gamespy3':  //not sure if gamespy3 supports ut colors but won't hurt
            case 'gamespy2':
                array_walk_recursive($result, [$this, 'stripUnreal']);
                break;
        }

        /*$data['filtered'][ $server->id() ] = $result;
        file_put_contents(
            sprintf(
                '%s/../../../tests/Filters/Providers/Stripcolors\%s_1.json',
                __DIR__,
                $server->protocol()->getProtocol()
            ),
            json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PARTIAL_OUTPUT_ON_ERROR)
        );*/

        // Return the stripped result
        return $result;
    }
1236794
public function apply(ResultInterface $result, array $configuration, $filterDepth)
    {
        if (false === $this->listAllowsUseOfPostSearchFilter($configuration, $filterDepth)) {
            return $result;
        }

        $result->addFilterQueryString($this->getFilterQueryString());

        return $result;
    }
671566
public function _mergeAfterFetch($result, $completeData = true)
    {
        // This loop will clear operations for keys provided by the server
        // It will not clear operations for new keys the server doesn't have.
        foreach ($result as $key => $value)
        {
            if (isset($this->operationSet[$key]))
            {
                unset($this->operationSet[$key]);
            }
        }
        $this->serverData = array();
        $this->dataAvailability = array();
        $this->mergeFromServer($result, $completeData);
        $this->rebuildEstimatedData();
    }
1363429
public function renderOnSuccess($result, SilexKernel $silexKernel)
    {
        if (!is_array($result)) {
            $result = ['result' => $result];
        }
        
        return new JsonResponse($result);
    }
475067
private function executeCommand(Server $server)
    {
        $cmd = ['listCollections' => 1];

        if ( ! empty($this->options['filter'])) {
            $cmd['filter'] = (object) $this->options['filter'];
        }

        if (isset($this->options['maxTimeMS'])) {
            $cmd['maxTimeMS'] = $this->options['maxTimeMS'];
        }

        $cursor = $server->executeCommand($this->databaseName, new Command($cmd), $this->createOptions());
        $cursor->setTypeMap(['root' => 'array', 'document' => 'array']);

        return new CollectionInfoCommandIterator(new CachingIterator($cursor));
    }
590530
protected function processResult($result)
    {
        $output = Helper::objectToArray($result);

        if (! is_array($output)) {
            throw new Error\Api($output);
        }

        if (isset($output['result'])) {
            return $output;
        }

        if (
            isset($output['request']) &&
            $output['request']['result'] != 1 &&
            $output['request']['result'] !== 'TRUE') {
            throw new Error\Api($output['request']['errorId'] . ' - ' . $output['request']['errorMessage']);
        }

        return $output;
    }
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;
    }
1331717
public function getResponse($result)
    {
        $content = $result->getContent();

        if ($result->headers->get('content-type') == 'application/json'){
            $content = json_decode($result->getContent(),true);
        }

        return array(
          'type' => 'rpc',
          'tid' => $this->tid,
          'action' => $this->action,
          'method' => $this->method,
          'result' => $content
        );
    }
804243
public function result_collections($result)
    {
        // Combine $collection and $expanded headers
        $collections = isset($result['$collection'])
            ? array($result['$collection'])
            : array();

        if (isset($result['$expanded'])) {
            foreach ($result['$expanded'] as $expanded_collection) {
                $collections[] = $expanded_collection;
            }
        }

        return $collections;
    }
265780
protected function finishAddOrderCheckout(array $result)
    {
        if (!empty($result['order']['order_id'])) {

            $vars = array(
                '@num' => $result['order']['order_id'],
                '@name' => $result['order']['customer_name'],
                '@status' => $this->order->getStatusName($result['order']['status'])
            );

            $message = $this->text('Order #@num has been created for user @name. Order status: @status', $vars);
            $this->redirect("admin/sale/order/{$result['order']['order_id']}", $message, 'success');
        }
    }
1174500
protected function filterModelEventResults($result)
    {
        if (is_array($result)) {
            $result = array_filter($result, function ($response) {
                return ! is_null($response);
            });
        }

        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
                )
            );
        }
    }
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;
    }
842746
protected function _makeResult(array $result) {
        return Result::make($result, $this->getClient())->setModelClass($this->_fullModelClassNamePattern());
    }
644265
private static function treatment($result)
    {
        if (is_string($result)) {
            echo $result;
        } elseif ($result instanceof Views) {
            View::show($result);
        }
    }
401391
public function processResult(array $result) {
        list($result, $isRaw) = array_values($result);

        if(!$isRaw && is_string($result)) {
            return $this->createClone($result);
        }

        return $result;
    }
595239
public static function keyPair(array $result): array
    {
        $firstRow = current($result);
        if (empty($firstRow)) {
            return $result;
        }

        list($keyName, $valueName) = array_keys($firstRow);

        return array_combine(
            array_column($result, $keyName),
            array_column($result, $valueName)
        );
    }