abterphp /
contact
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | declare(strict_types=1); |
||||||
| 4 | |||||||
| 5 | namespace AbterPhp\Contact\Service\Execute; |
||||||
| 6 | |||||||
| 7 | use AbterPhp\Contact\Domain\Entities\Form as Entity; |
||||||
| 8 | use AbterPhp\Contact\Orm\FormRepo as GridRepo; |
||||||
| 9 | use AbterPhp\Contact\Validation\Factory\Form as ValidatorFactory; |
||||||
| 10 | use AbterPhp\Framework\Domain\Entities\IStringerEntity; |
||||||
| 11 | use AbterPhp\Framework\Filesystem\Uploader; |
||||||
| 12 | use AbterPhp\Framework\Http\Service\Execute\RepoServiceAbstract; |
||||||
| 13 | use Cocur\Slugify\Slugify; |
||||||
| 14 | use Opulence\Events\Dispatchers\IEventDispatcher; |
||||||
| 15 | use Opulence\Http\Requests\UploadedFile; |
||||||
| 16 | use Opulence\Orm\IUnitOfWork; |
||||||
| 17 | use Opulence\Orm\OrmException; |
||||||
| 18 | |||||||
| 19 | class Form extends RepoServiceAbstract |
||||||
| 20 | { |
||||||
| 21 | /** @var Slugify */ |
||||||
| 22 | protected $slugify; |
||||||
| 23 | |||||||
| 24 | /** |
||||||
| 25 | * Form constructor. |
||||||
| 26 | * |
||||||
| 27 | * @param GridRepo $repo |
||||||
| 28 | * @param ValidatorFactory $validatorFactory |
||||||
| 29 | * @param IUnitOfWork $unitOfWork |
||||||
| 30 | * @param IEventDispatcher $eventDispatcher |
||||||
| 31 | * @param Slugify $slugify |
||||||
| 32 | */ |
||||||
| 33 | public function __construct( |
||||||
| 34 | GridRepo $repo, |
||||||
| 35 | ValidatorFactory $validatorFactory, |
||||||
| 36 | IUnitOfWork $unitOfWork, |
||||||
| 37 | IEventDispatcher $eventDispatcher, |
||||||
| 38 | Slugify $slugify, |
||||||
| 39 | Uploader $uploader |
||||||
|
0 ignored issues
–
show
|
|||||||
| 40 | ) { |
||||||
| 41 | parent::__construct($repo, $validatorFactory, $unitOfWork, $eventDispatcher); |
||||||
| 42 | |||||||
| 43 | $this->slugify = $slugify; |
||||||
| 44 | } |
||||||
| 45 | |||||||
| 46 | /** |
||||||
| 47 | * @param string $entityId |
||||||
| 48 | * |
||||||
| 49 | * @return Entity |
||||||
| 50 | */ |
||||||
| 51 | public function createEntity(string $entityId): IStringerEntity |
||||||
| 52 | { |
||||||
| 53 | return new Entity($entityId, '', '', '', ''); |
||||||
| 54 | } |
||||||
| 55 | |||||||
| 56 | /** |
||||||
| 57 | * @param Entity $entity |
||||||
| 58 | * @param array $postData |
||||||
| 59 | * @param UploadedFile[] $fileData |
||||||
| 60 | * |
||||||
| 61 | * @return Entity |
||||||
| 62 | * @throws OrmException |
||||||
| 63 | */ |
||||||
| 64 | protected function fillEntity(IStringerEntity $entity, array $postData, array $fileData): IStringerEntity |
||||||
| 65 | { |
||||||
| 66 | $name = (string)$postData['name']; |
||||||
| 67 | $identifier = (string)$postData['identifier']; |
||||||
| 68 | $toName = (string)$postData['to_name']; |
||||||
| 69 | $toEmail = (string)$postData['to_email']; |
||||||
| 70 | |||||||
| 71 | if (!$identifier) { |
||||||
| 72 | $identifier = $this->slugify->slugify($name); |
||||||
| 73 | } |
||||||
| 74 | |||||||
| 75 | $entity |
||||||
| 76 | ->setName($name) |
||||||
|
0 ignored issues
–
show
The method
setName() does not exist on AbterPhp\Framework\Domain\Entities\IStringerEntity. It seems like you code against a sub-type of AbterPhp\Framework\Domain\Entities\IStringerEntity such as AbterPhp\Website\Domain\Entities\PageCategory or AbterPhp\Admin\Domain\Entities\UserGroup or AbterPhp\Contact\Domain\Entities\Form or AbterPhp\Admin\Domain\Entities\UserLanguage.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 77 | ->setIdentifier($identifier) |
||||||
| 78 | ->setToName($toName) |
||||||
| 79 | ->setToEmail($toEmail); |
||||||
| 80 | |||||||
| 81 | return $entity; |
||||||
| 82 | } |
||||||
| 83 | } |
||||||
| 84 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.