Passed
Push — master ( 75dc22...ad651f )
by Luiz Kim
09:59 queued 07:29
created

FileRepository::addFile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
c 0
b 0
f 0
nc 1
nop 6
dl 0
loc 14
rs 9.9332
1
<?php
2
3
namespace ControleOnline\Repository;
4
5
use ControleOnline\Entity\File;
6
use ControleOnline\Entity\People;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\People was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
0 ignored issues
show
Bug introduced by
The type Doctrine\Bundle\Doctrine...ServiceEntityRepository was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Doctrine\Persistence\ManagerRegistry;
0 ignored issues
show
Bug introduced by
The type Doctrine\Persistence\ManagerRegistry was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * @method User|null find($id, $lockMode = null, $lockVersion = null)
12
 * @method User|null findOneBy(array $criteria, array $orderBy = null)
13
 * @method User[]    findAll()
14
 * @method User[]    findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
15
 */
16
class FileRepository extends ServiceEntityRepository
17
{
18
    public function __construct(ManagerRegistry $registry)
19
    {
20
        parent::__construct($registry, File::class);
21
    }
22
23
    public function addFile(People $people, string  $content, string $context, string $fileName, string $fileType, string $extension): File
24
    {
25
26
        $file = new File();
27
        $file->setContext($context);
28
        $file->setContent($content);
29
        $file->setFileName($fileName);
30
        $file->setFileType($fileType);
31
        $file->setExtension($extension);
32
        $file->setPeople($people);
33
        $this->em->persist($file);
34
        $this->em->flush();
35
36
        return $file;
37
    }
38
}
39