{@inheritdoc}
@SuppressWarnings(PHPMD.ExcessiveMethodLength)
765391
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();

        $setup->getConnection()->addColumn(
            $setup->getTable('quote'),
            'bolt_parent_quote_id',
            [
                'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
                'nullable' => true,
                'default' => null,
                'unsigned' => true,
                'comment' => 'Original Quote ID'
            ]
        );

        $setup->getConnection()->addColumn(
            $setup->getTable('quote'),
            'bolt_reserved_order_id',
            [
                'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                'length' => 64,
                'nullable' => true,
                'comment' => 'Bolt Reserved Order Id'
            ]
        );

        $setup->getConnection()->addIndex(
            $setup->getTable('quote'),
            $setup->getIdxName('quote', ['bolt_parent_quote_id']),
            ['bolt_parent_quote_id']
        );

        $setup->endSetup();
    }
1068332
public function execute(InputInterface $input = null, OutputInterface $output = null)
    {
        $this->application->addCommands($this->servicesCommandsProvider->getCommands());
        $this->application->run($input, $output);
    }
491684
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $method = $this->method;
        $this->setHelperSet($this->getApplication()->getHelperSet());
        if ($this->argument != null) {
            $argument = $input->getArgument($this->argument);
            $this->$method($argument);

            return;
        }

        $this->$method($input,$output);
    }
355347
public function getStmt()
    {
        // Make sure there are no nested arrays
        if (ArrayUtils::hasAtLeastOneArrayValue($this->bindings)) {
            throw new RuntimeException('PDO bindings can not contain nested arrays');
        }

        // Build target query before bindings are cleared purely for logging purpose
        $log = str_replace(array_keys($this->bindings), array_values($this->bindings), $this->queryBuilder->getQueryString());

        // Execute it
        $stmt = $this->pdo->prepare($this->queryBuilder->getQueryString());
        $stmt->execute($this->bindings);

        // Log target query
        $this->queryLogger->add($log);

        // Clear the buffer
        $this->clear();

        return $stmt;
    }
458688
public function request($method = null)
	{
		# Verifying if was set method.
		if (!is_null($method)) $this->setMethod($method);
		
		# Verifying if URI is setted.
		if (is_null($this->uri)) {
			throw new RuntimeException('URI must be set before calling request method.');
		}
		
		# Setting default CURL options
		$this->setCurlOpts($this->defaultCurlOpts);
		
		# Verifying and preparing request for specified method.
		switch ($this->method) {
			case 'GET' : 
				// Specific routines for GET request.
				break;
			case 'POST' :
				$this->setCurlOpts(CURLOPT_POST, true); 
				
				if ($this->useRawData) {
					$this->setCurlOpts(CURLOPT_POSTFIELDS, $this->dataRaw);
				} else {
					// Verifying if has files to send
					if (count($this->files) > 0) {
						foreach ($this->files as $k => $v) {
							// Verifying if PHP version is over 5.4
							if (PHP_VERSION_ID < 50500) {
								$this->setParameterPost($k, "@$v");
							} else {
								$cFile = new CURLFile($v,mime_content_type($v),$k);
								$this->setParameterPost($k, $cFile);
							}
						} 
					}
					$this->setCurlOpts(CURLOPT_POSTFIELDS, $this->paramsPost);
				}
				break;
			case 'PUT' : 
				$this->setCurlOpts(CURLOPT_CUSTOMREQUEST, "PUT");
				if ($this->useRawData) {
					$this->setCurlOpts(CURLOPT_POSTFIELDS, $this->dataRaw);
				} else {
					$data = http_build_query($this->paramsPost);
					$this->setCurlOpts(CURLOPT_POSTFIELDS, $data);
				}
				break;
			case 'DELETE' : 
				$this->setCurlOpts(CURLOPT_CUSTOMREQUEST, "DELETE");
				break;
		}
		
		# Rendering GET parameters into a query string.
		$queryString = (count($this->paramsGet) > 0) ? '?' . http_build_query($this->paramsGet) : '';
		
		# Preparing and setting URI in CURL options
		$uri = $this->uri . $queryString;
		$this->setCurlOpts(CURLOPT_URL, $uri);
		
		# Parsing headers
		$headers = array();
		foreach ($this->headers as $key => $value) {
			$headers[] = $key . ': ' . $value;
		}
		$this->setCurlOpts(CURLOPT_HTTPHEADER, $headers);
		
		# Setting remaining options in CURL
		$this->setCurlOpts(array(
			CURLOPT_HTTP_VERSION=>$this->httpVersion,
		));
		
		# Initializing Request
		$ch = curl_init();
		curl_setopt_array($ch, $this->curlOpts);
		
		# Performing Request
		$response = curl_exec($ch);
		
		# Verifying if request was successfully executed.
		if (!$response) {
			throw new RuntimeException('cURL Request Error: ' . curl_errno($ch));
		}
		
		# Closing handle
		curl_close($ch);
		
		# Verifying if a custom response handler was set
		if (!is_null($this->responseHandler)) {
			$this->response = $this->responseHandler->fromString($response);
		} else {
			$this->response = Response::fromString($response);
		}
		
		# Saving last instance in Client
		$this->lastRequest = clone $this;
		
		# Verifying noReset control var
		if (!$this->noReset) {
			$this->reset();
		}
		
		return $this->response;
	}
448182
public function prepare()
    {
        if (is_array($this->dataPrepared)) {
            return false;
        }

        $data = $this->data;

        foreach ($data as $key => &$row) {
            $row = (array) $row;

            $ids = [];

            foreach ($this->getColumns() as $col) {
                /* @var $col \ZfcDatagrid\Column\AbstractColumn */

                if (isset($row[$col->getUniqueId()]) && $col->isIdentity() === true) {
                    $ids[] = $row[$col->getUniqueId()];
                }

                /*
                 * Maybe the data come not from another DataSource?
                 */
                if ($col instanceof Column\ExternalData) {
                    /* @var $col \ZfcDatagrid\Column\ExternalData */
                    // @todo improve the interface...
                    $dataPopulation = $col->getDataPopulation();

                    foreach ($dataPopulation->getObjectParametersColumn() as $parameter) {
                        $dataPopulation->setObjectParameter(
                            $parameter['objectParameterName'],
                            $row[$parameter['column']->getUniqueId()]
                        );
                    }
                    $row[$col->getUniqueId()] = $dataPopulation->toString();
                }

                if (! isset($row[$col->getUniqueId()])) {
                    $row[$col->getUniqueId()] = '';
                }

                /*
                 * Replace
                 */
                if ($col->hasReplaceValues() === true) {
                    $replaceValues = $col->getReplaceValues();

                    if (is_array($row[$col->getUniqueId()])) {
                        foreach ($row[$col->getUniqueId()] as &$value) {
                            if (isset($replaceValues[$value])) {
                                $value = $replaceValues[$value];
                            } elseif ($col->notReplacedGetEmpty() === true) {
                                $value = '';
                            }
                        }
                    } else {
                        if (isset($replaceValues[$row[$col->getUniqueId()]])) {
                            $row[$col->getUniqueId()] = $replaceValues[$row[$col->getUniqueId()]];
                        } elseif ($col->notReplacedGetEmpty() === true) {
                            $row[$col->getUniqueId()] = '';
                        }
                    }
                }

                /*
                 * Type converting
                 */
                if ($this->getRendererName() != 'PHPExcel') {
                    $row[$col->getUniqueId()] = $col->getType()->getUserValue($row[$col->getUniqueId()]);
                }

                /*
                 * Translate (nach typ convertierung -> PhpArray...)
                 */
                if ($col->isTranslationEnabled() === true) {
                    if (is_array($row[$col->getUniqueId()])) {
                        foreach ($row[$col->getUniqueId()] as &$value) {
                            if (is_array($value)) {
                                continue;
                            }
                            $value = $this->getTranslator()->translate($value);
                        }
                    } else {
                        $row[$col->getUniqueId()] = $this->getTranslator()->translate($row[$col->getUniqueId()]);
                    }
                }

                /*
                 * Trim the values
                 */
                if (is_array($row[$col->getUniqueId()])) {
                    array_walk_recursive($row[$col->getUniqueId()], function (&$value) {
                        if (! is_object($value)) {
                            $value = trim($value);
                        }
                    });
                } elseif (! is_object($row[$col->getUniqueId()])) {
                    $row[$col->getUniqueId()] = trim($row[$col->getUniqueId()]);
                }

                /*
                 * Custom formatter
                 */
                if ($col->hasFormatters() === true) {
                    foreach ($col->getFormatters() as $formatter) {
                        $formatter->setRowData($row);
                        $formatter->setRendererName($this->getRendererName());

                        $row[$col->getUniqueId()] = $formatter->format($col);
                    }
                }
            }

            // Concat all identity columns
            if (!empty($ids)) {
                $data[$key]['idConcated'] = implode('~', $ids);
            }
        }

        $this->dataPrepared = $data;

        return true;
    }
97386
public function init()
    {
        if (!$this->getQuery()) {
            throw new \RuntimeException('Uninitialized QueryBuilder');
        }

        $this->resetIterator();
        $this->setNbResults($this->computeNbResult());

        if (0 == $this->getPage() || 0 == $this->getMaxPerPage() || 0 == $this->getNbResults()) {
            $this->setLastPage(0);
            $this->getQuery()->setFirstResult(0);
            $this->getQuery()->setMaxResults(0);
        } else {
            $offset = ($this->getPage() - 1) * $this->getMaxPerPage();
            $this->setLastPage(ceil($this->getNbResults() / $this->getMaxPerPage()));
            $this->getQuery()->setFirstResult($offset);
            $this->getQuery()->setMaxResults($this->getMaxPerPage());
        }
    }
452791
public function execute($objectContext)
    {
        if (method_exists($objectContext, $this->method))
        {
            if (!empty($this->parameters))
            {
                $objectContext->{$this->method}($this->parameters);
            }
            else
            {
                $objectContext->{$this->method}($this->parameters);
            }
        }
    }
1281580
public function run(InputInterface $input = null, OutputInterface $output = null)
    {
        if ($input !== null) {
            $in = $input;
        } else {
            $in = $this->getInput();
        }

        return parent::run($in, $output);
    }
304495
public function equals($id)
    {
        if ($id instanceof ModelIdInterface) {

            return ($id->getValue() === $this->value);
        } elseif (is_a($id, $this->getModelClass(), true)) {

            $model = $id;

            if (!$model instanceof ModelInterface) {
                throw new \RuntimeException(sprintf('Model class %s must implement ModelInterface', get_class($model)));
            }

            return ($this->equals($model->id()->getValue()));
        }

        return ($this->getValue() === (string)$id);
    }
221560
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$value, $namedParameters, $placement )
    {
        $phpname = $this->PHPNames[$operatorName];
        if ( $value !== null )
            $operand = $value;
        else
            $operand = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement );
        $value = $phpname( $operand );
    }
894263
function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$value, $namedParameters, $placement )
    {
        if ( isset( $this->PHPNameMap[$operatorName] ) )
        {
            $typeFunction = $this->PHPNameMap[$operatorName];
            $this->checkType( $typeFunction, $tpl, $value, $operatorParameters, $rootNamespace, $currentNamespace, $placement );
            return;
        }
        switch ( $operatorName )
        {
            case $this->IsClassName:
            {
                if ( count( $operatorParameters ) == 1 )
                {
                    $className = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement );
                    $value = strtolower( get_class( $value ) ) == strtolower( $className );
                }
                else
                {
                    $className = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement );
                    $value = strtolower( get_class( $tpl->elementValue( $operatorParameters[1], $rootNamespace, $currentNamespace, $placement ) ) ) == strtolower( $className );
                }
            } break;
            case $this->IsSetName:
            {
                if ( count( $operatorParameters ) > 0 )
                {
                    if ( count( $operatorParameters ) > 1 )
                    {
                        $tpl->extraParameters( $operatorName, count( $operatorParameters ), 1 );
                    }

                    $operand = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement, true );
                    $value = $operand !== null;


                }
                else
                    $tpl->missingParameter( $operatorName, 'input' );

            } break;
            case $this->IsUnsetName:
            {
                if ( count( $operatorParameters ) > 0 )
                {
                    if ( count( $operatorParameters ) > 1 )
                        $tpl->extraParameters( $operatorName,
                                               count( $operatorParameters ),
                                               1 );
                    $operand = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement, true );
                    $value = $operand === null;
                }
                else
                    $tpl->missingParameter( $operatorName, 'input' );
            } break;
            case $this->GetTypeName:
            {
                if ( count( $operatorParameters ) > 0 )
                {
                    if ( count( $operatorParameters ) > 1 )
                        $tpl->extraParameters( $operatorName,
                                               count( $operatorParameters ),
                                               1 );
                    $operand = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement );
                }
                else
                    $operand =& $value;
                if ( $operand === null )
                    $value = 'null';
                else if ( is_bool( $operand ) )
                    $value = 'boolean[' . ( $operand ? 'true' : 'false' ) . ']';
                else if ( is_object( $operand ) )
                    $value = 'object[' . get_class( $operand ) . ']';
                else if ( is_array( $operand ) )
                    $value = 'array[' . count( $operand ) . ']';
                else if ( is_string( $operand ) )
                    $value = 'string[' . strlen( $operand ) . ']';
                else
                    $value = gettype( $operand );
            } break;
            case $this->GetClassName:
            {
                if ( count( $operatorParameters ) > 0 )
                {
                    if ( count( $operatorParameters ) > 1 )
                        $tpl->extraParameters( $operatorName,
                                               count( $operatorParameters ),
                                               1 );
                    $operand = $tpl->elementValue( $operatorParameters[0], $rootNamespace, $currentNamespace, $placement );
                    $value = strtolower( get_class( $operand ) );
                }
                else
                {
                    $value = strtolower( get_class( $value ) );
                }
            } break;
        }
    }
291012
public function run()
	{
		list($name,$id)=$this->resolveNameID();
		if(isset($this->htmlOptions['id']))
			$id=$this->htmlOptions['id'];
		else
			$this->htmlOptions['id']=$id;

		$isRange=isset($this->options['range']) && $this->options['range'] &&
			$this->options['range']!=='max' && $this->options['range']!=='min';

		if($this->hasModel())
		{
			$attribute=$this->attribute;
			if($isRange)
			{
				$options=$this->htmlOptions;
				echo CHtml::activeHiddenField($this->model,$this->attribute,$options);
				$options['id'].=$this->maxIdSuffix;
				echo CHtml::activeHiddenField($this->model,$this->maxAttribute,$options);
				$maxAttribute=$this->maxAttribute;
				$this->options['values']=array($this->model->$attribute,$this->model->$maxAttribute);
			}
			else
			{
				echo CHtml::activeHiddenField($this->model,$this->attribute,$this->htmlOptions);
				$this->options['value']=$this->model->$attribute;
			}
		}
		else
		{
			if($isRange)
			{
				list($maxName,$maxId)=$this->resolveNameID('maxName','maxAttribute');
				$options=$this->htmlOptions;
				echo CHtml::hiddenField($name,$this->value,$options);
				$options['id'].=$this->maxIdSuffix;
				echo CHtml::hiddenField($maxName,$this->maxValue,$options);
				$this->options['values']=array($this->value,$this->maxValue);
			}
			else
			{
				echo CHtml::hiddenField($name,$this->value,$this->htmlOptions);
				if($this->value!==null)
					$this->options['value']=$this->value;
			}
		}

		$idHidden=$this->htmlOptions['id'];
		$this->htmlOptions['id']=$idHidden.'_slider';
		echo CHtml::tag($this->tagName,$this->htmlOptions,'');

		$this->options[$this->event]=$isRange
			? new CJavaScriptExpression("function(e,ui){ v=ui.values; jQuery('#{$idHidden}').val(v[0]); jQuery('#{$idHidden}{$this->maxIdSuffix}').val(v[1]); }")
			: new CJavaScriptExpression("function(event, ui) { jQuery('#{$idHidden}').val(ui.value); }");

		$options=CJavaScript::encode($this->options);
		Yii::app()->getClientScript()->registerScript(__CLASS__.'#'.$id,"jQuery('#{$id}_slider').slider($options);");
	}
621504
public function resolveMapping($resource, $parameters = [], $key = 'default', $method = null)
	{
		$resourceName = $resource;

		if( is_object($resource) )
		{
			$resourceName = get_class($resource);
		}

		$mappings = $this->getMappings($resourceName, $key);

		if(empty($mappings))
		{
			throw new Exception('No resolvers mapped for resource: ' . $resourceName . '.');
		}

		$result = null;

		if(is_array($mappings))
		{
			return $this->runResolver($mappings[0], $parameters, $method);
		}

		return $this->runResolver($mappings, $parameters, $method);
	}
101557
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if ($input->getArgument('version') === null) {
            $version = $this->manager->getVersionFromProvider();
            $output->writeln(sprintf('Provider: <comment>%s</comment>', get_class($this->manager->getActiveProvider())));

            $formatter = $this->manager->getFormatter();
            if ($formatter instanceof FormatterInterface) {
                $output->writeln(sprintf('Formatter: <comment>%s</comment>', get_class($formatter)));
            } else {
                $output->writeln(sprintf('Formatter: <comment>%s</comment>', 'None'));
            }
        } else {
            $version = Version::fromString($input->getArgument('version'));
            $output->writeln(sprintf('Provider: <comment>%s</comment>', 'Symfony command'));
            $output->writeln(sprintf('Formatter: <comment>%s</comment>', 'Not available'));
        }

        $incrementMajor = (int) $input->getOption('major');
        if ($incrementMajor > 0) {
            for ($i = 0; $i < $incrementMajor; $i++) {
                $version = $version->withMajorIncremented();
            }
        }

        $incrementMinor = (int) $input->getOption('minor');
        if ($incrementMinor > 0) {
            for ($i = 0; $i < $incrementMinor; $i++) {
                $version = $version->withMinorIncremented();
            }
        }

        $incrementPatch = (int) $input->getOption('patch');
        if ($incrementPatch > 0) {
            for ($i = 0; $i < $incrementPatch; $i++) {
                $version = $version->withPatchIncremented();
            }
        }

        $preRelease = $input->getOption('prerelease');
        if (!empty($preRelease)) {
            if (in_array(null, $preRelease)) {
                $preRelease = array();
            }

            $version = $version->withPreRelease($preRelease);
        }

        $build = $input->getOption('build');
        if (!empty($build)) {
            if (in_array(null, $build)) {
                $build = array();
            }

            $version = $version->withBuild($build);
        }

        $currentVersion = $this->manager->getVersion();
        if ((string) $currentVersion == (string) $version) {
            $version = $version->withPatchIncremented();
        }

        $output->writeln(sprintf('Current version: <info>%s</info>', $currentVersion));
        $output->writeln(sprintf('New version: <info>%s</info>', $version));
        if ($input->getOption('dry-run')) {
            $output->writeln(sprintf('<question>%s</question>', 'Dry run, skipping version bump'));
        } else {
            $this->manager->writeVersion($version);
        }
    }
1198739
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var PaymentInterface $payment */
        $payment = $request->getSource();

        /** @var OrderInterface $order */
        $params = [
            'payment_id' => $payment->getNumber(),
            'payment_amount' => $payment->getTotalAmount(),
            'payment_currency' => $payment->getCurrencyCode(),
            'project_id' => $this->api['projectId'],
            'customer_id' => $payment->getClientId(),
        ];
        $request->setResult($params);
    }
1128094
public function unserialize($serialized)
    {
        parent::unserialize($serialized);
        foreach ( $this->getMethods() as $item ) {
            $item->setBelongsTo($this);
        }
//        foreach ( $this->getConstants() as $item ) {
//            $item->setBelongsTo($this);
//        }
        foreach ( $this->getProperties() as $item ) {
            $item->setBelongsTo($this);
        }
        foreach ( $this->getTags() as $item ) {
            $item->setBelongsTo($this);
        }
//        return;
//        foreach ( [ $this->getMethods(), $this->getProperties(), $this->getConstants(), $this->getTags() ] as $collection ) {
//            /** @var Collection|AbstractStructure[] $collection */
//            foreach ( $collection as $item ) {
//                $item->setBelongsTo($this);
//            }
//        }
    }