User   A
last analyzed

Complexity

Total Complexity 15

Size/Duplication

Total Lines 189
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 15
lcom 0
cbo 0
dl 0
loc 189
rs 10
c 0
b 0
f 0

14 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
A __toString() 0 4 1
A getPhotoName() 0 4 1
A setPhotoName() 0 6 1
A getPhotoFile() 0 4 1
A setPhotoFile() 0 6 1
A addUserPictures() 0 6 1
A getUserPictures() 0 4 1
A addUserPhotos() 0 6 1
A getUserPhotos() 0 4 1
A getCoverUrl() 0 4 1
A setCoverUrl() 0 6 1
A getImageUrl() 0 4 1
A setImageUrl() 0 6 1
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the Bukashk0zzzLiipImagineSerializationBundle
4
 *
5
 * (c) Denis Golubovskiy <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Bukashk0zzz\LiipImagineSerializationBundle\Tests\Fixtures;
12
13
use Bukashk0zzz\LiipImagineSerializationBundle\Annotation as Bukashk0zzz;
14
use Doctrine\Common\Collections\Collection;
15
use Doctrine\ORM\Mapping as ORM;
16
use JMS\Serializer\Annotation as JMS;
17
use Symfony\Component\HttpFoundation\File\File;
18
use Vich\UploaderBundle\Mapping\Annotation as Vich;
19
20
/**
21
 * User Entity
22
 *
23
 * @ORM\Table(name="users")
24
 * @ORM\Entity()
25
 *
26
 * @JMS\ExclusionPolicy("all")
27
 *
28
 * @Vich\Uploadable()
29
 * @Bukashk0zzz\LiipImagineSerializableClass()
30
 */
31
class User
32
{
33
    /**
34
     * @var string Cover url
35
     *
36
     * @ORM\Column(type="string", length=255)
37
     *
38
     * @JMS\Expose()
39
     * @JMS\SerializedName("cover")
40
     *
41
     * @Bukashk0zzz\LiipImagineSerializableField("thumb_filter")
42
     */
43
    public $coverUrl;
44
45
    /**
46
     * @var string Image url
47
     *
48
     * @ORM\Column(type="string", length=255)
49
     *
50
     * @JMS\Expose()
51
     * @JMS\SerializedName("image")
52
     *
53
     * @Bukashk0zzz\LiipImagineSerializableField(filter="thumb_filter", virtualField="imageThumb")
54
     */
55
    public $imageUrl;
56
57
    /**
58
     * @var string Photo name
59
     *
60
     * @ORM\Column(type="string", length=255)
61
     *
62
     * @JMS\Expose()
63
     * @JMS\SerializedName("photo")
64
     *
65
     * @Bukashk0zzz\LiipImagineSerializableField(filter="thumb_filter", vichUploaderField="photoFile")
66
     */
67
    public $photoName;
68
69
    /**
70
     * @var File Photo file
71
     *
72
     * @JMS\Exclude()
73
     *
74
     * @Vich\UploadableField(mapping="user_photo_mapping", fileNameProperty="photoName")
75
     */
76
    public $photoFile;
77
78
    /**
79
     * @var UserPictures
80
     *
81
     * @ORM\OneToMany(targetEntity="Bukashk0zzz\LiipImagineSerializationBundle\Tests\Fixtures\UserPictures", mappedBy="user")
82
     */
83
    public $userPictures;
84
85
    /**
86
     * @var UserPhotos
87
     *
88
     * @ORM\OneToMany(targetEntity="Bukashk0zzz\LiipImagineSerializationBundle\Tests\Fixtures\UserPhotos", mappedBy="user")
89
     */
90
    public $userPhotos;
91
92
    /**
93
     * User constructor.
94
     *
95
     * @param null $photoName
96
     */
97
    public function __construct($photoName = null)
98
    {
99
        $this->setCoverUrl(__DIR__.'/test.png');
100
        if ($photoName) {
101
            $this->setPhotoName(__DIR__.'/'.$photoName);
102
        } else {
103
            $this->setPhotoName(__DIR__.'/test.png');
104
        }
105
        $this->setImageUrl(__DIR__.'/test.png');
106
    }
107
108
    /**
109
     * To string
110
     */
111
    public function __toString(): string
112
    {
113
        return 'New User';
114
    }
115
116
    /**
117
     * Get photo name
118
     *
119
     * @return string Photo name
120
     */
121
    public function getPhotoName(): string
122
    {
123
        return $this->photoName;
124
    }
125
126
    /**
127
     * Set photo name
128
     *
129
     * @param string $photoName Photo name
130
     */
131
    public function setPhotoName(string $photoName): User
132
    {
133
        $this->photoName = $photoName;
134
135
        return $this;
136
    }
137
138
    /**
139
     * Get photo file
140
     *
141
     * @return File Photo file
142
     */
143
    public function getPhotoFile(): File
144
    {
145
        return $this->photoFile;
146
    }
147
148
    /**
149
     * Set photo file
150
     *
151
     * @param File $photoFile Photo file
152
     */
153
    public function setPhotoFile(File $photoFile): User
154
    {
155
        $this->photoFile = $photoFile;
156
157
        return $this;
158
    }
159
160
    /**
161
     * Add userPictures
162
     */
163
    public function addUserPictures(UserPictures $userPictures): User
164
    {
165
        $this->userPictures[] = $userPictures;
166
167
        return $this;
168
    }
169
170
    /**
171
     * Get userPictures
172
     */
173
    public function getUserPictures(): Collection
174
    {
175
        return $this->userPictures;
176
    }
177
178
    /**
179
     * Add userPhotos
180
     */
181
    public function addUserPhotos(UserPhotos $userPhotos): User
182
    {
183
        $this->userPhotos[] = $userPhotos;
184
185
        return $this;
186
    }
187
188
    /**
189
     * Get userPhotos
190
     */
191
    public function getUserPhotos(): Collection
192
    {
193
        return $this->userPhotos;
194
    }
195
196
    public function getCoverUrl(): string
197
    {
198
        return $this->coverUrl;
199
    }
200
201
    public function setCoverUrl(string $coverUrl): User
202
    {
203
        $this->coverUrl = $coverUrl;
204
205
        return $this;
206
    }
207
208
    public function getImageUrl(): string
209
    {
210
        return $this->imageUrl;
211
    }
212
213
    public function setImageUrl(string $imageUrl): User
214
    {
215
        $this->imageUrl = $imageUrl;
216
217
        return $this;
218
    }
219
}
220