Output the result of the eval'd expression

@param string $buffer Buffered input
@return String
484589
public function output($buffer) {
        if (!$buffer && !$this->__result) {
            return '';
        }

        $out = '';
        // Always include the output generated by the expression first
        if ($buffer) {
            $out .= Garp_Cli::lineOut($buffer, null, true, false);
        }

        // And follow-up with the populated result, if any
        if ($this->__result) {
            // Try to format as user-friendly as possible
            $isObjWithToArray = is_object($this->__result) &&
                method_exists($this->__result, 'toArray');
            $this->__result = $isObjWithToArray ? $this->__result->toArray() : $this->__result;
            $this->__result = var_export($this->__result, true);
            $out .= Garp_Cli::lineOut($this->__result, Garp_Cli::BLUE, true, false);
        }

        return $out;
    }
1120399
public function compile(Buffer $buffer)
    {
        parent::compile($buffer);
        if (substr($this->getName(), 0, 1) !== '_') {
            $buffer
                ->writeln('try {')
                ->indent(1)
                    ->writeln('$z->addCommand(')
                    ->indent(1)
                        ->write('new \Zicht\Tool\Command\TaskCommand(')
                        ->asPhp($this->getName())
                        ->raw(', ')
                        ->asPhp($this->getArguments(true))
                        ->raw(', ')
                        ->asPhp($this->getOptions())
                        ->raw(', ')
                        ->asPhp($this->taskDef['flags'])
                        ->raw(', ')
                        ->asPhp($this->getHelp() ? $this->getHelp() : "(no help available for this task)")
                        ->raw(')')->eol()
                        ->indent(-1)
                    ->writeln(');')
                    ->indent(-1)
                ->writeln('} catch (\Exception $e) {')
                    ->indent(1)
                    ->writeln('throw new \Zicht\Tool\Container\ConfigurationException("Error while initializing task \'' . $this->getName() . '\'", 0, $e);')
                    ->indent(-1)
                ->writeln('}')
            ;
        }
    }
243168
public function shouldBuffer($buffer)
    {
        if ('' === $buffer) {
            return false;
        }

        $endOfBuffer = substr($buffer, -1);
        foreach ((array) $this->search as $needle) {
            if (false !== strpos($needle, $endOfBuffer)) {
                return true;
            }
        }

        return false;
    }
156791
protected function processVersion(Buffer $buffer)
    {

        // Decode into items
        $items = $this->decode($buffer);

        // Set the result to a new result instance
        $result = new Result();

        $result->add('version', $items[2]);

        unset($buffer, $items);

        return $result->fetch();
    }
564442
protected function processRules(Buffer $buffer)
    {

        // Set the result to a new result instance
        $result = new Result();

        // Number of rules
        $result->add('num_rules', $buffer->readInt16());

        // Run until we run out of buffer
        while ($buffer->getLength()) {
            $result->add($buffer->readPascalString(), $buffer->readPascalString());
        }

        unset($buffer);

        return $result->fetch();
    }
97643
public function beforeScript(Buffer $buffer)
    {
        $buffer->write(sprintf('$z->push(\'%s\', ', $this->name));
        $this->nodes[0]->compile($buffer);
        $buffer->write(');');
    }
1156046
public function SearchAndReplace($buffer)
	{
		$context = Context::getInstance();

		$posi = 0;
		$i = strpos($buffer, "<param-", $posi);
		while ($i !== false)
		{
			echo substr($buffer, $posi, $i-$posi);
			$if = strpos($buffer, "</param-", $i);

			$tamparam = $if-$i-8;
			$var = substr($buffer, $i+7, $tamparam);

			echo $context->get($var);

			$posi = $if + $tamparam + 9;
			$i = strpos($buffer, "<param-", $posi);
		}

		echo substr($buffer, $posi);
	}
704941
protected function processAll(Buffer $buffer)
    {
        // Set the result to a new result instance
        $result = new Result();

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

        $result->add('version', $buffer->readString());
        $result->add('hostname', $buffer->readString());
        $result->add('map', $buffer->readString());
        $result->add('game_descr', $buffer->readString());
        $result->add('flags', $buffer->readString()); // not sure about that
        $result->add('num_players', $buffer->readString());
        $result->add('maxplayers', $buffer->readString());
        $result->add('num_players_total', $buffer->readString());
        $result->add('maxplayers_total', $buffer->readString());

        // Players
        while ($buffer->getLength()) {
            $result->addPlayer('name', $buffer->readString());
            $result->addPlayer('clan', $buffer->readString());
            $result->addPlayer('flag', $buffer->readString());
            $result->addPlayer('score', $buffer->readString());
            $result->addPlayer('team', $buffer->readString());
        }

        unset($buffer);

        return $result->fetch();
    }
295635
public function statements($buffer)
    {
        $result = $this->_createResult($buffer);
        
        while (strlen($result->buffer) > 0) {
            $this->_resetResult($result);
            
            if ($result->state == '<<<') {
                if (!$this->_initializeHeredoc($result)) {
                    continue;
                }
            }
            
            $rules = array(
                '_scanUse',
                '_scanEscapedChar',
                '_scanRegion',
                '_scanStateEntrant',
                '_scanWsp',
                '_scanChar'
            );
            
            foreach ($rules as $method) {
                if ($this->$method($result)) {
                    break;
                }
            }
            
            if ($result->stop) {
                break;
            }
        }
        
        if (!empty($result->statements) && trim($result->stmt) === '' && strlen($result->buffer) == 0) {
            $this->_combineStatements($result);
            $this->_prepareForDebug($result);
            return $result->statements;
        }
    }
415921
protected function evalExpression()
    {
        $this->log("Evaluating PHP expression: " . $this->expression, $this->logLevel);
        if (!StringHelper::endsWith(';', trim($this->expression))) {
            $this->expression .= ';';
        }

        if ($this->returnProperty !== null) {
            $retval = null;
            eval('$retval = ' . $this->expression);
            $this->project->setProperty($this->returnProperty, $retval);
        } else {
            eval($this->expression);
        }
    }
502064
protected function getValue($equation)
    {
        if ($this->fixedVerifyCode !== null) {
            return $this->fixedVerifyCode;
        }
		
		return eval('return '. $equation['first'] . $equation['operator'] . $equation['second'] .';');
    }
1289395
private function _createResult($buffer)
    {
        $result             = new \stdClass();
        $result->buffer     = $buffer;
        $result->stmt       = '';
        $result->state      = null;
        $result->states     = array();
        $result->statements = array();
        $result->stop       = false;
        
        return $result;
    }
1193818
public function output($response)
    {
        //argument 1 should be an array or ArrayAccess
        Argument::i()->test(1, 'array', 'ArrayAccess');
        
        $code = $response['code'];
        $headers = $response['headers'];
        $body = $response['body'];
        
        if (is_int($code)) {
            http_response_code($code);
        }
        
        if (!isset($headers['Content-Type']) && !isset($headers['content-type'])) {
            $headers['Content-Type'] = 'text/html; charset=utf-8';
        }
        
        if (!$body) {
            $body = '';
        }
        
        //if it's not scalar
        if (!is_scalar($body)) {
            $body = json_encode($body, JSON_PRETTY_PRINT);
        }
        
        foreach ($headers as $name => $value) {
            if (!$value) {
                header($name);
                continue;
            }
            
            header($name.':'.$value);
        }

        $check = new \StdClass();
        $check->stop = false;

        $this->trigger('server-output', $response, $body, $check);
        
        if (!$check->stop) {
            echo (string) $body;
            $this->successful = true;
        }
        
        return $this;
    }
1353386
public function consumeDecimalValue(Buffer $buffer)
    {
        $scale = $buffer->consumeUint8();
        $value = $buffer->consumeUint32();
        return $value * pow(10, $scale);
    }
1037352
public function decompress($buffer)
    {
        $decodeBook = $this->getDecodeBook();
        $output     = '';
        $i          = 0;

        while ($i < strlen($buffer)) {
            $code = ord($buffer[$i]);

            if ($code == 254) {
                $output .= $buffer[$i + 1];
                $i      += 2;

            } else if($code == 255) {
                $len     = ord($buffer[$i + 1]);
                $output .= substr($buffer, $i + 2, $len);
                $i      += 2 + $len;

            } else {
                $output .= $decodeBook[$code];
                $i++;
            }
        }

        return $output;
    }
170488
public function compile(Buffer $buffer)
    {
        /** @var Script\Annotation[] $annotations */
        $annotations = array();
        $nodes = $this->nodes;
        while (current($nodes) instanceof Script\Annotation) {
            $annotations[] = array_shift($nodes);
        }

        foreach ($annotations as $annotation) {
            $annotation->beforeScript($buffer);
        }

        if (count($this->nodes)) {
            $buffer->write('$z->cmd(');
            foreach ($nodes as $i => $node) {
                if ($i > 0) {
                    $buffer->raw(' . ');
                }
                $buffer->raw('$z->str(');
                $node->compile($buffer);
                $buffer->raw(')');
            }
            $buffer->raw(');')->eol();
        }

        foreach (array_reverse($annotations) as $annotation) {
            $annotation->afterScript($buffer);
        }
    }
1174797
protected function processPlayers(Buffer $buffer)
    {

        // Set the result to a new result instance
        $result = new Result();

        // Pull out the number of players
        $num_players = $buffer->readInt8();

        // Player count
        $result->add('num_players', $num_players);

        // No players so no need to look any further
        if ($num_players == 0) {
            return $result->fetch();
        }

        // Players list
        while ($buffer->getLength()) {
            $result->addPlayer('id', $buffer->readInt8());
            $result->addPlayer('name', $buffer->readString());
            $result->addPlayer('score', $buffer->readInt32Signed());
            $result->addPlayer('time', $buffer->readFloat32());
        }

        unset($buffer);

        return $result->fetch();
    }