Process source

@return void
@throws GridException
15092
public function processSource(): void
    {
        if (null === $this->adapter) {
            throw new GridException('Grid Adapter is not initiated, please update method `init()` and try again');
        }

        try {
            $this->data = $this->getAdapter()->process(
                $this->getPage(),
                $this->getLimit(),
                $this->getFilters(),
                $this->getOrders()
            );
        } catch (\Exception $e) {
            throw new GridException('Grid Adapter can\'t process request: '. $e->getMessage());
        }
    }
226645
protected function process()
    {
        $this->clearAllCaches();
        $this->purgeVisitedNodes();

        $xPath = new \DOMXPath($this->domDocument);
        $this->removeUnprocessableTags();
        $this->normalizeStyleAttributesOfAllNodes($xPath);

        // grab any existing style blocks from the html and append them to the existing CSS
        // (these blocks should be appended so as to have precedence over conflicting styles in the existing CSS)
        $allCss = $this->css;
        if ($this->isStyleBlocksParsingEnabled) {
            $allCss .= $this->getCssFromAllStyleNodes($xPath);
        }

        $excludedNodes = $this->getNodesToExclude($xPath);
        $cssRules = $this->parseCssRules($allCss);
        foreach ($cssRules['inlineable'] as $cssRule) {
            try {
                $nodesMatchingCssSelectors = $xPath->query($this->cssSelectorConverter->toXPath($cssRule['selector']));
            } catch (SyntaxErrorException $e) {
                if ($this->debug) {
                    throw $e;
                }
                continue;
            }

            /** @var \DOMElement $node */
            foreach ($nodesMatchingCssSelectors as $node) {
                if (\in_array($node, $excludedNodes, true)) {
                    continue;
                }
                $this->copyInlineableCssToStyleAttribute($node, $cssRule);
            }
        }

        if ($this->isInlineStyleAttributesParsingEnabled) {
            $this->fillStyleAttributesWithMergedStyles();
        }
        $this->postProcess($xPath);

        $this->removeImportantAnnotationFromAllInlineStyles($xPath);

        $this->copyUninlineableCssToStyleNode($xPath, $cssRules['uninlineable']);
    }
1294146
protected function process()
    {

        // add the path => entity ID/store view code mapping
        $this->addPathEntityIdMapping($path = $this->getValue(ColumnKeys::PATH));
        $this->addPathStoreViewCodeMapping($path, $this->getSubject()->getStoreViewCode(StoreViewCodes::ADMIN));

        // temporary persist the path
        $this->setLastPath($path);
    }
1087731
public function process(): void
    {
        /** @var \Closure|object $closure */
        $closure = include $this->file;

        if (!\is_callable($closure)) {
            throw new ComponentException("There is no callable structure in file `{$this->file}`");
        }

        $reflection = new \ReflectionFunction($closure);

        // check and normalize params by doc comment
        $docComment = $reflection->getDocComment();

        // get all options by one regular expression
        if (preg_match_all('/\s*\*\s*\@([a-z0-9-_]+)\s+(.*).*\s+/i', $docComment, $matches)) {
            foreach ($matches[1] as $i => $key) {
                $this->setOption($key, trim($matches[2][$i]));
            }
        }

        // init routes
        $this->initRoute();

        // get params and convert it to simple array
        $reflectionParams = $reflection->getParameters();
        // setup params and optional params
        foreach ($reflectionParams as $param) {
            $name = $param->getName();
            // if some function params is missed in description
            if (!isset($this->params[$name])) {
                $this->params[$name] = null;
            }
            if ($param->isOptional()) {
                $this->values[$name] = $param->getDefaultValue();
            }
        }
    }
1130179
public function process()
    {
        parent::process();

        $data = &$this->getForm()->getFormData();
        if (isset($data[$this->id])) {
            $this->value = $data[$this->id];
        } else {
            $this->value = null;
        }

        $this->value = ltrim($this->value, '#');

        if ($this->value == '') {
            $this->value = null;
        }

        if ($this->required && $this->value === null) {
            $this->addMessage($this->getValidationMessage('required'));
        } elseif (
            $this->value !== null &&
            !$this->validateColor($this->value)
        ) {
            $message = sprintf(
                Swat::_('“%s” is not a valid color.'),
                $this->value
            );

            $this->addMessage(new SwatMessage($message, 'error'));
        }
    }
296356
private function process(ViewSource $source, ContextInterface $context): ViewSource
    {
        foreach ($this->processors as $processor) {
            $source = $processor->process($source, $context);
        }

        return $source;
    }
551505
public function process()
    {
        parent::process();
        try {
            $this->profile = Teleport::loadProfile($this->profile);

            $this->getMODX($this->profile);

            $this->tpl = $this->loadTpl($this->tpl);

            $this->package = $this->createPackage($this->getName(), $this->getVersion(), $this->getSequence());

            if (isset($this->tpl['attributes'])) {
                foreach ($this->tpl['attributes'] as $attribute => $attributeValue) {
                    if (is_array($attributeValue) && isset($attributeValue['sourceType']) && isset($attributeValue['source'])) {
                        switch ($attributeValue['sourceType']) {
                            case 'fileContent':
                                $attributeValue = file_get_contents($attributeValue['source']);
                                break;
                        }
                    }
                    $this->package->setAttribute($attribute, $attributeValue);
                }
            }

            foreach ($this->tpl['vehicles'] as $vehicle) {
                $this->createVehicles($vehicle);
            }

            if (!$this->package->pack()) {
                throw new ActionException($this, "Error packing {$this->package->signature}.transport.zip");
            }
            $this->request->log("Successfully extracted {$this->package->signature}.transport.zip from instance {$this->profile->code}");
            if ($this->target && $this->push) {
                if (!$this->push($this->package->path . $this->package->signature . '.transport.zip', $this->target . $this->package->signature . '.transport.zip')) {
                    throw new ActionException($this, "Error pushing {$this->package->signature}.transport.zip to {$this->target}");
                }

                if (!$this->preserveWorkspace && $this->modx->getCacheManager()) {
                    $this->modx->cacheManager->deleteTree($this->package->path . $this->package->signature);
                    @unlink($this->package->path . $this->package->signature . '.transport.zip');
                }

                $this->request->log("Successfully pushed {$this->package->signature}.transport.zip to {$this->target}");
                $this->request->log("{$this->target}{$this->package->signature}.transport.zip", false);
            } else {
                $this->request->log("{$this->package->path}{$this->package->signature}.transport.zip", false);
            }
        } catch (\Exception $e) {
            throw new ActionException($this, "Error Extracting snapshot: " . $e->getMessage(), $e);
        }
    }
357767
public function process() {
		$remainingChildren = $this->remainingChildren;

		if (!count($remainingChildren)) {
			$this->isComplete = true;
			return;
		}

		$this->currentStep++;

		// lets process our first item
		$pair = array_shift($remainingChildren);
		$sourceObject = ExternalContent::getDataObjectFor($pair->sourceID);
		if (!$sourceObject) {
			$this->addMessage("Missing source object for " . $pair->sourceID, 'WARNING');
			$this->remainingChildren = $remainingChildren;
			return;
		}

		$targetObject = DataObject::get_by_id($pair->targetType, $pair->targetID);
		if (!$targetObject) {
			$this->addMessage("Missing target object for $pair->targetType $pair->sourceID", 'WARNING');
			$this->remainingChildren = $remainingChildren;
			return;
		}

		// lets do a single import first, then check the children and append them
		$pageType = $this->getExternalType($sourceObject);
		if (isset($this->contentTransforms[$pageType])) {
			$transformer = $this->contentTransforms[$pageType];

			$result = $transformer->transform($sourceObject, $targetObject, $this->duplicateStrategy);

			// if there's more, then transform them
			if ($this->includeChildren && $result && $result->children && count($result->children)) {
				foreach ($result->children as $child) {
					$remainingChildren[] = new EC_SourceTarget($child->ID, $result->page->ID, $result->page->ClassName);
					$this->totalSteps++;
				}
			}
		}

		$this->remainingChildren = $remainingChildren;

		if (!count($remainingChildren)) {
			$this->isComplete = true;
			return;
		}
	}
1267293
public function exec(): void
    {
        $this->queryExecuted = false;
        $sql = $this->getSQL();
        $adapter = $this->getAdapter();

        $adapter->prepare($sql);
        $bindings = $this->getBindings();

        try {
            foreach ($bindings->getBindings() as $bind) {
	            $adapter->getStatement()->bindValue($bind->getParameter(), $bind->getValue(), $bind->getType());
            }

	        $adapter->getStatement()->execute();

            Log::sql("{$this->adapter}>>>\n{$this->debug()}");
        } catch (PDOException $e) {
            // more descriptive error handling when query fails

            switch ($e->getCode()) {
                case 'HY093': // PDO miss match parameter count
                    //Log::debug("[{$e->getCode()}] Tried and failed to execute SQL query:\n{$sql}");
                    //Log::debug('BINDINGS', $bindings->getAsArray());
	                $exception = new QueryException("[{$e->getCode()}] Query bindings parameter miss match: {$e->getMessage()}", (int) $e->getCode(), $e);
                    break;

                default:
                    //Log::debug("[{$e->getCode()}] Tried and failed to execute SQL query:\n{$this->debug()}");
	                $exception = new QueryException("[{$e->getCode()}] Tried and failed to execute SQL query: {$e->getMessage()}", (int) $e->getCode(), $e);
                    break;
            }

            $exception->setAdapter($adapter->getConfigKey());
	        $exception->setSql($this->debug());
	        $exception->setBindings($bindings);
	        $exception->setWasPrepared(true);
            throw $exception;
        }

        $this->queryExecuted = true;
    }
463888
private function processAdministrator()
	{
		$sourceFolder = $this->getSourceFolder();
		$this->processComponents($sourceFolder . '/administrator/components', $this->target . '/administrator');
		$this->processLanguage($sourceFolder . '/administrator/language', $this->target . '/administrator');
		$this->processModules($sourceFolder . '/administrator/modules', $this->target . '/administrator/modules');
	}
1049304
public function main()
  {
    // Get base info about project.
    $this->prepareProjectData();

    // Get all info about source files.
    $this->getInfoSourceFiles();

    // Get all info about resource files.
    $this->getInfoResourceFiles();

    // Prepare all place holders.
    $this->preparePlaceHolders();

    // Replace references to resource files with references to optimized/minimized resource files.
    $this->processingSourceFiles();

    // Compress and rename files with hash.
    $this->processResourceFiles();

    // Create pre-compressed versions of the optimized/minimized resource files.
    if ($this->gzipFlag) $this->gzipCompressOptimizedResourceFiles();

    // Remove original resource files that are optimized/minimized.
    $this->unlinkResourceFiles();
  }
371425
protected function doExecute()
    {
        if ($this->console->getMode() !== 'dev') {
            throw new \RuntimeException(
                '<error>STOP!</error> please run <info>' . $this->getEnvCmd() . '</info>.'
            );
        }

        if (!$this->getOption('no-backup')) {
            // backup
            BackupRepository::getInstance()->setCommand($this)->backup();
        }

        $class = $this->console->get('seed.class');

        /** @var \Windwalker\Core\Seeder\AbstractSeeder $seeder */
        $seeder = $this->console->container->newInstance($class, ['command' => $this]);

        try {
            $this->console->container->call([$seeder, 'doExecute']);
        } catch (\PDOException $e) {
            if ($this->getOption('v')) {
                $this->out("\n\nError SQL: " . $this->console->database->getQuery());
            }

            throw $e;
        }

        return true;
    }
287177
def _ProcessCommandSource(self, source):
    """"""
    action = standard.ExecuteCommandFromClient
    request = rdf_client_action.ExecuteRequest(
        cmd=source.base_source.attributes["cmd"],
        args=source.base_source.attributes["args"],
    )
    yield action, request
725221
protected function process()
    {

        // load email and website code
        $email = $this->getValue(ColumnKeys::EMAIL);
        $website = $this->getValue(ColumnKeys::WEBSITE);

        // add the customer identifier => entity ID mapping
        $this->addCustomerIdentifierEntityIdMapping($email, $website);

        // clean-up the repositories etc. to free memory
        $this->getCustomerBunchProcessor()->cleanUp();

        // temporary persist the last customer identifier
        $this->setLastIdentifier(array($email, $website));
    }
62763
public function process()
    {
        // Migrate init - to create migration table
        $name = $this->argument('name');

        if (!is_null($name)) {
            if (string_has($name, ',')) {
                $this->seeder()->executeOnly($name);
            } else {
                $this->seeder()->executeOnly($name);
            }
        }

        $this->seeder()->run();

        $this->info('Seeding Completed Successfully!');
    }
33387
public function build()
    {
        if ($this->builded) {
            return;
        }

        $collection = $this->processFilter(false);

        $data = $collection->toArray();

        $this->prependRowSelectorColumn();
        $this->appendActionsColumn();

        Column::setOriginalGridModels($collection);

        $this->columns->map(function (Column $column) use (&$data) {
            $data = $column->fill($data);

            $this->columnNames[] = $column->getName();
        });

        $this->buildRows($data);

        $this->builded = true;
    }
8156
public function process()
    {
        parent::process();

        $data = $this->getForm()->getFormData();

        $this->crop_width = $data[$this->id . '_width'];
        $this->crop_height = $data[$this->id . '_height'];
        $this->crop_left = $data[$this->id . '_x'];
        $this->crop_top = $data[$this->id . '_y'];

        // deprecated aliases
        $this->crop_box_width = $this->crop_width;
        $this->crop_box_height = $this->crop_height;
        $this->crop_box_left = $this->crop_left;
        $this->crop_box_top = $this->crop_top;
    }