Parses the log command output to Commit objects

@param  string                                $output
@param  array                                 $arguments
@return string|\Webcreate\Vcs\Common\Commit[]
337733
public function parseLogOutput($output, array $arguments = array())
    {
        if (!isset($arguments['--pretty=']) || Git::PRETTY_FORMAT !== $arguments['--pretty=']) {
            // non pretty results are not supported
            return $output;
        }

        $xml = '<log>' . $output . '</log>';

        $sxml = simplexml_load_string($xml);

        $retval = array();
        foreach ($sxml->logentry as $entry) {
            $revision = (string) $entry->commit;
            $date     = (string) $entry->date;
            $author   = (string) $entry->author;
            $message  = (string) $entry->msg;

            $retval[] = new Commit($revision, new \DateTime($date), $author, trim($message));
        }

        return $retval;
    }
219772
private function cleanOutput($output) {
    if (!is_array($output)) {
      $output = explode(PHP_EOL, $output);
    }

    // Datetime weirdness. Apparently this is caused by theming issues on the
    // remote theme. Why it is being called when executed via CLI is another
    // story.
    foreach ($output as $key => $value) {
      $invalid_strings = [
        'date_timezone_set() expects parameter',
        'date_format() expects parameter',
        'common.inc:20',
        'given common.inc:20',
        'Warning: Using a password on the command line interface can be insecure.',
      ];
      foreach ($invalid_strings as $invalid_string) {
        if (strpos($value, $invalid_string) === 0) {
          unset($output[$key]);
        }
      }
    }

    // Remove blank lines.
    $output = array_filter($output);

    // Ensure we are returning arrays with no key association.
    return array_values($output);
  }
1357574
public function parse()
    {
        $result = $this->command->run();
        $log = $result->getStdOut();

        $buffer = array();
        $commits = explode($this->format->getCommitDelimiter(), $log);

        foreach ($commits as $commit) {
            $fields = explode($this->format->getFieldDelimiter(), $commit);
            $entry = array();

            foreach ($fields as $field) {
                if (!preg_match('/^\[(\S*?)\](.*)/', $field, $matches)) {
                    continue;
                }
                $entry[trim($matches[1])] = trim($matches[2]);
            }
            if (!empty($entry)) {
                $buffer[] = $entry;
            }

        }
        return $buffer;
    }
339108
protected function getColumnRemove(array $output, string $columnName): array
    {
        $output[] = sprintf("%s->removeColumn('%s')", $this->ind3, $columnName);

        return $output;
    }
445145
public function parseLog($log)
    {
        $commits = [];

        // Remove empty lines
        $log = array_values(array_filter($log));

        for ($i = 0, $lines = count($log); $i < $lines; $i++) {

            // Skip separator
            if (! strncmp($log[$i], '----', strlen('----'))) {
                continue;
            }

            // Line starts with r and has pipes (|), it contains data
            if (! strncmp($log[$i], 'r', strlen('r')) && strstr($log[$i], '|')) {
                $tmp  = explode('|', $log[$i]);
                $tmp  = array_map('trim', $tmp);
                $date = trim(preg_replace('~\(([:alpha]*.+)\)~i', '', $tmp[2]));
                $commits[] = [
                    'commit'  => ltrim($tmp[0], 'r'),
                    'author'  => $tmp[1],
                    'email'   => $tmp[1],
                    'date'    => DateTime::createFromFormat('Y-m-d H:i:s O', $date),
                    'summary' => $log[$i+1],
                    'vcs'     => $this->repository_type,
                ];
            }
        }

        return $commits;
    }
103774
public function getCommits($nbCommits = 10)
    {
        $output = $this->git(sprintf('log -n %d --date=%s --format=format:%s', $nbCommits, $this->dateFormat, $this->logFormat));
        return $this->parseLogsIntoArray($output);
    }
332617
protected function updateOutput(OutputInterface $output, array $lines = [])
    {
        foreach ($lines as $line) {
            $status = $line["status"] == "ok" ? "<fg=green>✓</fg=green>" : "<fg=red>✗</fg=red>";

            switch ($line['operation']) {
            case "creating":
                $operation = sprintf("<fg=green>%s</fg=green>", ucwords($line['operation']));
                break;
            case "overwriting":
                $operation = sprintf("<fg=cyan>%s</fg=cyan>", ucwords($line['operation']));
                break;
            case "deleting":
                $operation = sprintf("<fg=red>%s</fg=red>", ucwords($line['operation']));
                break;
            default:
                $operation = ucwords($line['operation']);
            }

            $output->writeln(
                sprintf(
                    " %s  %s file <fg=yellow>'%s'</fg=yellow>.",
                    $status,
                    $operation,
                    $line['file']
                )
            );
        }

        return $this;
    }
113406
private function createImages($output) {
        $image = array();
        
        foreach ($output as $key => $singleLine) {
            if (preg_match('/\(format/', $singleLine)) {
                $imageInfo  = $singleLine;
                $startPos   = strpos($imageInfo, "(") + 1;
                $endPos     = strpos($imageInfo, ")");
                $dataStr   = substr($imageInfo, $startPos, $endPos - $startPos);

                $dataExplode    = explode(",", $dataStr);
                $contentFormat  = explode(":", $dataExplode[0]);
                $format         = $contentFormat[1];
                $contentFormat  = explode(":", $dataExplode[1]);
                $type         = $contentFormat[1];

                $imageValue = $output[$key + 2];

                $exploded = explode(" ", $singleLine);
                $imagePath = array_shift($exploded);

                $image[] = new ZxingImage($imagePath, $imageValue, $format, $type);

            } else if(preg_match('/No barcode found/', $singleLine)) {
                
                $exploded = explode(" ", $singleLine);
                $imagePath = array_shift($exploded);
                $image[] = new ZxingBarNotFound($imagePath, 101, "No barcode found");
            }
        }

        return $image;
    }
1246677
protected function parseOutput(string $output): array
    {
        $lines = explode(PHP_EOL, $output);
        $issues = [];
        $lineNo = 1;
        foreach ($lines as $line) {
            $line = trim($line);
            if ('' === $line) {
                // Go to the next line
                $lineNo++;
                continue;
            }
            switch ($line[0]) {
                case '#':
                    $parts = explode(' ', $line);
                    $word = $parts[1];
                    $issue = new Issue($word);
                    $issue->line = $lineNo;
                    $issue->offset = trim($parts[2]);
                    $issues [] = $issue;
                    break;
                case '&':
                    $parts = explode(':', $line);
                    $parts[0] = explode(' ', $parts[0]);
                    $parts[1] = explode(', ', trim($parts[1]));
                    $word = $parts[0][1];
                    $issue = new Issue($word);
                    $issue->line = $lineNo;
                    $issue->offset = trim($parts[0][3]);
                    $issue->suggestions = $parts[1];
                    $issues [] = $issue;
                    break;
            }
        }

        return $issues;
    }
1184158
public function initializeInstallOutput(OutputInterface $output)
    {
        $progressBar = null;
        if ($output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) {
            // Low verbosity, use progress bar.
            $progressBar = new ProgressBar($output);
            $progressBar->setFormat(' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s% [%message%]');
        }

        return new InstallOutput(new ConsoleLogger($output), $progressBar);
    }
171862
protected function _buildArguments($arguments)
    {
        $output = [];

        foreach ($arguments as $argument => $value) {
            $output[] = $argument . ' ' . $value;
        }

        return implode(' ', $output);
    }
826367
public function parseOutput($output)
    {
        //if error code is returned, api OR the app will return an integer error code
        if ($this->isnum($output)) {
            switch ($output) {

                case 20:
                    return $this->lang['reports']['20'];
                    break;

                case 21:
                    return $this->lang['reports']['21'];
                    break;

                case 22:
                    return $this->lang['reports']['22'];
                    break;

                case 23:
                    return $this->lang['reports']['23'];
                    break;

                case 24:
                    return $this->lang['reports']['24'];
                    break;

                case 25:
                    return $this->lang['reports']['25'];
                    break;

                case 30:
                    return $this->lang['reports']['30'];
                    break;


                //In-app messages:
                case 100:
                    return $this->lang['app'][0];
                    break;

                case 101:
                    return $this->lang['app'][1];
                    break;

                case 102:
                    return $this->lang['app'][2];
                    break;

                default:
                    return $this->lang['reports']['999'];
                    break;

            }

            //returns from Mutlucell
        } elseif (preg_match('/(\$[0-9]+\#[0-9]+\.[0-9]+)/i', $output)) {
            //returned output is formatted like $ID#STATUS
            //E.g: $1234567#1.0
            $output = explode('#', $output);

            $status = $output[1];
            if ($status == '0.0') {
                return $this->lang['app']['101'];
            } else {
                return $this->lang['app']['100'];
            }

            //Unknown error
        } else {
            return $output;
        }
    }
607340
protected function _printLogo(&$output)
        {

            $output->writeLn('');
            $output->writeLn('');
            $output->writeLn('');
            $output->writeLn('<sw>          _           _                       _           </sw>');
            $output->writeLn('<sw>         | |         | |                     | |          </sw>');
            $output->writeLn('<sw>      ___| | __ _ ___| |____      _____  _ __| | _____    </sw>');
            $output->writeLn('<sw>     / __| |/ _` / __| \'_ \ \ /\ / / _ \| \'__| |/ / __|   </sw>');
            $output->writeLn('<sw>     \__ \ | (_| \__ \ | | \ V  V / (_) | |  |   <\__ \   </sw>');
            $output->writeLn('<sw>     |___/_|\__,_|___/_| |_|\_/\_/ \___/|_|  |_|\_\___/   </sw>');
            $output->writeLn('<fg=white>                                        web development   </fg=white>');
            $output->writeLn('');
            $output->writeLn('');
            $output->writeLn('                    [ <info>Cronjob Manager</info> ]');
            $output->writeLn('');
            $output->writeLn('');


        }
459741
protected function __parseLinkJoin($arguments, $method)
	{
		if(!isset($this->operationOption['join']))
		{
			$this->operationOption['join'] = array();
		}
		array_unshift($arguments,$method);
		$this->operationOption['join'][] = $arguments;
	}
1166786
public function commit($args = array()) {
		foreach ($args as $item) {
			$this->driver->exec($item);
		}
		return $this->driver->commit();
	}
911536
public function writeCommand($command, $args = [])
    {
        $output = $this->getOutput();
        if ($output->getLevel(LogLevel::INFO) < $output->getLevel()) {
            return;
        }

        if (count($args)) {
            $outArr = [];
            foreach ($args as $arg) {
                if (is_array($arg)) {
                    $arg = array_map(
                        function ($value) {
                            return '\'' . $value . '\'';
                        },
                        $arg
                    );
                    $outArr[] = '[' . implode(', ', $arg) . ']';
                    continue;
                }

                $outArr[] = '\'' . $arg . '\'';
            }
            $output->info(' -- ' . $command . '(' . implode(', ', $outArr) . ')');

            return;
        }

        $output->info(' -- ' . $command);
    }
895450
public function render(OutputInterface $output, ResultCollection $results)
    {
        $data = array_map(function (array $result) {
            return [
                'file' => $result[0],
                'commits' => $result[1],
                'complexity' => $result[2],
                'score' => $result[3],
            ];
        }, $results->toArray());

        $output->write(json_encode($data));
    }