Skip to content

Commit

Permalink
complexity reduced
Browse files Browse the repository at this point in the history
  • Loading branch information
aurelien-riv committed May 2, 2018
1 parent 1d0dd06 commit 354c28e
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/modules/FileCheck/FileCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct(FileCheckModule $module)
}
}

protected function extractVariablesFromPath($path, &$columns=[], &$innerJoins=[])
private function extractVariablesFromPath($path, &$columns=[], &$innerJoins=[])
{
$columnIdentifier = AbstractDbQueries::IDENTIFIER;

Expand All @@ -55,7 +55,7 @@ protected function extractVariablesFromPath($path, &$columns=[], &$innerJoins=[]
}
}

protected function replaceVariablesFromPath($path, $value, &$columns)
private function replaceVariablesFromPath($path, $value, &$columns)
{
$columnIdentifier = AbstractDbQueries::IDENTIFIER;
$pattern = "/\{($columnIdentifier(?:\.$columnIdentifier)?)\}/";
Expand Down Expand Up @@ -86,7 +86,7 @@ public function run(AbstractDBAL $dbal)
}
}

protected function testUrl(string $dbName, string $table, array $columns, string $path)
private function testUrl(string $dbName, string $table, array $columns, string $path)
{
if ($this->http)
{
Expand All @@ -98,24 +98,24 @@ protected function testUrl(string $dbName, string $table, array $columns, string
}
}

private function isFile(string $path) : bool
{
if ($this->sftp)
{
return $this->sftp->file_exists($path);
}
return is_file($path);
}

protected function testFile(string $dbName, string $table, array $columns, string $path)
{
if (preg_match('/^https?:\/\//', $path))
{
yield from $this->testUrl($dbName, $table, $columns, $path);
}
else if ($this->sftp)
{
if (! $this->sftp->file_exists($path))
{
yield new FileCheckMatch($dbName, $table, $columns, $path);
}
}
else if (! is_file($path))
else if (! $this->isFile($path))
{
yield new FileCheckMatch($dbName, $table, $columns, $path);
}
}


}

0 comments on commit 354c28e

Please sign in to comment.