for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the BenGorFile package.
*
* (c) Beñat Espiña <[email protected]>
* (c) Gorka Laucirica <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace BenGorFile\File\Application\Query;
use BenGorFile\File\Application\DataTransformer\FileDataTransformer;
use BenGorFile\File\Domain\Model\File;
use BenGorFile\File\Domain\Model\FileRepository;
/**
* All files query handler.
* @author Beñat Espiña <[email protected]>
class AllFilesHandler
{
* The file data transformer.
* @var FileDataTransformer
private $dataTransformer;
* The file repository.
* @var FileRepository
private $repository;
* Constructor.
* @param FileRepository $aRepository The file repository
* @param FileDataTransformer $aDataTransformer The file data transformer
public function __construct(FileRepository $aRepository, FileDataTransformer $aDataTransformer)
$this->repository = $aRepository;
$this->dataTransformer = $aDataTransformer;
}
* Handles the given query.
* @param AllFilesQuery $aQuery The query
* @return mixed
public function __invoke(AllFilesQuery $aQuery)
$aQuery
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$files = $this->repository->all();
$result = array_map(function (File $file) {
$this->dataTransformer->write($file);
return $this->dataTransformer->read();
}, $files);
return $result;
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.