protected function prepareConsoleResponse($data, \Exception $exception = null, $verbose = false, $silent = false)
	{
	    $response = new ConsoleResponse();
	    
	    try {
	        if (is_array($data) || is_object($data)) {
	            $json = JsonEncoder::encode($data, true);
	            $data = Json::prettyPrint($json) . "\n";
	        } else if (is_scalar($data)) {
	            $data = (string)$data."\n";
	        }
	    } catch (Exception $e) {
	        $exception = $e;
	        $data = null;
        }
	    
	    if ($exception) {
	        
	        if ($verbose) {
	            $msg = $exception->getMessage() . ' (' . $exception->getFile().':'.$exception->getLine() . ')';
	        } else {
	            $msg = $exception->getMessage();
	        }
	        
	        if (!$silent) {
	            $response->setContent("Error: " . $msg . "\n");
	        }
	        
	        $response->setErrorLevel($exception->getCode());
	    }
	    
	    if (!$silent) {
	        $response->setContent($data);
	    }
	    
	    return $response;
	}
protected function prepareConsoleResponse($data, \Exception $exception = null, $verbose = false, $silent = false)
	{
	    $response = new ConsoleResponse();
	    
	    try {
	        if (is_array($data) || is_object($data)) {
	            $json = JsonEncoder::encode($data, true);
	            $data = Json::prettyPrint($json) . "\n";
	        } else if (is_scalar($data)) {
	            $data = (string)$data."\n";
	        }
	    } catch (Exception $e) {
	        $exception = $e;
	        $data = null;
        }
	    
	    if ($exception) {
	        
	        if ($verbose) {
	            $msg = $exception->getMessage() . ' (' . $exception->getFile().':'.$exception->getLine() . ')';
	        } else {
	            $msg = $exception->getMessage();
	        }
	        
	        if (!$silent) {
	            $response->setContent("Error: " . $msg . "\n");
	        }
	        
	        $response->setErrorLevel($exception->getCode());
	    }
	    
	    if (!$silent) {
	        $response->setContent($data);
	    }
	    
	    return $response;
	}
protected function prepareConsoleResponse ( $ data , \ Exception $ exception = null , $ verbose = false , $ silent = false ) { $ response = new ConsoleResponse ( ) ; try { if ( is_array ( $ data ) || is_object ( $ data ) ) { $ json = JsonEncoder :: encode ( $ data , true ) ; $ data = Json :: prettyPrint ( $ json ) . "\n" ; } else if ( is_scalar ( $ data ) ) { $ data = ( string ) $ data . "\n" ; } } catch ( Exception $ e ) { $ exception = $ e ; $ data = null ; } if ( $ exception ) { if ( $ verbose ) { $ msg = $ exception -> getMessage ( ) . ' (' . $ exception -> getFile ( ) . ':' . $ exception -> getLine ( ) . ')' ; } else { $ msg = $ exception -> getMessage ( ) ; } if ( ! $ silent ) { $ response -> setContent ( "Error: " . $ msg . "\n" ) ; } $ response -> setErrorLevel ( $ exception -> getCode ( ) ) ; } if ( ! $ silent ) { $ response -> setContent ( $ data ) ; } return $ response ; }
Prepares console response

@param mixed $data
@param \Exception|null $exception
@param boolean $verbose
@param boolean $silent
@return ConsoleResponse
Prepares console response