Skip to content

Commit

Permalink
feat: initial commit for abstract file reader
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuftaufiq committed Apr 7, 2022
1 parent bfaefef commit eb05dc0
Showing 1 changed file with 3 additions and 36 deletions.
39 changes: 3 additions & 36 deletions src/Readers/FileReader.php → src/Readers/AbstractFileReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,14 @@

use Symfony\Component\Finder\Finder;

class FileReader
abstract class AbstractFileReader
{
/**
* Undocumented variable
*
* @var string
*/
protected $dir = './';

/**
* Undocumented variable
*
* @var array
*/
protected $pattern = [];
protected $dir = '/./';

/**
* Undocumented variable
Expand Down Expand Up @@ -46,36 +39,10 @@ public function setDirectory($dir)
return $this;
}

public function setPath($path)
{
$this->path = $path;

return $this;
}

public function setPattern($pattern)
{
$this->pattern = $pattern;

return $this;
}

public function getFullPath()
{
return getcwd() . $this->dir . $this->path;
}

public function getFiles()
{
array_walk($this->pattern, function ($pattern) {
$this->finder->path($pattern);
});

$this->finder
->files()
->name('*.php')
->in($this->getFullPath());

return $this->finder;
}
abstract public function getFiles();
}

0 comments on commit eb05dc0

Please sign in to comment.