@abstract   Treat Computed Data and return packaged data buffer for tranmit to master

@param      bool        $result     Global Operation Result (0 if KO, 1 if OK)

@return     false|string      To Transmit Raw Data or False if KO
517860
private static function transmit($result)
    {
        //====================================================================//
        // Safety Check
        if (empty(self::$Outputs)) {
            return false;
        }

        //====================================================================//
        // Prepare Data Output Buffer
        //====================================================================//

        //====================================================================//
        // Set Global Operation Result
        self::$Outputs->result = $result;

        //====================================================================//
        // Flush Php Output Buffer
        Splash::log()->flushOuputBuffer();

        //====================================================================//
        // Transfers Log Reccords to _Out Buffer
        self::$Outputs->log = Splash::log();

        //====================================================================//
        // Package data and return to Server
        return Splash::ws()->pack(self::$Outputs);
    }
351614
protected function parseStatusResults($result, array $extra_result_data = array())
    {
        $result = trim($result);

        $this->checkForUnrecoverableError($result);

        return $this->checkForStatusResult($result);
    }
1323627
private function mergeAfterSave($result)
    {
        $this->applyOperations($this->operationSet, $this->serverData);
        $this->mergeFromServer($result);
        $this->operationSet = array();
        $this->rebuildEstimatedData();
    }
1214064
public function protectedNormalize($result)
    {
        $result->precision = $this->precision;
        $result->bitmask = $this->bitmask;
        switch (MATH_BIGINTEGER_MODE) {
            case MATH_BIGINTEGER_MODE_GMP:
                if (! empty($result->bitmask->value)) {
                    $result->value = gmp_and($result->value, $result->bitmask->value);
                }
                return $result;
            case MATH_BIGINTEGER_MODE_BCMATH:
                if (! empty($result->bitmask->value)) {
                    $result->value = bcmod($result->value, $result->bitmask->value);
                }
                return $result;
        }
        $value = &$result->value;
        if (! count($value)) {
            return $result;
        }
        $value = $this->protectedTrim($value);
        if (! empty($result->bitmask->value)) {
            $length = min(count($value), count($this->bitmask->value));
            $value = array_slice($value, 0, $length);
            for ($i = 0; $i < $length; ++ $i) {
                $value[$i] = $value[$i] & $this->bitmask->value[$i];
            }
        }
        return $result;
    }
1066031
final public function getResult($result = '')
    {
        $result.= $this->generate();
        if ($this->successor !== null) {
            return $this->successor->getResult($result);
        }

        return $result;
    }
15681
private function confirmQuery ($result)
	{
		if ($result) return;
	    $outputMessage = "";
		if (DEPLOYMENT_STATE == "local"):
		    $outputMessage = "Database query failed: ".mysqli_error($this->connection)."<br /><br />";
		    $outputMessage .= "Last SQL query: ".static::lastQuery();
	    else:
		    $outputMessage = "A DATABASE ERROR OCCURRED TRY AGAIN LATER OR CONTACT ADMINISTRATOR<br /><br />";
		    $log = "Database query failed: ".mysqli_error($this->connection)."\nLast SQL query: ".static::lastQuery();
		    (new Log($log, "ERROR"))->setLogFile("DBLog.txt")->logMessage();
	    endif;
	    die($outputMessage);
	}
473735
public function encode($result)
    {
        if ('form' == $this->type) {
            array_walk_recursive($result[0], array($this, 'utf8'));
            
            $response = new SfResponse("<html><body><textarea>".json_encode($result[0])."</textarea></body></html>");            
            $response->headers->set('Content-Type', 'text/html');
            
            return $response;
        } else {
            if ($this->responseEncode){
                // @todo: check utf8 config option from bundle
                array_walk_recursive($result, array($this, 'utf8'));
            }

            $response = new SfResponse(json_encode($result));            
            $response->headers->set('Content-Type', 'application/json');
            
            return $response;
        }
    }
698395
protected function parseResults($result, array $extra_result_data = array())
    {
        $data = json_decode($result, true);
        $smsData = array();

        // There was an error
        if (empty($data['transferId']) || empty($data['statusCode'])) {
            return array_merge($this->getDefaults(), $extra_result_data, array(
                    'status' => ResultInterface::STATUS_FAILED,
                )
            );
        }

        // Get the transfer id
        $smsData['id'] = $data['transferId'];

        // Get the status
        switch ($data['statusCode']) {
            case 2000:
                $smsData['status'] = ResultInterface::STATUS_SENT;
                break;
            case 2001:
                $smsData['status'] = ResultInterface::STATUS_QUEUED;
                break;
            default:
                $smsData['status'] = ResultInterface::STATUS_FAILED;
                break;
        }

        return array_merge($this->getDefaults(), $extra_result_data, $smsData);
    }
577368
protected function processDetails($data, Result &$result)
    {

        // Offload the parsing for these values
        $properties = $this->processProperties($data);

        // Always dedicated
        $result->add('dedicated', 1);

        // Iterate over the properties
        foreach ($properties as $key => $value) {
            $result->add($key, $value);
        }

        // We need to manually figure out the number of players
        $result->add(
            'numplayers',
            ($properties['virtualserver_clientsonline'] - $properties['virtualserver_queryclientsonline'])
        );

        unset($data, $properties, $key, $value);
    }
64529
private function outputResult($result)
    {
        $this->io->writeln(sprintf('<comment>%s</comment>', $this->app['extend.action.io']->getOutput()), OutputInterface::OUTPUT_PLAIN);

        if ($result === 0) {
            $this->io->success('Autoloaders updated');
            $this->auditLog(__CLASS__, 'Autoloaders updated');
        } else {
            $this->io->error('Autoloaders failed update');
        }

        return $result;
    }
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');
		}
	}
1239954
public static function legalArrayResult($result)
    {

        if (isset($result['info']) && isset($result['status']) && $result['status'] && is_array($result['info']) && count($result['info']) > 0) {
            return true;
        }

        return false;
    }
1035510
protected function _makeMultiGetResult(array $result) {
        return MultiGetResult::make($result, $this->getClient())->setModelClass($this->_fullModelClassNamePattern());
    }
960862
protected function reduceResult($result)
    {
        if (is_array($result) && (count($result) == 1)) {
            reset($result);
            return $this->reduceResult($result[key($result)]);
        } else {
            return $result;
        }
    }
198199
protected function __getResult($result, string $index = null, bool $assoc = null){

		if(is_bool($result)){
			return $result; // @codeCoverageIgnore
		}

		$out = new Result(null, $this->convert_encoding_src, $this->convert_encoding_dest);
		$i   = 0;

		while($row = call_user_func_array($assoc === true ? 'pg_fetch_assoc' : 'pg_fetch_row', [$result])){
			$key = $i;

			$j = 0;
			foreach($row as $k => $item){
				// https://gitter.im/arenanet/api-cdi?at=594326ba31f589c64fafe554
				$fieldType = pg_field_type($result, $j);

				if($fieldType === 'bool'){
					$row[$k] = $item === 't';
				}
				elseif(in_array($fieldType, ['int2', 'int4', 'int8'], true)){
					$row[$k] = (int)$item;

				}
				elseif(in_array($fieldType, ['float4', 'float8'], true)){
					$row[$k] = (float)$item; // @codeCoverageIgnore
				}

				$j++;
			}

			if($assoc && !empty($index)){
				$key = $row[$index];
			}

			$out[$key] = $row;
			$i++;
		}

		pg_free_result($result);

		return $i === 0 ? true : $out;
	}
470572
protected function onJobCompleted(string $result) : bool
    {
        $this->replySocket->send(json_encode([
            'request' => 'job_completed',
            'worker_id' => $this->workerId,
            'job_id' => $this->jobId,
            'result' => $result
        ]));
        $response = $this->replySocket->recv();
        $this->jobId = null;
        return ($response === 'ok');
    }
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);
        }
    }