@param string $commit
@param array  $params

@throws \Http\Client\Exception

@return array
332154
public function show(string $commit, array $params = [])
    {
        $path = $this->buildFilesPath($commit);

        return $this->get($path, $params);
    }
628556
public function deleteByParams($params = [])
    {
        extract($params);

        $query = $this->newDeleteQuery();

        if (isset($where)) {
            if (is_array($where)) {
                foreach ($where as $condition) {
                    $condition = (array)$condition;
                    $query->where($condition[0], $condition[1]);
                }
            } else {
                call_user_func_array([$query, 'where'], $where);
            }
        }

        if (isset($order)) {
            call_user_func_array([$query, 'order'], $order);
        }

        if (isset($limit)) {
            call_user_func_array([$query, 'limit'], $limit);
        }

        $this->getDB()->execute($query);

        return $this;
    }
1267884
public function execute($params = array())
    {
        $this->mergeParams($params);

        $reconnect = $this->db->getOption('reconnect');
        $reconnectRetries = $this->db->getOption('reconnect_retries', 3);
        $reconnectDelayMS = $this->db->getOption('reconnect_delay_ms', 1000);

        while (true) {
            $e = null;
            $errorCode = null;
            $errorInfo = null;
            $result = null;

            $isReconnectError = false;
            try {
                $this->prepare();
                foreach ($this->positionParams as $index => $value) {
                    $this->statement->bindValue($index + 1, $value);
                }

                $result = $this->statement->execute($this->params?:null);
            } catch (\Exception $e) {
            }

            if ($result === false || !$e) {
                $errorCode = $this->statement->errorCode();
                $errorInfo = $this->statement->errorInfo();
            }

            $isReconnectError = Util::checkReconnectError($errorCode, $errorInfo, $e);

            // reconnect
            if ($reconnect && $isReconnectError && $reconnectRetries > 0) {
                $reconnectRetries--;
                $this->statement = null;
                $this->db->close();
                $reconnectDelayMS && usleep($reconnectDelayMS * 1000);
                continue;
            }

            break;
        }

        if ($e) {
            $this->db->logError(sprintf('Statement exception error #%s: %s', $e->getCode(), $e->getMessage()));
            throw $e;
        }

        if ($result === false) {
            $this->db->logError(sprintf('Statement execute error #%s: %s', $errorInfo[0], $errorInfo[2]));
            return false;
        }

        return $this->statement->rowCount();
    }
705150
public function commit($method, $url, $params = [], $options = [])
    {
        $params['VERSION'] = $this->config['version'];
        $params['USER'] = $this->config['username'];
        $params['PWD'] = $this->config['password'];
        $params['SIGNATURE'] = $this->config['signature'];

        $success = false;

        $request = [
            'exceptions'      => false,
            'timeout'         => '60',
            'connect_timeout' => '10',
            'headers'         => [
                'User-Agent' => 'PaypalExpress/v1 PayMeBindings/'.$this->config['version'],
            ],
        ];

        if (version_compare(ClientInterface::VERSION, '6') === 1) {
            $request['curl'] = static::$defaultCurlOptions;
            $request['form_params'] = $params;
        } else {
            $request['config']['curl'] = static::$defaultCurlOptions;
            $request['body'] = $params;
        }

        $rawResponse = $this->getHttpClient()->{$method}($url, $request);

        if ($rawResponse->getStatusCode() == 200) {
            $response = $this->parseResponse((string) $rawResponse->getBody());
        } else {
            $response = $this->responseError((string) $rawResponse->getBody());
        }

        return $this->respond($success, $params, $response, $options);
    }
384405
public function commit($method, $url, $params = [], $options = [])
    {
        $userAgent = [
            'bindings_version' => $this->config['version'],
            'lang'             => 'php',
            'lang_version'     => phpversion(),
            'publisher'        => 'stripe',
            'uname'            => php_uname(),
        ];

        $success = false;

        $request = [
            'exceptions'      => false,
            'timeout'         => '80',
            'connect_timeout' => '30',
            'headers'         => [
                'Authorization'              => 'Basic '.base64_encode($this->config['private_key'].':'),
                'Content-Type'               => 'application/x-www-form-urlencoded',
                'RaiseHtmlError'             => 'false',
                'User-Agent'                 => 'Stripe/v1 PayMeBindings/'.$this->config['version'],
                'X-Stripe-Client-User-Agent' => json_encode($userAgent),
            ],
        ];

        if (version_compare(ClientInterface::VERSION, '6') === 1) {
            $request['form_params'] = $params;
        } else {
            $request['body'] = $params;
        }

        $rawResponse = $this->getHttpClient()->{$method}($url, $request);

        if ($rawResponse->getStatusCode() == 200) {
            $response = $this->parseResponse($rawResponse->getBody());
        } else {
            $response = $this->responseError($rawResponse->getBody());
        }

        return $this->respond($success, $response);
    }
738586
protected function prepare(string $query, array $params): array
	{
		// Prepare query and parameters

		[$query, $params] = $this->prepareQueryAndParams($query, $params);

		// Create prepared statement

		try
		{
			prepare:

			$statement = $this->pdo->prepare($query);
		}
		catch(PDOException $e)
		{
			if($this->isConnectionLostAndShouldItBeReestablished())
			{
				$this->reconnect();

				goto prepare;
			}

			throw new PDOException($e->getMessage() . ' [ ' . $this->prepareQueryForLog($query, $params) . ' ] ', (int) $e->getCode(), $e->getPrevious());
		}

		// Bind parameters

		foreach($params as $key => $value)
		{
			$this->bindParameter($statement, $key, $value);
		}

		// Return query, parameters and the prepared statement

		return ['query' => $query, 'params' => $params, 'statement' => $statement];
	}
103774
public function getCommits($nbCommits = 10)
    {
        $output = $this->git(sprintf('log -n %d --date=%s --format=format:%s', $nbCommits, $this->dateFormat, $this->logFormat));
        return $this->parseLogsIntoArray($output);
    }
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);
    }
102359
public function getChanges(array $params = [])
    {
        $path = '/'.$this->databaseName.'/_changes';

        $method = ((!isset($params['doc_ids']) || $params['doc_ids'] == null) ? 'GET' : 'POST');
        $response = '';

        if ($method == 'GET') {
            foreach ($params as $key => $value) {
                if (isset($params[$key]) === true && is_bool($value) === true) {
                    $params[$key] = ($value) ? 'true' : 'false';
                }
            }
            if (count($params) > 0) {
                $query = http_build_query($params);
                $path = $path.'?'.$query;
            }
            $response = $this->httpClient->request('GET', $path);
        } else {
            $path .= '?filter=_doc_ids';
            $response = $this->httpClient->request('POST', $path, json_encode($params));
        }
        if ($response->status != 200) {
            throw HTTPException::fromResponse($path, $response);
        }

        return $response->body;
    }
1254347
public function queryAssoc($statement, $params = array()) {
        $start = microtime(true);
        $query = $this->prepare($statement);
        try {
            $query->execute($params);
        } catch (\PDOException $e){
            $this->error($e->getMessage(), array(
                'File' => __FILE__,
                'Line' => __LINE__ - 4,
                'Query' => $statement .'',
                'Params' => $params,
                'Trace' => $e->getTraceAsString()
            ));
            return null;
        }
        $r = $query->fetchAll(\PDO::FETCH_ASSOC);
        $this->debug($statement . '', array(
            'params' => $params,
            'intoArray' => 'assoc',
            'rows' => count($r),
            'time' => microtime(true) - $start,
            'dns' => $this->dns
        ));
        return $r;
    }
1184954
public function comments(string $commit)
    {
        return new Comments($this->getHttpClient(), $this->username, $this->repo, $commit);
    }
531175
public function commit($method, $url, $params = [], $options = [])
    {
        $success = false;
        $response = [];

        if ($params['transaction'] == 'success') {
            $success = true;
        }

        return $this->mapResponse($success, $response);
    }
1331371
public function get($id, $params = null)
    {
        $id = (int)$id;
        if ($id <= 0) {
            throw new Exception('Invalid param id');
        }
        return $this->rest->get("$this->action/$id", $params);
    }
523562
public function update($params, $optParams = [])
    {
        if (!$params instanceof Cloud) {
            throw new InvalidParamException(Cloud::class . ' is required!');
        }

        return $this->sendRequest([], [
            'restAction' => 'update',
            'restId' => $params->id,
            'postParams' => $params->toArray(),
            'getParams' => $optParams,
        ], function ($response) {
            return isset($response->data) ? new Cloud($response->data) : $response;
        });
    }
1244111
public function rootDiff(Commit $commit)
    {
        if (!$commit->isRoot()) {
            throw new \InvalidArgumentException('rootDiff method accepts only root commits');
        }
        $this->clearAll();
        $this->addCommandName(static::DIFF_TREE_COMMAND);
        $this->addCommandArgument('--cc');
        $this->addCommandArgument('--root');
        $this->addCommandArgument('--dst-prefix=DST/');
        $this->addCommandArgument('--src-prefix=SRC/');
        $this->addCommandSubject($commit);

        return $this->getCommand();
    }
89194
protected static function prepareParams($params, $column)
    {
        if (is_string($params)) {
            $params = str_replace('[column]', $column, $params);
            return $params;
        } elseif (is_array($params)) {
            $params = Json::decode(str_replace('[column]', $column, Json::encode($params)));
            return $params;
        } else {
            throw new Exception(Module::t('app', 'Params should be string or array'));
        }
    }
628772
public function commits(array $parameters = [])
    {
        $data = $this->client->repositories()->commits($this->id, $parameters);

        $commits = array();
        foreach ($data as $commit) {
            $commits[] = Commit::fromArray($this->getClient(), $this, $commit);
        }

        return $commits;
    }