Lsrur\Inspector\Collectors\BaseCollector::cl PHP Method

cl() protected method

"Console log" helper
protected cl ( string $cmd, string $title, mixed $data ) : string
$cmd string
$title string
$data mixed
return string
    protected function cl($cmd, $title, $data)
    {
        if (substr($title, -1) !== ':') {
            $title .= ':';
        }
        $styles = ['info' => $this->defaultStyle . 'border-radius:3px;padding:2px 3px;color:white; background-color: #3498DB', 'warning' => $this->defaultStyle . 'border-radius:3px;padding:2px 3px;color:white; background-color: #F39C12', 'success' => $this->defaultStyle . 'border-radius:3px;padding:2px 3px;color:white; background-color: #18BC9C', 'error' => $this->defaultStyle . 'border-radius:3px;padding:2px 3px;color:white; background-color: #E74C3C'];
        if (in_array($cmd, ['info', 'warning', 'success', 'error'])) {
            $title = "'%c" . strtoupper($cmd) . "%c {$title}'" . ",'" . $styles[$cmd] . "', 'font-size:10px; font-weight:bold'";
        } else {
            $title = "'%c {$title}', 'font-size:10px; font-weight:bold'";
        }
        return "console.log(" . $title . "," . json_encode($data) . "); ";
    }