Skip to content

Commit

Permalink
Merge pull request #2 from NoxxieNl/analysis-KZQjl3
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
NoxxieNl authored Apr 9, 2021
2 parents 0ffa617 + 8a6bd14 commit b7df54d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
7 changes: 2 additions & 5 deletions src/ProgressConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

class ProgressConnection extends Connection
{

/**
* @param \PDO $pdo
* @param \PDO $pdo
* @param string $database
* @param string $tablePrefix
* @param array $config
* @param array $config
*/
public function __construct(PDO $pdo, $database = '', $tablePrefix = '', array $config = [])
{
Expand All @@ -36,6 +35,4 @@ protected function getDefaultQueryGrammar()

return $this->withTablePrefix($defaultGrammar);
}


}
16 changes: 9 additions & 7 deletions src/ProgressConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ public function connect(array $config)
// First we'll create the basic DSN and connection instance connecting to the
// using the configuration option specified by the developer.
$connection = $this->createConnection(
$this->getDsn($config), $config, $this->getOptions($config)
$this->getDsn($config),
$config,
$this->getOptions($config)
);

return $connection;
Expand All @@ -34,12 +36,11 @@ protected function getDsn(array $config)
// in the configuration options. This will give us the basic DSN we will
// need to establish the PDO connections and return them back for use.
extract($config, EXTR_SKIP);

$dsn = "odbc:".
"Driver=".($systemdriver ?? 'Progress').
";DatabaseName=".($database ?? '').
";Hostname=".($host ?? '');

$dsn = 'odbc:'.
'Driver='.($systemdriver ?? 'Progress').
';DatabaseName='.($database ?? '').
';Hostname='.($host ?? '');

// If a port was specified, we will add it to this Progress DSN connections
// format.
Expand All @@ -60,7 +61,8 @@ protected function getDsn(array $config)
/**
* Format the schema for the DSN.
*
* @param array|string $schema
* @param array|string $schema
*
* @return string
*/
protected function formatSchema($schema)
Expand Down
8 changes: 4 additions & 4 deletions src/ProgressServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public function register()

$this->app['db']->extend($conn, function ($config, $name) {
$connector = new ProgressConnector();

return new ProgressConnection(
$connector->connect($config),
$config['database'] ?? null,
$config['prefix'] ?? null,
$connector->connect($config),
$config['database'] ?? null,
$config['prefix'] ?? null,
$config,
);
});
Expand Down
29 changes: 17 additions & 12 deletions src/Query/Grammer/ProgressGrammer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ public function __construct(array $config)
// Check if we end with a dot if not add the dot at the end.
if (isset($config['schema'])) {
$this->schema = Str::finish($config['schema'], '.');
}
}
}

/**
* Compile the "from" portion of the query.
*
* @param \Illuminate\Database\Query\Builder $query
* @param string $table
* @param \Illuminate\Database\Query\Builder $query
* @param string $table
*
* @return string
*/
protected function compileFrom(Builder $query, $table)
Expand All @@ -40,8 +41,9 @@ protected function compileFrom(Builder $query, $table)
/**
* Compile the "limit" portions of the query.
*
* @param \Illuminate\Database\Query\Builder $query
* @param int $limit
* @param \Illuminate\Database\Query\Builder $query
* @param int $limit
*
* @return string
*/
protected function compileLimit(Builder $query, $limit)
Expand All @@ -52,16 +54,17 @@ protected function compileLimit(Builder $query, $limit)
/**
* Compile the "select *" portion of the query.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $columns
* @param \Illuminate\Database\Query\Builder $query
* @param array $columns
*
* @return string|null
*/
protected function compileColumns(Builder $query, $columns)
{
// If the query is actually performing an aggregating select, we will let that
// compiler handle the building of the select clauses, as it will need some
// more syntax that is best handled by that function to keep things neat.
if (! is_null($query->aggregate)) {
if (!is_null($query->aggregate)) {
return;
}

Expand All @@ -73,7 +76,7 @@ protected function compileColumns(Builder $query, $columns)

if ($query->limit) {
// Only use the TOP sql when there is no OFFSET specified, otherwise we get errors.
if (! isset($query->offset)) {
if (!isset($query->offset)) {
$select .= 'top '.(int) $query->limit.' ';
}
}
Expand All @@ -84,8 +87,9 @@ protected function compileColumns(Builder $query, $columns)
/**
* Compile the "join" portions of the query.
*
* @param \Illuminate\Database\Query\Builder $query
* @param array $joins
* @param \Illuminate\Database\Query\Builder $query
* @param array $joins
*
* @return string
*/
protected function compileJoins(Builder $query, $joins)
Expand All @@ -103,7 +107,8 @@ protected function compileJoins(Builder $query, $joins)

/**
* @param \Illuminate\Database\Query\Builder $query
* @param mixed $offset
* @param mixed $offset
*
* @return void
*/
protected function compileOffset(Builder $query, $offset)
Expand Down

0 comments on commit b7df54d

Please sign in to comment.