Executes the job.

@throws \Exception throws an exception in case of errors

@return string returns a string describing the job result in case of success
171936
public function run()
    {
        $writer = $this->app->make(SitemapWriter::class);
        if (method_exists($this, 'canIncludePageInSitemap')) {
            // Add support for deprecated custom canIncludePageInSitemap
            $pageListGenerator = $this->app->make(DeprecatedPageListGenerator::class);
            $pageListGenerator->setDeprecatedChecker(function ($page, $instances) {
                return $this->canIncludePageInSitemap($page, $instances);
            });
            $writer->getSitemapGenerator()->setPageListGenerator($pageListGenerator);
        }
        $generator = $writer->getSitemapGenerator();
        if ($generator->getSiteCanonicalUrl() === '') {
            $request = $this->app->make(Request::class);
            if (!$request->getHost()) {
                throw new UserMessageException(t('Canonical URL is not set and there is no HTTP request to retrieve the site URL from.'));
            }
            $generator->setCustomSiteCanonicalUrl($request->getSchemeAndHttpHost());
        }
        $numPages = 0;
        $writer->generate(function (SitemapElement $data) use (&$numPages) {
            if ($data instanceof SitemapPage) {
                ++$numPages;
            }
        });
        $sitemapUrl = $writer->getSitemapUrl();
        if ($sitemapUrl === '') {
            $openLink = '';
        } else {
            $openLink = sprintf('<a href="%s" target="_blank">', h($sitemapUrl));
        }

        return t2(
            /*i18n: %2$s and %3$s contains HTML markup, %1$d is the number of pages */
            'The %2$ssitemap%3$s has been generated (%1$d page)',
            'The %2$ssitemap%3$s has been generated (%1$d pages)',
            $numPages,
            $openLink,
            $openLink === '' ? '' : '</a>'
        );
    }
838078
final public function execute()
	{
		if ($this->hadException()) {
			$this->setExceptionResponse($this->exception);
			return null;
		}

		$pageExtension = $this->container->getTemplating()->getExtension('supraPage');
		/* @var $pageExtension PageExtension */
		$pageExtension->setBlockExecutionContext(new BlockExecutionContext($this, $this->request));

		try {
			$this->doExecute();
		} catch (\Exception $e) {
			$this->exception = $e;
			$this->setExceptionResponse($e);
		}
	}
691554
public function execute()
    {
        if (!defined('ENABLE_SHELL_PLUGIN') || !ENABLE_SHELL_PLUGIN) {
            throw new \Exception(Lang::get('shell_not_enabled'));
        }

        $success = true;

        foreach ($this->commands as $command) {
            $command = $this->phpci->interpolate($command);

            if (!$this->phpci->executeCommand($command)) {
                $success = false;
            }
        }

        return $success;
    }
423721
public function run()
    {
        /*
         * Fetching Public Suffix List and parse suffixes.
         * */

        $lines = $this->httpAdapter->get(Update::PUBLIC_SUFFIX_LIST_URL);

        $parser = new Parser($lines);
        $suffixes = $parser->parse();

        /*
         * Write file with exclusive file write lock.
         * */

        $handle = @fopen($this->outputFileName, 'w+');

        if ($handle === false) {
            throw new Exceptions\IOException(error_get_last()['message']);
        }

        if (!flock($handle, LOCK_EX)) {
            throw new Exceptions\IOException(sprintf('Cannot obtain lock to output file (%s)', $this->outputFileName));
        }

        $suffixFile = '<?php' . PHP_EOL . 'return ' . var_export($suffixes, true) . ';';
        $writtenBytes = fwrite($handle, $suffixFile);

        if ($writtenBytes === false || $writtenBytes !== strlen($suffixFile)) {
            throw new Exceptions\IOException(sprintf('Write to output file (%s) failed', $this->outputFileName));
        }

        flock($handle, LOCK_UN);
        fclose($handle);
    }
565584
public function handle() {
		// If this is a reqular exception, always quit, else check the type
		if (!($this->exception instanceof \ErrorException)) {
			$this->quit = true;
		} else {
			// Only quit after specific error types
			switch ($this->exception->getSeverity()) {
				case E_ERROR:
				case E_CORE_ERROR:
				case E_USER_ERROR:
					$this->quit = true;
			}
		}

		if ($this->exception instanceof \ErrorException) {
			$error_type = \Skeleton\Error\Util\Misc::translate_error_code($this->exception->getSeverity());
		} else {
			$error_type = 'Exception';
		}

		$output = "\n";
		$output .= 'Error: ' . $this->exception->getMessage() . "\n";
		$output .= 'Type: ' . $error_type . "\n";
		$output .= 'File: ' . $this->exception->getFile() . "\n";
		$output .= 'Line: ' . $this->exception->getLine() . "\n";
		$output .= 'Time: ' . date('Y-m-d H:i:s') . "\n";

		if (!($this->exception instanceof \ErrorException)) {
			ob_start();
			debug_print_backtrace();
			$backtrace = ob_get_clean();

			$output .= "\n";
			$output .= $backtrace . "\n";
		}

		return $output;
	}
752490
public function execute()
    {
        try {
            $place_order_payload = $this->getRequest()->getParam('place_order_payload');
            $magentoStoreId = $this->getRequest()->getParam('store_id');
            // call the Bolt API
            $boltpayOrder = $this->cartHelper->getBoltpayOrder(true, $place_order_payload, $magentoStoreId);

            // format and send the response
            $cart = [
                'orderToken'  => $boltpayOrder ? $boltpayOrder->getResponse()->token : '',
                'authcapture' => true
            ];

            $hints = $this->cartHelper->getHints();

            $result = $this->dataObjectFactory->create();
            $result->setData('cart', $cart);
            $result->setData('hints', $hints);

            return $this->resultJsonFactory->create()->setData($result->getData());
        } catch (Exception $e) {
            $this->bugsnag->notifyException($e);
            throw $e;
        }
    }
70409
public function run()
    {
        $result = $this->executeCommand($this->getCommand());
        return !$result->wasSuccessful() && $this->failOnViolations
            ? $result
            : \Robo\Result::success($this, $result->getMessage(), $result->getData());
    }
1238080
public function execute()
    {
        $success = true;
        foreach ($this->commandList as $command) {
            if (!$this->runSingleCommand($command)) {
                $success = false;
                break;
            }
        }
        return $success;
    }
1311668
public function execute()
    {
        $this->_setOptions();

        $sResponse = $this->_execute();
        $this->_saveStatusCode();

        $iCurlErrorNumber = $this->_getErrorNumber();

        $this->_close();

        if ($iCurlErrorNumber) {
            $host = $this->getUrl();
            $parameters = http_build_query($this->getParameters(), "", "&");
            $message = $this->_getErrorMessage($iCurlErrorNumber);
            throw new Exception("cURL failed with message '$message' when calling '$host?$parameters'");
        }

        return $sResponse;
    }
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;
    }
393253
public function execute(): string
    {
        $calls  = $this->requestParser->parse($this->requestProvider->getPayload());
        $result = $this->processor->process($calls);

        return $this->responseBuilder->build($result);
    }
490304
public function execute()
    {
        $ch = curl_init();
        $this->setAuth($ch);
        try {
            switch (strtoupper($this->verb)) {
                case 'GET':
                    $this->executeGet($ch);
                    break;
                case 'POST':
                    $this->executePost($ch);
                    break;
                case 'PUT':
                    $this->executePut($ch);
                    break;
                case 'DELETE':
                    $this->executeDelete($ch);
                    break;
                default:
                    throw new \InvalidArgumentException(
                        'Current verb (' . $this->verb
                        . ') is an invalid REST verb.'
                    );
            }
        } catch (\InvalidArgumentException $e) {
            curl_close($ch);
            throw $e;
        } catch (\Exception $e) {
            curl_close($ch);
            throw $e;
        }

        /*
         * check and debug api request total time
         */
        $this->processDebugApi();

        return $this->responseBody;
    }
9008
private function render()
    {
        $output = '';

        foreach ($this->jobs as $job) {
            $output .= $this->getTaskDefinition($job);
        }

        return $output;
    }
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;
    }
1094610
public function handle()
    {
        $this->obsolete_regex = implode('|', array_map(function($key) {
            return preg_quote($key, '/');
        }, $this->config('never_obsolete_keys', [])));

        // Should commands display something
        $this->display = !$this->option('dirty');

        // Get all lemmas in a structured array
        $lemmas_structured = $this->getLemmasStructured();

        $this->line('');
        $this->line('Scan files:');

        foreach ($this->getLanguages() as $lang => $lang_path) {
            foreach ($lemmas_structured as $family => $array) {
                if ($this->option('verbose')) {
                    $this->line('');
                }

                // Set path to family file
                $file_lang_path = "{$lang_path}/{$family}.php";

                $this->line('    ' . $this->getShortPath($file_lang_path));

                // Get existing and new lemmas
                $old_lemmas = $this->getOldLemmas($file_lang_path);
                $new_lemmas = Arr::dot($array);

                // Reset the final lemma array
                $this->final_lemmas = [];
                $this->is_dirty = false;

                // Lemma processing
                $this->processNewLemmas($family, $new_lemmas, $old_lemmas);
                $this->processExistingLemmas($family, $old_lemmas, $new_lemmas);
                $this->processObsoleteLemmas($family, $old_lemmas, $new_lemmas);

                if ($this->is_dirty === true || $this->option('force')) {
                    // Sort final lemmas array by key
                    ksort($this->final_lemmas);

                    // Create a dumpy-dump
                    $this->jobs[$file_lang_path] = $this->dumpLemmas($this->final_lemmas);
                }
                else {
                    if ($this->option('verbose')) {
                        $this->line("        > <comment>Nothing to do for this file</comment>");
                    }
                }
            }
        }

        // For dirty mode, all the user wants is a return value from the
        // command. This is usually used for continuous integration.
        if ($this->option('dirty')) {
            return $this->has_new ? self::ERROR : self::SUCCESS;
        }

        // Save all lemmas
        $this->saveChanges();

        return self::SUCCESS;
    }
1196175
public function execute()
    {
        if (empty($this->xmlConfigFile) && empty($this->directory)) {
            $this->phpci->logFailure('Neither configuration file nor test directory found.');
            return false;
        }

        $success = true;

        $this->phpci->logExecOutput(false);

        // Run any config files first. This can be either a single value or an array.
        if ($this->xmlConfigFile !== null) {
            $success &= $this->runConfigFile($this->xmlConfigFile);
        }

        // Run any dirs next. Again this can be either a single value or an array.
        if ($this->directory !== null) {
            $success &= $this->runDir($this->directory);
        }

        $tapString = $this->phpci->getLastOutput();
        $tapString = mb_convert_encoding($tapString, "UTF-8", "ISO-8859-1");

        try {
            $tapParser = new TapParser($tapString);
            $output = $tapParser->parse();
        } catch (\Exception $ex) {
            $this->phpci->logFailure($tapString);
            throw $ex;
        }

        $failures = $tapParser->getTotalFailures();

        $this->build->storeMeta('phpunit-errors', $failures);
        $this->build->storeMeta('phpunit-data', $output);

        $this->phpci->logExecOutput(true);

        return $success;
    }
757299
public function execute()
    {
        if ($this->isCaseInsensitive())
            return mb_stristr($this->getValue(), $this->needle, $this->beforeNeedle);
        else
            return mb_strstr($this->getValue(), $this->needle, $this->beforeNeedle);
    }