Print settings and all values useful for troubleshooting

@return string
@throws Json\Exception
436952
public function debug()
    {
        $constants = get_defined_constants(true);
        $flipped = array_flip($constants['curl']);
        $curlOpts = preg_grep('/^CURLOPT_/', $flipped);
        $curlInfo = preg_grep('/^CURLINFO_/', $flipped);

        $options = [];
        foreach ($this->getCurlOptions() as $const => $value) {
            if (isset($curlOpts[$const])) {
                $options[$curlOpts[$const]] = $value;
            } else if (isset($curlInfo[$const])) {
                $options[$curlInfo[$const]] = $value;
            } else {
                $options[$const] = $value;
            }
        }

        $className = get_class($this);
        $msg = "[{$className}] to {$this->getMethod()}={$this->getUrl()}";

        if (count($this->params) > 0) {
            $params = $this->getParams();
            if ($this->getMethod() == self::POST && $this->hasHeader('Content-Type') && $this->getHeader('Content-Type') == 'application/json') {
                $params = Json::encode($params);
            } else {
                $params = http_build_query($params);
            }

            $msg .= "\nParameters: {$params}";
        }

        if (count($options) > 0) {
            $msg .= 'CURL options: ' . print_r($options, true);
        }

        return $msg;
    }
174216
public function display()
    {
        $name = $this->getName();

        $data = array();

        //if data is set the just json encode those
        if (count($this->_data)) {
            $this->output = $this->_data;
        } elseif (AnInflector::isPlural($name)) {
            $this->output = $this->_getList();
        } else {
            $this->output = $this->_getItem();
        }

        //if null then return empty string
        $this->output = pick($this->output, '');

        if (!is_string($this->output)) {
            $this->output = json_encode($this->_toArray(AnConfig::unbox($this->output)));
        }

        //Handle JSONP
        if (! empty($this->_padding)) {
            $this->output = $this->_padding.'('.$this->output.');';
        }

        return $this->output;
    }
828337
def print_settings(settings, depth=0):
    """"""
    # handle the case where a single setting is passed
    if isinstance(settings, Setting):
        settings = [settings]
    for setting in settings:
        cur = setting.currentValue
        print(
            "%s* %s (%s, value: %s, type: %s)"
            % (
                " " * depth,
                setting.title,
                setting.target,
                click.style(cur, bold=True),
                setting.type,
            )
        )
        for opt in setting.candidate:
            if not opt.isAvailable:
                logging.debug("Unavailable setting %s", opt)
                continue
            click.echo(
                click.style(
                    "%s  - %s (%s)" % (" " * depth, opt.title, opt.value),
                    bold=opt.value == cur,
                )
            )
897916
protected function getValuesJSON() {
		$value = $this->value;
		if($value instanceof SS_List) {
			$values = $value->column($this->idField);
		}
		else if(is_array($value)) {
			$values = array_keys($value);
		}
		else if(is_string($value)) {
			$values = explode(',', $value);
			$values = str_replace('{comma}', ',', $values);
		}

		return $this->formatJSON($this->source->filter(array(
			$this->idField => $values
		)));
	}
1572
public function printResponse()
    {
        $request = $this->request;
        $response = $this->response;

        echo sprintf(
            "%s %s => %d:\n%s",
            $request->getMethod(),
            (string) ($request instanceof RequestInterface ? $request->getUri() : $request->getUrl()),
            $response->getStatusCode(),
            (string) $response->getBody()
        );
    }
97327
final public static function print_json(
		int $errno=0, $data=null, int $http_code=200, int $cache=0
	) {
		$json = json_encode(compact('errno', 'data'));
		self::start_header($http_code, $cache, [
			'Content-Length: ' . strlen($json),
			'Content-Type: application/json',
		]);
		static::halt($json);
	}
1075782
public function printUsage() {
        $this->log->info(
            <<< EOF
%3\$s

<strong>USAGE</strong>
    \$ %1\$s %2\$s [OPTIONS]

<strong>COMMON OPTIONS</strong>
    -c <u>FILE</u>,            <dim>Include settings stored in a JSON-formatted</dim>
    --config=<u>FILE</u>       <dim>configuration file FILE; repeat option for more</dim>
                        <dim>than one FILE</dim>
    -s <u>KEY=VALUE</u>,       <dim>Add runtime setting KEY with its VALUE; separate</dim>
    --setting=<u>KEY=VALUE</u> <dim>nested keys with ".", for example "key1.key2=123";</dim>
                        <dim>repeat option for more than one KEY</dim>

    --no-colors         <dim>Do not print colored messages</dim>
    -q, --quiet         <dim>Do not output messages, only errors</dim>
    -v, --verbose       <dim>Be more verbose</dim>

    -h, --help          <dim>Print this help or information about a</dim>
                        <dim>specific command</dim>
    --version           <dim>Print version information</dim>
EOF
            ,
            $this->config['composer']['extra']['name'],
            $this->getName(),
            $this->getDescription()
        );

        return $this;
    }
406884
public function jsonConfig()
    {
        $request = $this->request;

        // Remove null values and normalise leading dot
        $allExts = $request->getVar('allowedExtensions') ?
            explode(',', $request->getVar('allowedExtensions')) :
            File::config()->allowed_extensions;

        $exts = array_map(function ($item) {
            return $item[0] == '.' ? $item : '.' . $item;
        }, array_filter(
            $allExts,
            'strlen'
        ));

        $currentLinkParts = parse_url(Controller::join_links(Director::baseURL(), $this->Link()));
        $types = explode(',', $request->getVar('allowedTypes'));

        return Convert::array2json(array(
            'baseRoute' => $currentLinkParts['path'],
            'maxFilesize' => FileAttachmentField::get_filesize_from_ini(),
            'allowedExtensions' => implode(',', $exts),
            'thumbnailsDir' => DROPZONE_DIR . '/images/file-icons',
            'langNewFolder' => _t('AssetAdmin.NEWFOLDER', 'NewFolder'),
            'iconSize' => self::ICON_SIZE,
            'thumbnailWidth' => self::IMAGE_WIDTH,
            'thumbnailHeight' => self::IMAGE_HEIGHT,
            'defaultSort' => $this->config()->default_sort,
            'defaultView' => $this->config()->default_view,
            'maxCacheSize' => $this->config()->max_cache_size,
            'folderExtension' => self::FOLDER_EXTENSION,

            'allowSelection' => (boolean)$request->getVar('allowSelection'),
            'maxSelection' => (int)$request->getVar('maxSelection'),
            'canUpload' => (boolean)$request->getVar('canUpload'),
            'canDelete' => (boolean)$request->getVar('canDelete'),
            'canEdit' => (boolean)$request->getVar('canEdit'),
            'canCreateFolder' => (boolean)$request->getVar('canCreateFolder'),
            'allowedTypes' => !empty($types) ? $types : null
        ));
    }
485664
public function prettyPrint()
    {
        print($this->ecode . " (" . $this->getHttpStatus() . "): " .
            $this->getMessage() . "\n");
        if (!empty($this->errors)) {
            print("Field errors:\n");
            foreach($this->errors as $field_error) {
                foreach($field_error as $k => $v) {
                    print("  " . $k . ": " . $v . "\n");
                }
                print("\n");
            }
        }
    }
992048
public function getNotifyResponseStringJson() {
    $response['Result'] = $this->notifyResponse['Result'];
    $response['ErrorMessage'] = $this->notifyResponse['ErrorMessage'];
    $response['OrderId'] = $this->notifyResponse['OrderId'];
    $response['CustomerId'] = $this->notifyResponse['CustomerId'];
    $response['MailSent'] = $this->notifyResponse['MailSent'];
    $response['Timestamp'] = time();

    return json_encode($this->notifyResponse);
  }
6155
protected function buildJSON()
    {
        $json = $this->parent->createFileJson($this->file);
        $json['created'] = $this->file->obj('Created')->FormatFromSettings();
        $json['lastEdited'] = $this->file->obj('LastEdited')->FormatFromSettings();
        $json['url'] = $this->file->getAbsoluteURL();

        $json['size'] = $this->file->getSize();
        $json['folder'] = $this->file->Parent()->Filename;

        if ($this->file instanceof Image) {
            $preview = $this->file->Fill(400, 133);
            $detail = $this->file->getKickAssetsDetailImage();
            $json['previewImage'] = $preview ? $preview->URL : $this->file->getPreviewThumbnail(128, 128)->URL;
            $json['detailImage'] = $detail ? $detail->URL : $this->file->getPreviewThumbnail(128, 128)->URL;
        }

        return $json;
    }
553871
public function getJson()
    {
        $response = [
            'status' => $this->status,
        ];

        switch ($this->status) {
            case self::STATUS_SUCCESS:
            case self::STATUS_FAIL:
                $response = array_merge(
                    $response,
                    [
                        'data' => $this->data,
                    ]
                );
                break;
            case self::STATUS_ERROR;
                $code     = $this->code ? ['code' => $this->code] : [];
                $data     = $this->data ? ['data' => $this->data] : [];
                $response = array_merge(
                    $response,
                    [
                        'message' => $this->message,
                    ],
                    $code,
                    $data
                );
                break;
            default:
                // because of the check in setStatus, this should never occur
                $response = [
                    'status'  => self::STATUS_ERROR,
                    'code'    => 500,
                    'message' => 'JSend response was built illegally',
                    'data'    => [
                        'original-data' => [
                            'status'  => $this->status,
                            'code'    => $this->code,
                            'message' => $this->message,
                            'data'    => $this->data,
                        ],
                    ],
                ];
                break;
        }

        return json_encode($response);
    }
1297564
public function renderJson()
    {
        $totalCount = $this->getDatasource()->totalCount();
        $rows = $this->getDatasource()->listRows();

        $tmpData = [];
        foreach ($rows as $row) {
            $tmp = [];

            $this->currentRow = new DefaultRow();
            if ($this->rowCallback instanceof \Closure) {
                $this->rowCallback->call($this, $row);
            }

            foreach ($this->getColumns() as $key => $column) {
                $this->currentColumn = $key;
                $tmp[$column->getName()] = $column->format($row);
            }

            $tmpData[] = $tmp;
        }

        $data = [
            'draw' => $this->getRequest()->get('draw'), // @todo param names configurable
            'recordsTotal' => $totalCount,
            'recordsFiltered' => $totalCount,
            'data' => $tmpData,
        ];

        header('Content-Type: application/json');
        echo json_encode($data);die;
    }
1369399
def get_settings_json(self):
        
        return {
            'scanner': None if self.scanner is None else self.scanner.save(),
            'parser': None if self.parser is None else self.parser.save()
        }
98413
protected function printConfig()
    {
        $config = $this->getConfig();
        $output = $this->getOutput();

        foreach ($config->ruleSet()->getChildren() as $ruleSet) {
            $output->writeln('Using rule set ' . $ruleSet->getName());

            if ( ! $output->isDebug()) {
                continue;
            }

            if ( ! $ruleSet->trigger()) {
                $output->writeln('  No triggers found.');
                continue;
            }

            foreach ($ruleSet->trigger()->getAll() as $singleTrigger) {
                $output->writeln('  Contains trigger ' . $singleTrigger);
            }
        }
    }
1263129
public function jsonRows()
    {
        $arrWhat = array_values($this->getHeaderColumns());
        $arrWhere = [];
        $arrOrder = ['`id` DESC'];
        $start = 0;
        $pageSize = 15;
        if (isset($_POST['page']) && isset($_POST['pageSize'])) {
            $page = (int) $_POST['page'];
            $pageSize = (int) $_POST['pageSize'];
            $start = $page * $pageSize;
        }
        if (isset($_POST['sort']) && isset($_POST['sortDir'])) {
            $sort = (string) $_POST['sort'];
            $sortDir = (string) $_POST['sortDir'];
            if (!in_array($sortDir, ['ASC', 'DESC'])) {
                throw new Exception('Someone is doing something evil here :(');
            }
            if (!in_array($sort, $this->getAllowedPostColumns())) {
                throw new Exception('Someone is doing something evil here :(');
            }
            $arrOrder = ['`'.$sort.'` '.$sortDir];
        }
        foreach ($arrWhat as $filter) {
            if (in_array($filter, $arrWhat) && isset($_POST['filter_'.$filter])) {
                $arrWhere[$filter] = [
                    "operator" => "like",
                    "value" => '%'.$_POST['filter_'.$filter].'%'
                ];
            }
        }
        
        $arrLimit = [$start, $pageSize];
        $rows = $this->loadByPrepStmt($arrWhat, $arrWhere, $arrOrder, $arrLimit);
        if (count($rows) < 1) {
            return "[]";
        }
        foreach ($rows as $key => $columns) {
            foreach ($columns as $cKey => $column) {
                if ($cKey == "createDate") {
                    $rows[$key][$cKey] = strftime("%d.%m.%Y %H:%M:%S", strtotime($column));
                }
            }
            $rows[$key]['actions'] = $this->renderActionLinks();
        }
        $json = json_encode($rows, JSON_UNESCAPED_UNICODE);
        return $json;
    }
341829
protected function getJsonMessage($exception)
    {
        $error = array(
            'message' => 'Application Error',
        );
        
        if ($this->options['display_details']) {
            $error['exception'] = array();
            
            do {
                $error['exception'][] = array(
                    'type' => get_class($exception),
                    'code' => $exception->getCode(),
                    'message' => $exception->getMessage(),
                    'file' => $exception->getFile(),
                    'line' => $exception->getLine(),
                    'trace' => explode("\n", $exception->getTraceAsString()),
                );
            } while ($exception = $exception->getPrevious());
        }
        
        return json_encode($error, JSON_PRETTY_PRINT);
    }