Passed
Push — master ( 95085a...dd04b1 )
by Luiz Kim
12:28 queued 04:03
created

File::getUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 1
c 3
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
use ApiPlatform\Metadata\GetCollection;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\GetCollection 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...
6
use ApiPlatform\Metadata\Get;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Get 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 ApiPlatform\Metadata\ApiResource;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiResource 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 ApiPlatform\Metadata\ApiProperty;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiProperty 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
use ApiPlatform\Metadata\ApiFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiFilter 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...
10
use App\Controller\GetFileDataAction;
0 ignored issues
show
Bug introduced by
The type App\Controller\GetFileDataAction 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...
11
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping 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...
12
use Symfony\Component\Serializer\Annotation\Groups;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Serializer\Annotation\Groups 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...
13
use Doctrine\Common\Collections\ArrayCollection;
0 ignored issues
show
Bug introduced by
The type Doctrine\Common\Collections\ArrayCollection 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...
14
use Doctrine\Common\Collections\Collection;
0 ignored issues
show
Bug introduced by
The type Doctrine\Common\Collections\Collection 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...
15
16
/**
17
 * File
18
 *
19
 * @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class})
20
 * @ORM\Entity (repositoryClass="ControleOnline\Repository\FileRepository")
21
 * @ORM\Table (name="files", uniqueConstraints={@ORM\UniqueConstraint (name="url", columns={"url"}), @ORM\UniqueConstraint(name="path", columns={"path"})})
22
 */
23
#[ApiResource(
24
    operations: [
25
        new Get(security: 'is_granted(\'ROLE_CLIENT\')'),
26
        new Get(
27
            security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')',
28
            uriTemplate: '/files/download/{id}',
29
            controller: GetFileDataAction::class
30
        ),
31
        new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')')
32
    ],
33
34
    normalizationContext: ['groups' => ['file_read']],
35
    denormalizationContext: ['groups' => ['file_write']]
36
)]
37
class File
38
{
39
    /**
40
     *
41
     * @ORM\Column(type="integer", nullable=false)
42
     * @ORM\Id
43
     * @ORM\GeneratedValue(strategy="IDENTITY")
44
     * @Groups({"product_file_read","lesson_upload_file:post", "people_read", "task_interaction_read","display_read"})
45
     */
46
    private $id;
47
48
    /**
49
     * @ORM\Column(type="string", length=255, nullable=false)
50
     * @Groups({"lesson_upload_file:post", "people_read", "lesson:read"})
51
     */
52
    private $file_type;
53
    /**
54
     * @ORM\Column(type="string", length=255, nullable=false)
55
     */
56
    private $content;
57
58
59
    /**
60
     * @ORM\OneToMany(targetEntity="ControleOnline\Entity\People", mappedBy="file")
61
     */
62
    private $people;
63
   
64
    public function __construct()
65
    {
66
        $this->people = new \Doctrine\Common\Collections\ArrayCollection();
67
    }
68
   
69
    public function getId()
70
    {
71
        return $this->id;
72
    }
73
74
    public function addPeople(People $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...
75
    {
76
        $this->people[] = $people;
77
        return $this;
78
    }
79
80
    public function removePeople(People $people)
81
    {
82
        $this->people->removeElement($people);
83
    }
84
    
85
    public function getPeople()
86
    {
87
        return $this->people;
88
    }
89
90
    /**
91
     * Get the value of file_type
92
     */
93
    public function getFileType()
94
    {
95
        return $this->file_type;
96
    }
97
98
    /**
99
     * Set the value of file_type
100
     */
101
    public function setFileType($file_type): self
102
    {
103
        $this->file_type = $file_type;
104
105
        return $this;
106
    }
107
108
    /**
109
     * Get the value of content
110
     */
111
    public function getContent()
112
    {
113
        return $this->content;
114
    }
115
116
    /**
117
     * Set the value of content
118
     */
119
    public function setContent($content): self
120
    {
121
        $this->content = $content;
122
123
        return $this;
124
    }
125
}
126