یک نمونه جدید از متور پرداخت ایجاد می‌کند.

بر اساس داده‌هایی که توسط کاربر تعیین شده است یک متور جدید پرداخت ایجاد
می‌کند و آن را به متورهای پرداخت ملک اضافه می‌کند.

@param string $commit
@throws Pluf_Exception
@return Bank_Backend
766969
function save($commit = true)
    {
        if (! $this->isValid()) {
            // TODO: maso, 1395: باید از خطای مدل فرم استفاده شود.
            throw new Pluf_Exception(__('Cannot save the backend from an invalid form.'));
        }
        // Set attributes
        $backend = new Bank_Backend();
        $backend->setFromFormData($this->cleaned_data);
        $backend->engine = $this->engine->getType();
        $backend->currency = $this->engine->getCurrency();
        $params = $this->engine->getParameters();
        foreach ($params['children'] as $param) {
            if ($param['name'] === 'title' || $param['name'] === 'description' || 
                $param['name'] === 'symbol' || $param['name'] === 'title' ||
                $param['name'] === 'currency')
                continue;
            $backend->setMeta($param['name'], $this->cleaned_data[$param['name']]);
        }
        // TODO: maso, 1395: تنها پارامترهایی اضافه باید به صورت کد شده در
        // موجودیت قرار گیرد.
        if ($commit) {
            if (! $backend->create()) {
                throw new Pluf_Exception(__('Fail to create the backend.'));
            }
        }
        return $backend;
    }
1111015
public function update(string $commit, array $params = [])
    {
        $path = $this->buildFilesPath($commit);

        return $this->post($path, $params);
    }
1082532
public function commit()
    {
        if (!$this->getIsActive()) {
            throw new Exception('Failed to commit transaction: transaction was inactive.');
        }

        $this->_level--;
        if ($this->_level === 0) {
            Log::debug('Commit transaction' . __METHOD__);
            $this->db->pdo->commit();
            $this->db->trigger(Connection::EVENT_COMMIT_TRANSACTION);
            return;
        }

        $schema = $this->db->getSchema();
        if ($schema->supportsSavepoint()) {
            Log::debug('Release savepoint ' . $this->_level . __METHOD__);
            $schema->releaseSavepoint('LEVEL' . $this->_level);
        } else {
            Log::info('Transaction not committed: nested transaction not supported' . __METHOD__);
        }
    }
304685
public function commit(array $params = [])
    {
        if (!empty($this->bulkQueries)) {
            $bulkQueries = array_merge($this->bulkQueries, $this->bulkParams);
            $bulkQueries['index']['_index'] = $this->getIndexName();
            $this->eventDispatcher->dispatch(
                Events::PRE_COMMIT,
                new CommitEvent($this->getCommitMode(), $bulkQueries)
            );

            $this->stopwatch('start', 'bulk');
            $bulkResponse = $this->client->bulk($bulkQueries);
            $this->stopwatch('stop', 'bulk');

            if ($bulkResponse['errors']) {
                throw new BulkWithErrorsException(
                    json_encode($bulkResponse),
                    0,
                    null,
                    $bulkResponse
                );
            }

            $this->bulkQueries = [];
            $this->bulkCount = 0;

            $this->stopwatch('start', 'refresh');

            switch ($this->getCommitMode()) {
                case 'flush':
                    $this->flush($params);
                    break;
                case 'refresh':
                    $this->refresh($params);
                    break;
            }

            $this->eventDispatcher->dispatch(
                Events::POST_COMMIT,
                new CommitEvent($this->getCommitMode(), $bulkResponse)
            );

            $this->stopwatch('stop', 'refresh');

            return $bulkResponse;
        }

        return null;
    }
1032644
public function rollback() {
		if (!$this->inTransaction()) {
			throw new Exception('There is no active transaction');
		}

		$res = @oci_rollback($this->_dbh);
		$this->checkError($res);

		$this->_inTransaction = false;
		$this->_commitMode = null;

		return $res;
	}
255302
public function commit()
    {
        if (!$this->_transactionStarted) {
            return false;
        }

        if ($this->_transactionLevel === 0) {
            if ($this->wasNestedTransactionRolledback()) {
                $e = $this->nestedTransactionRollbackException;
                $this->nestedTransactionRollbackException = null;
                throw $e;
            }

            $this->_transactionStarted = false;
            $this->nestedTransactionRollbackException = null;
            if ($this->_logQueries) {
                $this->log('COMMIT');
            }

            return $this->_driver->commitTransaction();
        }
        if ($this->isSavePointsEnabled()) {
            $this->releaseSavePoint((string)$this->_transactionLevel);
        }

        $this->_transactionLevel--;

        return true;
    }
694512
function save ($commit = true)
    {
        if (! $this->isValid()) {
            throw new Exception(
                    __('Cannot save the model from an invalid form.'));
        }
        return Pluf::f('url_base') . Pluf_HTTP_URL_urlForView(
                'IDF_Views_User::changeEmailDo', 
                array(
                        $this->cleaned_data['key']
                ));
    }
1316791
public function updateFiles(string $commit, array $files)
    {
        $path = $this->buildFilesPath($commit);

        $builder = new MultipartStreamBuilder();

        foreach ($files as $file) {
            $builder->addResource($file->getName(), $file->getResource(), $file->getOptions());
        }

        $headers = ['Content-Type' => sprintf('multipart/form-data; boundary="%s"', $builder->getBoundary())];

        return $this->postRaw($path, $builder->build(), $headers);
    }
577748
public function commit()
    {
        if ($this->rollbackAgain) {
            throw new \wf\db\Exception('Please throw exception after rollback in last catch block');
        }

        --$this->transactions;
    
        if($this->transactions == 0 && false === $this->dbh->commit()) {
            throw new \wf\db\Exception('transaction commit error: ' . $this->getLastErr());
        }

        if ($this->transactions < 0) {
            $this->transactions = 0;
        }
    }
1069129
public function transaction( Closure $callback )
	{
		$this->beginTransaction();

		// We'll simply execute the given callback within a try / catch block
		// and if we catch any exception we can rollback the transaction
		// so that none of the changes are persisted to the database.
		try
		{
			$result = $callback( $this );

			$this->commit();
		}

			// If we catch an exception, we will roll back so nothing gets messed
			// up in the database. Then we'll re-throw the exception so it can
			// be handled how the developer sees fit for their applications.
		catch ( Exception $e )
		{
			$this->rollBack();

			throw $e;
		}
		catch ( Throwable $e )
		{
			$this->rollBack();

			throw $e;
		}

		return $result;
	}
492258
public function withinTransaction(callable $operation)
    {
        if ($this->isInTransaction()) {
            return $operation();
        }

        $this->beginTransaction();
        try {
            $result = $operation();
            $this->commitTransaction();

            return $result;
        } catch (\Exception $e) {
            $this->rollbackTransaction();
            throw $e;
        }
    }
934806
public function download(string $commit, string $path, array $params = [])
    {
        $path = $this->buildFilesPath($commit, 'files', ...explode('/', $path));

        return $this->pureGet($path, $params, ['Accept' => '*/*'])->getBody();
    }
177221
public function import($repository, $branch = null, $file = null)
    {
        return $this->request(sprintf('github/%s?branch=%s&file=%s', $this->transform($repository), $branch, $file), 'POST');
    }
703769
public function sendCoverage($commit, $data)
    {
        $tempCertFile = $this->dumpCertificateBundle();

        $url = $this->baseUrl . "/2.0/coverage/" . $commit . "/php";

        $curl = curl_init($url);

        curl_setopt($curl, CURLOPT_HEADER, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt(
            $curl, CURLOPT_HTTPHEADER,
            array(
                "Content-type: application/json",
                "project_token: " . $this->projectToken
            )
        );
        curl_setopt($curl, CURLOPT_CAINFO, $tempCertFile); 
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);

        $json_response = curl_exec($curl);

        unlink($tempCertFile);

        $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

        if ($status < 200 || $status > 201) {
            throw new \Exception(
                sprintf("Error: call to URL %s failed with status %s, response %s, curl_error %u",
                    $url, $status, $json_response, curl_error($curl), curl_errno($curl)
                )
            );
        }

        curl_close($curl);

        $json = json_decode($json_response, true);

        if (isset($json['success']) || array_key_exists('success', $json)) {
            return $json['success'];
        } else {
            return $json['error'];
        }
    }
1234874
public function commit()
    {
        $return = true;
        $opcount = $this->nestedTransactionCount;

        if ($opcount > 0) {
            if ($opcount === 1) {
                if ($this->isUncommitable) {
                    throw new PropelException('Cannot commit because a nested transaction was rolled back');
                } else {
                    $return = parent::commit();
                    if ($this->useDebug) {
                        $this->log('Commit transaction', null, __METHOD__);
                    }
                }
            }

            $this->nestedTransactionCount--;
        }

        return $return;
    }
248014
public static function transform(PreCommit $preCommit, CommitMsg $commitMsg, PrePush $prePush)
    {
        $tools = $preCommit->getExecute()->execute();
        $prePushTools = $prePush->getExecute()->execute();
        $composer = $tools[0];
        $jsonLint = $tools[1];
        $phpLint = $tools[2];
        /** @var PhpMd $phpMd */
        $phpMd = $tools[3];
        /** @var PhpCs $phpCs */
        $phpCs = $tools[4];
        /** @var PhpCsFixer $phpCsFixer */
        $phpCsFixer = $tools[5];
        /** @var PhpUnit $phpunit */
        $phpunit = $tools[6];
        /** @var PhpUnitStrictCoverage $phpUnitStrictCoverage */
        $phpUnitStrictCoverage = $tools[7];
        /** @var PhpUnitGuardCoverage $phpUnitGuardCoverage */
        $phpUnitGuardCoverage = $tools[8];
        
        /** @var PhpUnit $phpunitPrePush */
        $phpunitPrePush = $prePushTools[0];
        /** @var PhpUnitStrictCoverage $phpUnitStrictCoveragePrePush */
        $phpUnitStrictCoveragePrePush = $prePushTools[1];
        /** @var PhpUnitGuardCoverage $phpUnitGuardCoveragePrePush */
        $phpUnitGuardCoveragePrePush = $prePushTools[2];

        return [
            'pre-commit' => [
                'enabled' => $preCommit->isEnabled(),
                'execute' => [
                    'composer' => $composer->isEnabled(),
                    'jsonlint' => $jsonLint->isEnabled(),
                    'phplint' => $phpLint->isEnabled(),
                    'phpmd' => [
                        'enabled' => $phpMd->isEnabled(),
                        'options' => $phpMd->getOptions()->value(),
                    ],
                    'phpcs' => [
                        'enabled' => $phpCs->isEnabled(),
                        'standard' => $phpCs->getStandard()->value(),
                        'ignore' => $phpCs->getIgnore()->value(),
                    ],
                    'php-cs-fixer' => [
                        'enabled' => $phpCsFixer->isEnabled(),
                        'levels' => [
                            'psr0' => $phpCsFixer->getLevels()->getPsr0()->value(),
                            'psr1' => $phpCsFixer->getLevels()->getPsr1()->value(),
                            'psr2' => $phpCsFixer->getLevels()->getPsr2()->value(),
                            'symfony' => $phpCsFixer->getLevels()->getSymfony()->value(),
                        ],
                        'options' => $phpCsFixer->getOptions()->value(),
                    ],
                    'phpunit' => [
                        'enabled' => $phpunit->isEnabled(),
                        'random-mode' => $phpunit->getRandomMode()->value(),
                        'options' => $phpunit->getOptions()->value(),
                        'strict-coverage' => [
                            'enabled' => $phpUnitStrictCoverage->isEnabled(),
                            'minimum' => $phpUnitStrictCoverage->getMinimumStrictCoverage()->value(),
                        ],
                        'guard-coverage' => [
                            'enabled' => $phpUnitGuardCoverage->isEnabled(),
                            'message' => $phpUnitGuardCoverage->getWarningMessage()->value(),
                        ],
                    ],
                ],
                'message' => [
                    'right-message' => $preCommit->getMessages()->getRightMessage()->value(),
                    'error-message' => $preCommit->getMessages()->getErrorMessage()->value(),
                ],
            ],
            'commit-msg' => [
                'enabled' => $commitMsg->isEnabled(),
                'regular-expression' => $commitMsg->getRegularExpression()->value(),
            ],
            'pre-push' => [
                'enabled' => $prePush->isEnabled(),
                'execute' => [
                    'phpunit' => [
                        'enabled' => $phpunitPrePush->isEnabled(),
                        'random-mode' => $phpunitPrePush->getRandomMode()->value(),
                        'options' => $phpunitPrePush->getOptions()->value(),
                        'strict-coverage' => [
                            'enabled' => $phpUnitStrictCoveragePrePush->isEnabled(),
                            'minimum' => $phpUnitStrictCoveragePrePush->getMinimumStrictCoverage()->value(),
                        ],
                        'guard-coverage' => [
                            'enabled' => $phpUnitGuardCoveragePrePush->isEnabled(),
                            'message' => $phpUnitGuardCoveragePrePush->getWarningMessage()->value()
                        ],
                    ],
                ],
                'message' => [
                    'right-message' => $prePush->getMessages()->getRightMessage()->value(),
                    'error-message' => $prePush->getMessages()->getErrorMessage()->value(),
                ],
            ],
        ];
    }
456643
protected function buildPipelineField($commits) {
		// Get filtered commits
		$filteredCommits = array();
		foreach ($commits as $commit) {
			$title = sprintf(
				"%s (%s, %s old)",
				$commit->Message,
				substr($commit->SHA,0,8),
				$commit->dbObject('Created')->TimeDiff()
			);
			$filteredCommits[$commit->SHA] = $title;
		}
		if($filteredCommits) {
			return new DropdownField('FilteredCommits', '', $filteredCommits);
		} else {
			return DropdownField::create('FilteredCommits)', '')
				->setEmptyString('No deployments available')
				->performDisabledTransformation();
		}
	}