These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\SeoBundle\Entity; |
||
4 | |||
5 | use Doctrine\ORM\EntityManager; |
||
6 | use Doctrine\ORM\Mapping as ORM; |
||
7 | use Kunstmaan\AdminBundle\Entity\AbstractEntity; |
||
8 | use Kunstmaan\MediaBundle\Entity\Media; |
||
9 | use Kunstmaan\SeoBundle\Form\SeoType; |
||
10 | use Kunstmaan\UtilitiesBundle\Helper\ClassLookup; |
||
11 | |||
12 | /** |
||
13 | * Seo metadata for entities |
||
14 | * |
||
15 | * @ORM\Entity(repositoryClass="Kunstmaan\SeoBundle\Repository\SeoRepository") |
||
16 | * @ORM\Table(name="kuma_seo", indexes={@ORM\Index(name="idx_seo_lookup", columns={"ref_id", "ref_entity_name"})}) |
||
17 | * @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT") |
||
18 | */ |
||
19 | class Seo extends AbstractEntity |
||
20 | { |
||
21 | /** |
||
22 | * @var string |
||
23 | * |
||
24 | * @ORM\Column(name="meta_title", type="string", nullable=true) |
||
25 | * |
||
26 | */ |
||
27 | protected $metaTitle; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | * |
||
32 | * @ORM\Column(name="meta_description", type="text", nullable=true) |
||
33 | * |
||
34 | */ |
||
35 | protected $metaDescription; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | * |
||
40 | * @ORM\Column(name="meta_author", type="string", nullable=true) |
||
41 | */ |
||
42 | protected $metaAuthor; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | * |
||
47 | * @ORM\Column(name="meta_robots", type="string", nullable=true) |
||
48 | */ |
||
49 | protected $metaRobots; |
||
50 | |||
51 | /** |
||
52 | * @var string |
||
53 | * |
||
54 | * @ORM\Column(name="og_type", type="string", nullable=true) |
||
55 | */ |
||
56 | protected $ogType; |
||
57 | |||
58 | /** |
||
59 | * @var string |
||
60 | * |
||
61 | * @ORM\Column(name="og_title", type="string", nullable=true) |
||
62 | */ |
||
63 | protected $ogTitle; |
||
64 | |||
65 | /** |
||
66 | * @var string |
||
67 | * |
||
68 | * @ORM\Column(name="og_description", type="text", nullable=true) |
||
69 | */ |
||
70 | protected $ogDescription; |
||
71 | |||
72 | /** |
||
73 | * @var Media |
||
74 | * |
||
75 | * @ORM\ManyToOne(targetEntity="Kunstmaan\MediaBundle\Entity\Media") |
||
76 | * @ORM\JoinColumn(name="og_image_id", referencedColumnName="id") |
||
77 | */ |
||
78 | protected $ogImage; |
||
79 | |||
80 | /** |
||
81 | * @var string |
||
82 | * |
||
83 | * @ORM\Column(name="extra_metadata", type="text", nullable=true) |
||
84 | */ |
||
85 | protected $extraMetadata; |
||
86 | |||
87 | /** |
||
88 | * @var int |
||
89 | * |
||
90 | * @ORM\Column(type="bigint", name="ref_id") |
||
91 | */ |
||
92 | protected $refId; |
||
93 | |||
94 | /** |
||
95 | * @var string |
||
96 | * |
||
97 | * @ORM\Column(type="string", name="ref_entity_name") |
||
98 | */ |
||
99 | protected $refEntityName; |
||
100 | |||
101 | /** |
||
102 | * @ORM\Column(type="string", nullable=true, name="og_url") |
||
103 | */ |
||
104 | protected $ogUrl; |
||
105 | |||
106 | /** |
||
107 | * @ORM\Column(type="string", length=100, nullable=true, name="og_article_author") |
||
108 | */ |
||
109 | protected $ogArticleAuthor; |
||
110 | |||
111 | /** |
||
112 | * @ORM\Column(type="string", length=100, nullable=true, name="og_article_publisher") |
||
113 | */ |
||
114 | protected $ogArticlePublisher; |
||
115 | |||
116 | /** |
||
117 | * @ORM\Column(type="string", length=100, nullable=true, name="og_article_section") |
||
118 | */ |
||
119 | protected $ogArticleSection; |
||
120 | |||
121 | /** |
||
122 | * @var string $twitterTitle |
||
123 | * |
||
124 | * @ORM\Column(name="twitter_title", type="string", length=255, nullable=true) |
||
125 | */ |
||
126 | protected $twitterTitle; |
||
127 | |||
128 | /** |
||
129 | * @var string $twitterTitle |
||
130 | * |
||
131 | * @ORM\Column(name="twitter_description", type="text", nullable=true) |
||
132 | */ |
||
133 | protected $twitterDescription; |
||
134 | |||
135 | /** |
||
136 | * @var string $twitterTitle |
||
137 | * |
||
138 | * @ORM\Column(name="twitter_site", type="string", length=255, nullable=true) |
||
139 | */ |
||
140 | protected $twitterSite; |
||
141 | |||
142 | /** |
||
143 | * @var string $twitterTitle |
||
144 | * |
||
145 | * @ORM\Column(name="twitter_creator", type="string", length=255, nullable=true) |
||
146 | */ |
||
147 | protected $twitterCreator; |
||
148 | |||
149 | /** |
||
150 | * @var Media |
||
151 | * |
||
152 | * @ORM\ManyToOne(targetEntity="Kunstmaan\MediaBundle\Entity\Media") |
||
153 | * @ORM\JoinColumn(name="twitter_image_id", referencedColumnName="id") |
||
154 | */ |
||
155 | protected $twitterImage; |
||
156 | |||
157 | /** |
||
158 | * @param string $url |
||
159 | * |
||
160 | * @return Seo |
||
161 | */ |
||
162 | public function setOgUrl($url) |
||
163 | { |
||
164 | $this->ogUrl = $url; |
||
165 | |||
166 | return $this; |
||
167 | } |
||
168 | |||
169 | /** |
||
170 | * @return string |
||
171 | */ |
||
172 | public function getOgUrl() |
||
173 | { |
||
174 | return $this->ogUrl; |
||
175 | } |
||
176 | |||
177 | /** |
||
178 | * @return string |
||
179 | */ |
||
180 | public function getMetaTitle() |
||
181 | { |
||
182 | return $this->metaTitle; |
||
183 | } |
||
184 | |||
185 | /** |
||
186 | * @param string $title |
||
187 | * |
||
188 | * @return string |
||
0 ignored issues
–
show
|
|||
189 | */ |
||
190 | public function setMetaTitle($title) |
||
191 | { |
||
192 | $this->metaTitle = $title; |
||
193 | |||
194 | return $this; |
||
195 | } |
||
196 | |||
197 | /** |
||
198 | * @return string |
||
199 | */ |
||
200 | public function getMetaAuthor() |
||
201 | { |
||
202 | return $this->metaAuthor; |
||
203 | } |
||
204 | |||
205 | /** |
||
206 | * @param string $meta |
||
207 | * |
||
208 | * @return Seo |
||
209 | */ |
||
210 | public function setMetaAuthor($meta) |
||
211 | { |
||
212 | $this->metaAuthor = $meta; |
||
213 | |||
214 | return $this; |
||
215 | } |
||
216 | |||
217 | /** |
||
218 | * @return string |
||
219 | */ |
||
220 | public function getMetaDescription() |
||
221 | { |
||
222 | return $this->metaDescription; |
||
223 | } |
||
224 | |||
225 | /** |
||
226 | * @param string $meta |
||
227 | * |
||
228 | * @return Seo |
||
229 | */ |
||
230 | public function setMetaDescription($meta) |
||
231 | { |
||
232 | $this->metaDescription = $meta; |
||
233 | |||
234 | return $this; |
||
235 | } |
||
236 | |||
237 | /** |
||
238 | * @return string |
||
239 | */ |
||
240 | public function getMetaRobots() |
||
241 | { |
||
242 | return $this->metaRobots; |
||
243 | } |
||
244 | |||
245 | /** |
||
246 | * @param string $meta |
||
247 | * |
||
248 | * @return Seo |
||
249 | */ |
||
250 | public function setMetaRobots($meta) |
||
251 | { |
||
252 | $this->metaRobots = $meta; |
||
253 | |||
254 | return $this; |
||
255 | } |
||
256 | |||
257 | /** |
||
258 | * @return string |
||
259 | */ |
||
260 | public function getExtraMetadata() |
||
261 | { |
||
262 | return $this->extraMetadata; |
||
263 | } |
||
264 | |||
265 | /** |
||
266 | * @param string $extraMetadata |
||
267 | * |
||
268 | * @return Seo |
||
269 | */ |
||
270 | public function setExtraMetadata($extraMetadata) |
||
271 | { |
||
272 | $this->extraMetadata = $extraMetadata; |
||
273 | |||
274 | return $this; |
||
275 | } |
||
276 | |||
277 | /** |
||
278 | * @param string $ogDescription |
||
279 | * |
||
280 | * @return Seo |
||
281 | */ |
||
282 | public function setOgDescription($ogDescription) |
||
283 | { |
||
284 | $this->ogDescription = $ogDescription; |
||
285 | |||
286 | return $this; |
||
287 | } |
||
288 | |||
289 | /** |
||
290 | * @return mixed |
||
291 | */ |
||
292 | public function getOgDescription() |
||
293 | { |
||
294 | return $this->ogDescription; |
||
295 | } |
||
296 | |||
297 | /** |
||
298 | * @param Media $ogImage |
||
299 | * |
||
300 | * @return Seo |
||
301 | */ |
||
302 | public function setOgImage(Media $ogImage = null) |
||
303 | { |
||
304 | $this->ogImage = $ogImage; |
||
305 | |||
306 | return $this; |
||
307 | } |
||
308 | |||
309 | /** |
||
310 | * @return mixed |
||
311 | */ |
||
312 | public function getOgImage() |
||
313 | { |
||
314 | return $this->ogImage; |
||
315 | } |
||
316 | |||
317 | /** |
||
318 | * @param string $ogTitle |
||
319 | * |
||
320 | * @return Seo |
||
321 | */ |
||
322 | public function setOgTitle($ogTitle) |
||
323 | { |
||
324 | $this->ogTitle = $ogTitle; |
||
325 | |||
326 | return $this; |
||
327 | } |
||
328 | |||
329 | /** |
||
330 | * @return mixed |
||
331 | */ |
||
332 | public function getOgTitle() |
||
333 | { |
||
334 | return $this->ogTitle; |
||
335 | } |
||
336 | |||
337 | /** |
||
338 | * @param string $ogType |
||
339 | * |
||
340 | * @return Seo |
||
341 | */ |
||
342 | public function setOgType($ogType) |
||
343 | { |
||
344 | $this->ogType = $ogType; |
||
345 | |||
346 | return $this; |
||
347 | } |
||
348 | |||
349 | /** |
||
350 | * @return mixed |
||
351 | */ |
||
352 | public function getOgType() |
||
353 | { |
||
354 | return $this->ogType; |
||
355 | } |
||
356 | |||
357 | /** |
||
358 | * @return mixed |
||
359 | */ |
||
360 | public function getOgArticleAuthor() |
||
361 | { |
||
362 | return $this->ogArticleAuthor; |
||
363 | } |
||
364 | |||
365 | /** |
||
366 | * @param mixed $ogArticleAuthor |
||
367 | */ |
||
368 | public function setOgArticleAuthor($ogArticleAuthor) |
||
369 | { |
||
370 | $this->ogArticleAuthor = $ogArticleAuthor; |
||
371 | } |
||
372 | |||
373 | /** |
||
374 | * @return mixed |
||
375 | */ |
||
376 | public function getOgArticlePublisher() |
||
377 | { |
||
378 | return $this->ogArticlePublisher; |
||
379 | } |
||
380 | |||
381 | /** |
||
382 | * @param mixed $ogArticlePublisher |
||
383 | */ |
||
384 | public function setOgArticlePublisher($ogArticlePublisher) |
||
385 | { |
||
386 | $this->ogArticlePublisher = $ogArticlePublisher; |
||
387 | } |
||
388 | |||
389 | /** |
||
390 | * @return mixed |
||
391 | */ |
||
392 | public function getOgArticleSection() |
||
393 | { |
||
394 | return $this->ogArticleSection; |
||
395 | } |
||
396 | |||
397 | /** |
||
398 | * @param mixed $ogArticleSection |
||
399 | */ |
||
400 | public function setOgArticleSection($ogArticleSection) |
||
401 | { |
||
402 | $this->ogArticleSection = $ogArticleSection; |
||
403 | } |
||
404 | |||
405 | /** |
||
406 | * @return string |
||
407 | */ |
||
408 | public function getTwitterTitle() |
||
409 | { |
||
410 | return $this->twitterTitle; |
||
411 | } |
||
412 | |||
413 | /** |
||
414 | * @param string $twitterTitle |
||
415 | */ |
||
416 | public function setTwitterTitle($twitterTitle) |
||
417 | { |
||
418 | $this->twitterTitle = $twitterTitle; |
||
419 | } |
||
420 | |||
421 | /** |
||
422 | * @return string |
||
423 | */ |
||
424 | public function getTwitterDescription() |
||
425 | { |
||
426 | return $this->twitterDescription; |
||
427 | } |
||
428 | |||
429 | /** |
||
430 | * @param string $twitterDescription |
||
431 | */ |
||
432 | public function setTwitterDescription($twitterDescription) |
||
433 | { |
||
434 | $this->twitterDescription = $twitterDescription; |
||
435 | } |
||
436 | |||
437 | /** |
||
438 | * @return string |
||
439 | */ |
||
440 | public function getTwitterSite() |
||
441 | { |
||
442 | return $this->twitterSite; |
||
443 | } |
||
444 | |||
445 | /** |
||
446 | * @param string $twitterSite |
||
447 | */ |
||
448 | public function setTwitterSite($twitterSite) |
||
449 | { |
||
450 | $this->twitterSite = $twitterSite; |
||
451 | } |
||
452 | |||
453 | /** |
||
454 | * @return string |
||
455 | */ |
||
456 | public function getTwitterCreator() |
||
457 | { |
||
458 | return $this->twitterCreator; |
||
459 | } |
||
460 | |||
461 | /** |
||
462 | * @param string $twitterCreator |
||
463 | */ |
||
464 | public function setTwitterCreator($twitterCreator) |
||
465 | { |
||
466 | $this->twitterCreator = $twitterCreator; |
||
467 | } |
||
468 | |||
469 | /** |
||
470 | * @return Media |
||
471 | */ |
||
472 | public function getTwitterImage() |
||
473 | { |
||
474 | return $this->twitterImage; |
||
475 | } |
||
476 | |||
477 | /** |
||
478 | * @param Media $twitterImage |
||
479 | */ |
||
480 | public function setTwitterImage($twitterImage) |
||
481 | { |
||
482 | $this->twitterImage = $twitterImage; |
||
483 | } |
||
484 | |||
485 | /** |
||
486 | * Get refId |
||
487 | * |
||
488 | * @return int |
||
489 | */ |
||
490 | public function getRefId() |
||
491 | { |
||
492 | return $this->refId; |
||
493 | } |
||
494 | |||
495 | /** |
||
496 | * Set refId |
||
497 | * |
||
498 | * @param int $refId |
||
499 | * |
||
500 | * @return Seo |
||
501 | */ |
||
502 | protected function setRefId($refId) |
||
503 | { |
||
504 | $this->refId = $refId; |
||
505 | |||
506 | return $this; |
||
507 | } |
||
508 | |||
509 | /** |
||
510 | * Set reference entity name |
||
511 | * |
||
512 | * @param string $refEntityName |
||
513 | * |
||
514 | * @return Seo |
||
515 | */ |
||
516 | protected function setRefEntityName($refEntityName) |
||
517 | { |
||
518 | $this->refEntityName = $refEntityName; |
||
519 | |||
520 | return $this; |
||
521 | } |
||
522 | |||
523 | /** |
||
524 | * Get reference entity name |
||
525 | * |
||
526 | * @return string |
||
527 | */ |
||
528 | public function getRefEntityName() |
||
529 | { |
||
530 | return $this->refEntityName; |
||
531 | } |
||
532 | |||
533 | /** |
||
534 | * @param AbstractEntity $entity |
||
535 | * |
||
536 | * @return Seo |
||
537 | */ |
||
538 | public function setRef(AbstractEntity $entity) |
||
539 | { |
||
540 | $this->setRefId($entity->getId()); |
||
541 | $this->setRefEntityName(ClassLookup::getClass($entity)); |
||
542 | |||
543 | return $this; |
||
544 | } |
||
545 | |||
546 | /** |
||
547 | * @param EntityManager $em |
||
548 | * |
||
549 | * @return AbstractEntity |
||
550 | */ |
||
551 | public function getRef(EntityManager $em) |
||
552 | { |
||
553 | return $em->getRepository($this->getRefEntityName())->find($this->getRefId()); |
||
554 | } |
||
555 | |||
556 | /** |
||
557 | * @return string |
||
558 | */ |
||
559 | public function getDefaultAdminType() |
||
560 | { |
||
561 | return SeoType::class; |
||
562 | } |
||
563 | } |
||
564 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.