run the casperJS script and return the stdOut
in using the output variable

@return array
@throws \Exception
320520
public function run()
    {
        $output = array();

        $fragment = <<<FRAGMENT
casper.then(function () {
    this.echo('$this->TAG_CURRENT_URL' + this.getCurrentUrl());
    this.echo('$this->TAG_CURRENT_TITLE' + this.getTitle());
    this.echo('$this->TAG_CURRENT_PAGE_CONTENT' + this.getPageContent().replace(new RegExp('\\r?\\n','g'), ''));
    this.echo('$this->TAG_CURRENT_HTML' + this.getHTML().replace(new RegExp('\\r?\\n','g'), ''));
    this.echo('$this->TAG_CURRENT_HEADERS' + JSON.stringify(this.currentResponse.headers));
    this.echo('$this->TAG_CURRENT_STATUS' + this.currentResponse.status);
    this.echo('$this->TAG_CURRENT_STATUS_TEXT' + this.currentResponse.statusText);
    this.echo('$this->TAG_CURRENT_COOKIES' + JSON.stringify(phantom.cookies));
});

casper.run();

FRAGMENT;

        $this->script .= $fragment;
        $filename = tempnam($this->tempDir, 'php-casperjs-');

        file_put_contents($filename, $this->script);

        // options parsing
        $options = '';
        foreach ($this->options as $option => $value) {
            $options .= ' --' . $option . '=' . $value;
        }

        exec($this->path2casper . 'casperjs ' . $filename . $options, $output);
        if (empty($output)) {
            throw new \Exception('Can not find CasperJS.');
        }

        $this->setOutput($output);
        $this->processOutput();

        unlink($filename);

        return $output;
    }
262856
public function run()
    {
        if (!isset($_SERVER['argv'][1])) {
            $_SERVER['argv'][1] = 'commands';
        }

        $input = $_SERVER['argv'][1];

        // Force `commands` command
        if (in_array(strtolower(trim($input)), ['-h', '--help', 'help'], true)) {
            $input = $_SERVER['argv'][1] = 'commands';
        }

        if (in_array(strtolower(trim($input)), ['--version', '-v', '--info'], true)) {
            $input = $_SERVER['argv'][1] = 'info';
        }

        // Try to dispatch the command
        foreach ($this->_commands as $command) {
            if ($command->hasIdentifier($input)) {
                return $this->dispatch($command);
            }
        }

        // Check for alternatives
        $available = [];
        foreach ($this->_commands as $command) {
            $providedCommands = $command->getCommands();
            foreach ($providedCommands as $alias) {
                $soundex = soundex($alias);
                if (!isset($available[$soundex])) {
                    $available[$soundex] = [];
                }

                $available[$soundex][] = $alias;
            }
        }

        // Show exception with/without alternatives
        $soundex = soundex($input);
        $message = sprintf('%s is not a recognized command.', $input);

        if (isset($available[$soundex])) {
            throw new ScriptException(sprintf('%s Did you mean: %s?', $message, join(' or ', $available[$soundex])));
        }

        throw new ScriptException($message);
    }
930917
protected function output()
    {
        // first get content to local var
        $content = $this->getContentRaw();

        // iterate log content
        foreach ($content as $logEntry) {
            // Get color
            $color = $this->getColorByType($logEntry['type']);

            // Show the message
            pre(
                $logEntry['time'].' '.
                '['.$logEntry['type'].'] '.
                $logEntry['fingerprint'].' '.
                $logEntry['message'].
                $this->getLineSeparator(),
                false,
                $color
            );
        }

        // So we can clear the existing log
        $this->clear();
    }
721061
public function executeJob()
    {
        // If the job's already running, don't try to restart it
        if ($this->getJobStatus() !== 'RUNNING') {
            $queue = $this->markStarted();

            // Prepare the queue for processing
            $this->start($queue);
        } else {
            $queue = $this->getQueueObject();
        }

        try {
            $batchSize = $this->getJobQueueBatchSize() ?: PHP_INT_MAX;

            // Loop over queue batches
            while (($messages = $queue->receive($batchSize)) && $messages->count() > 0) {
                // Run the batch
                $this->executeBatch($messages, $queue);
            }

            // Mark the queue as finished
            $output = $this->finish($queue);

            // Mark the job as completed
            $result = $this->markCompleted(0, $output);
        } catch (\Exception $e) {
            $result = $this->markCompleted(Job::JOB_ERROR_EXCEPTION_GENERAL, $e->getMessage());
            $result->message = $result->result; // needed for progressive library.
        }

        return $result;
    }
1117489
public function run() {
        // Use the global $argv variable to retrieve command-line arguments
        global $argv;
        
        // index[0] is the script name and index[1] is the command name
        if (isset($argv[1])) {
            // Get the command through map
            $commandName = strtolower($argv[1]);

            if (isset($this->_commands[$commandName])) {
                $cmd = $this->_commands[$commandName];

                // Execute the command
                return call_user_func($cmd, $this->_input, $this->_output);
            } else {
                // Command not found
                exit('Command not found: "' . $commandName . '"' . PHP_EOL);
            }
        }

        // Call the default command if set
        if (!is_null($this->_default) && is_callable($this->_default)) {
            return call_user_func($this->_default, $this->_input, $this->_output);
        }
    }
149099
public function run()
    {
        $tag = ArrayHelper::remove($this->options, 'tag', 'div');
        $html[] = Html::beginTag($tag, $this->options);

        if (!$this->useNoUiSlider) {
            $html[] = $this->renderHtml5RangeInput();
        } else {
            $html[] = $this->renderNoUiSlider();
        }

        $html[] = Html::endTag($tag);
        return implode("\n", $html);
    }
973456
public function run()
    {
        //Bogus variable set. The original value is never used, but IDEs complain
        $result = new Result();
        $resultArray = array();
        $max = count($this->commands);

        for ($i = 0; $i < $max; ++$i) {
            $cmd = $this->commands[$i];

            if ($i === 0) {
                $resultArray[] = $result = $cmd->run();
                continue;
            }

            if (($cmd->_runMode === RUN_IF_PREVIOUS_SUCCEEDS && $result->getExitCode() !== 0) ||
                ($cmd->_runMode === RUN_IF_PREVIOUS_FAILS && $result->getExitCode() === 0)
            ) {
                continue;
            }

            if ($cmd->_pipe) {
                $stdOut = trim($result->getStdOut());

                $isXArg = false;
                foreach ($cmd as $argIdx => $arg) {
                    if ($arg instanceof Argument) {
                        if (stripos($arg->getKey(true), PIPE_PH) !== false) {
                            $key = str_replace(PIPE_PH, $stdOut, $arg->getKey(true));
                            $arg->setKey($key);
                        }

                        $values = $arg->getValues();
                        foreach ($values as $index => $val) {
                            if (stripos($val, PIPE_PH) !== false) {
                                $val = str_replace(PIPE_PH, $stdOut, $val);
                                $arg->replaceValue($index, $val);
                                $isXArg = true;
                            }
                        }
                    }
                }
                if (!$isXArg) {
                    $cmd->setStdIn($stdOut);
                }
            }

            $resultArray[] = $result = $cmd->run();
        }

        return $resultArray;
    }
607664
public function output() {
		$arguments = func_get_args();
		$this->pager->page();
		$result = [];

		if (count($arguments) == 1) {
			$headers = $arguments[0];
			$fields = $arguments[0];
		} elseif (count($arguments == 2)) {
			$headers = $arguments[0];
			$fields = $arguments[1];
			if (count($headers) != count($fields)) {
				throw new \Exception('If headers and fields are given, both should have an equal amount of values');
			}
		} else {
			throw new \Exception('This function requires 1 or 2 arrays as parameter: The first is the header, second are the field names or closures.');
		}


		foreach ($this->pager->items as $item) {
			$row = [];
			foreach ($headers as $key => $header) {
				if (is_callable($fields[$key])) {
					$row[$header] = $fields[$key]($item);
				} else {
					$row[$header] = \Skeleton\Pager\Util::object_get_attribute($item, $fields[$key]);
				}
			}
			$result[] = $row;
		}

		$this->output_array($headers, $result);

	}
320007
public function dump()
	{
		if ((bool) defined('STDIN'))
		{
			// no fancy flying on the commandline, just dump 'm
			foreach (func_get_args() as $arg)
			{
				var_dump($arg);
			}
		}
		else
		{
			// @codeCoverageIgnoreStart
			call_user_func_array(array($this, 'dumpAsHtml'), func_get_args());
			// @codeCoverageIgnoreEnd
		}
	}
684292
public function executeJob()
    {
        $this->markStarted();
        try {
            $resultMsg = $this->run();
            if (strlen($resultMsg) == 0) {
                $resultMsg = t('The Job was run successfully.');
            }
            $error = static::JOB_SUCCESS;
        } catch (\Exception $e) {
            $resultMsg = $e->getMessage();
            $error = static::JOB_ERROR_EXCEPTION_GENERAL;
        }

        $je = new Event($this);
        Events::dispatch('on_job_execute', $je);

        $obj = $this->markCompleted($error, $resultMsg);

        return $obj;
    }
1049943
public function execute()
    {
        if (!empty($this->args[1])) {
            $this->args[0] .= "', '".str_replace('\'', '"', $this->args[1]);
        }

        HTML\Generator::call(
            'script',
            array(
                str_replace(':UA:', $this->args[0], self::JS)
            ),
            array(
                'compress',
                'inlineInner',
                'noCache'
            )
        );
    }
792976
public function execute()
    {
        list($ignore) = $this->getFlags();

        $phplint = $this->phpci->findBinary('parallel-lint');

        $cmd = $phplint . ' -e %s' . '%s %s "%s"';
        $success = $this->phpci->executeCommand(
            $cmd,
            $this->extensions,
            ($this->shortTag ? ' -s' : ''),
            $ignore,
            $this->directory
        );

        $output = $this->phpci->getLastOutput();

        $matches = array();
        if (preg_match_all('/Parse error\:/', $output, $matches)) {
            $this->build->storeMeta('phplint-errors', count($matches[0]));
        }

        return $success;
    }
651919
public function execute()
    {
        $returnValues = array();
        
        while ($execute = array_shift($this->executeParameters)) {
            $returnValues[] = $this->run($execute);
        }
        
        return $returnValues;
    }
674799
public function output()
    {
        if (!file_exists($this->_file))
            throw new RuntimeException(
                "Error loading template file: $this->_file.", 
                1
            );

        $output = file_get_contents($this->_file);
        
        foreach ($this->_vars as $key => $value) {
            $tagToReplace = "[@$key]";
            $output = str_replace($tagToReplace, $value, $output);
        }

        return $output;
    }
451146
public static function Start()
	{
		// Retrieve the global variables
		if(!$argv) $argv = $_SERVER["argv"];

		// Get the console variables
		$functionName = $argv[1];
		$rows = explode(",", $argv[2]);
		$vars = array();
		foreach($rows as $row)
		{
			$parts = explode("=", $row);
			$vars[$parts[0]] = $parts[1];
		}

		// Prepare the console
		$console = new Console;

		// Run the console
		try
		{
			return $console->Run($functionName, $vars);
		}
		catch(\Exception $ex)
		{
			return "\nError: " . $ex->getMessage() . "\n";
		}
	}
72376
public function run()
    {
        $html[] = Html::beginTag('div', $this->options);

        // Visible button
        $html[] = Button::widget([
            'tagName' => $this->buttonTagName,
            'label' => $this->buttonLabel,
            'encodeLabel' => $this->buttonEncodeLabel,
            'options' => $this->buttonOptions,
            'icon' => $this->buttonIcon
        ]);

        $html[] = $this->renderItems();
        $html[] = Html::endTag('div');

        return implode("\n", $html);
    }
302923
public function output()
    {
        $output = $this->outputType();
        switch ($output) {
            case static::PROPERTY_DISPLAY:
                $type   = $this->displayType();
                $prop   = $this->display();
                $getter = 'displayId';
                $setter = 'setDisplayId';
                break;

            case static::PROPERTY_CONTROL:
                $type   = $this->inputType();
                $prop   = $this->input();
                $getter = 'inputId';
                $setter = 'setInputId';
                break;
        }

        $GLOBALS['widget_template'] = $type;

        if ($this->l10n() && $this->loopL10n()) {
            $locales  = $this->translator()->availableLocales();
            $outputId = $prop->{$getter}();
            foreach ($locales as $langCode) {
                // Set a unique property output ID for each locale.
                $prop->{$setter}($outputId.'_'.$langCode);
                $prop->setLang($langCode);

                yield $prop;
            }

            $GLOBALS['widget_template'] = '';
            $prop->{$setter}($outputId);
        } else {
            yield $prop;

            $GLOBALS['widget_template'] = '';
        }
    }