for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace IgnoreFiles\Infrastructure\Disk;
class FileReader
{
/**
* @var string
*/
private $file;
* FileReader constructor.
*
* @param string $file
public function __construct($file)
$this->file = $file;
}
* @return array
public function read()
if (false === $this->fileExists()) {
return [];
return $this->getFileContent();
* @return bool
private function fileExists()
return file_exists($this->file);
private function getFileContent()
$content = file($this->file);
return $this->trimContent($content);
* @param array $contentData
private function trimContent(array $contentData)
$data = [];
foreach ($contentData as $item) {
$data[] = trim($item);
return $data;