Complex classes like PageSeo often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use PageSeo, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 18 | class PageSeo |
||
| 19 | { |
||
| 20 | use \Gedmo\Timestampable\Traits\TimestampableEntity; |
||
| 21 | use Translatable; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var int |
||
| 25 | * |
||
| 26 | * @ORM\Column(name="id", type="integer") |
||
| 27 | * @ORM\Id |
||
| 28 | * @ORM\GeneratedValue(strategy="AUTO") |
||
| 29 | */ |
||
| 30 | protected $id; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var string |
||
| 34 | * |
||
| 35 | * @ORM\Column(name="meta_title", type="string", nullable=true) |
||
| 36 | * @Assert\Length(max = 60) |
||
| 37 | * @Gedmo\Translatable |
||
| 38 | */ |
||
| 39 | protected $metaTitle; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @var string |
||
| 43 | * |
||
| 44 | * @ORM\Column(name="meta_description", type="string", length=255, nullable=true) |
||
| 45 | * @Assert\Length(max = 155) |
||
| 46 | * @Gedmo\Translatable |
||
| 47 | */ |
||
| 48 | protected $metaDescription; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @var string |
||
| 52 | * |
||
| 53 | * @ORM\Column(name="rel_author", type="string", length=255, nullable=true) |
||
| 54 | * @Gedmo\Translatable |
||
| 55 | */ |
||
| 56 | protected $relAuthor; |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @var string |
||
| 60 | * |
||
| 61 | * @ORM\Column(name="rel_publisher", type="string", length=255, nullable=true) |
||
| 62 | * @Gedmo\Translatable |
||
| 63 | */ |
||
| 64 | protected $relPublisher; |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @var string |
||
| 68 | * |
||
| 69 | * @ORM\Column(name="ogTitle", type="string", length=255, nullable=true) |
||
| 70 | * @Gedmo\Translatable |
||
| 71 | */ |
||
| 72 | protected $ogTitle; |
||
| 73 | |||
| 74 | /** |
||
| 75 | * @var string |
||
| 76 | * |
||
| 77 | * @ORM\Column(name="ogType", type="string", length=255, nullable=true) |
||
| 78 | * @Gedmo\Translatable |
||
| 79 | */ |
||
| 80 | protected $ogType; |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @var string |
||
| 84 | * |
||
| 85 | * @ORM\ManyToOne(targetEntity="\Victoire\Bundle\MediaBundle\Entity\Media") |
||
| 86 | * @ORM\JoinColumn(name="ogImage_id", referencedColumnName="id", onDelete="SET NULL") |
||
| 87 | */ |
||
| 88 | protected $ogImage; |
||
| 89 | |||
| 90 | /** |
||
| 91 | * @var string |
||
| 92 | * |
||
| 93 | * @ORM\Column(name="ogUrl", type="string", length=255, nullable=true) |
||
| 94 | * @Gedmo\Translatable |
||
| 95 | */ |
||
| 96 | protected $ogUrl; |
||
| 97 | |||
| 98 | /** |
||
| 99 | * @var text |
||
| 100 | * |
||
| 101 | * @ORM\Column(name="ogDescription", type="text", nullable=true) |
||
| 102 | * @Gedmo\Translatable |
||
| 103 | */ |
||
| 104 | protected $ogDescription; |
||
| 105 | |||
| 106 | /** |
||
| 107 | * @var string |
||
| 108 | * |
||
| 109 | * @ORM\Column(name="fbAdmins", type="string", length=255, nullable=true) |
||
| 110 | * @Gedmo\Translatable |
||
| 111 | */ |
||
| 112 | protected $fbAdmins; |
||
| 113 | |||
| 114 | /** |
||
| 115 | * @var string |
||
| 116 | * |
||
| 117 | * @ORM\Column(name="twitterCard", type="string", length=255, nullable=true) |
||
| 118 | * @Gedmo\Translatable |
||
| 119 | */ |
||
| 120 | protected $twitterCard = 'summary'; |
||
| 121 | |||
| 122 | /** |
||
| 123 | * @var string |
||
| 124 | * |
||
| 125 | * @ORM\Column(name="twitterUrl", type="string", length=255, nullable=true) |
||
| 126 | * @Gedmo\Translatable |
||
| 127 | * @Assert\Length(max = 15) |
||
| 128 | */ |
||
| 129 | protected $twitterUrl; |
||
| 130 | |||
| 131 | /** |
||
| 132 | * @var string |
||
| 133 | * |
||
| 134 | * @ORM\Column(name="twitterCreator", type="string", length=255, nullable=true) |
||
| 135 | * @Gedmo\Translatable |
||
| 136 | * @Assert\Length(max = 15) |
||
| 137 | */ |
||
| 138 | protected $twitterCreator; |
||
| 139 | |||
| 140 | /** |
||
| 141 | * @var string |
||
| 142 | * |
||
| 143 | * @ORM\Column(name="twitterTitle", type="string", length=255, nullable=true) |
||
| 144 | * @Gedmo\Translatable |
||
| 145 | * @Assert\Length(max = 70) |
||
| 146 | */ |
||
| 147 | protected $twitterTitle; |
||
| 148 | |||
| 149 | /** |
||
| 150 | * @var string |
||
| 151 | * |
||
| 152 | * @ORM\Column(name="twitterDescription", type="string", length=255, nullable=true) |
||
| 153 | * @Gedmo\Translatable |
||
| 154 | * @Assert\Length(max = 200) |
||
| 155 | */ |
||
| 156 | protected $twitterDescription; |
||
| 157 | |||
| 158 | /** |
||
| 159 | * @var string |
||
| 160 | * |
||
| 161 | * @ORM\ManyToOne(targetEntity="\Victoire\Bundle\MediaBundle\Entity\Media") |
||
| 162 | * @ORM\JoinColumn(name="twitterImage_id", referencedColumnName="id", onDelete="SET NULL") |
||
| 163 | */ |
||
| 164 | protected $twitterImage; |
||
| 165 | |||
| 166 | /** |
||
| 167 | * @var string |
||
| 168 | * |
||
| 169 | * @ORM\Column(name="schemaPageType", type="string", length=255, nullable=true) |
||
| 170 | * @Gedmo\Translatable |
||
| 171 | */ |
||
| 172 | protected $schemaPageType; |
||
| 173 | |||
| 174 | /** |
||
| 175 | * @var string |
||
| 176 | * |
||
| 177 | * @ORM\Column(name="schemaName", type="string", length=255, nullable=true) |
||
| 178 | * @Gedmo\Translatable |
||
| 179 | */ |
||
| 180 | protected $schemaName; |
||
| 181 | |||
| 182 | /** |
||
| 183 | * @var string |
||
| 184 | * |
||
| 185 | * @ORM\Column(name="schemaDescription", type="string", length=255, nullable=true) |
||
| 186 | * @Gedmo\Translatable |
||
| 187 | */ |
||
| 188 | protected $schemaDescription; |
||
| 189 | |||
| 190 | /** |
||
| 191 | * @var string |
||
| 192 | * |
||
| 193 | * @ORM\ManyToOne(targetEntity="\Victoire\Bundle\MediaBundle\Entity\Media") |
||
| 194 | * @ORM\JoinColumn(name="schemaImage_id", referencedColumnName="id", onDelete="SET NULL") |
||
| 195 | */ |
||
| 196 | protected $schemaImage; |
||
| 197 | |||
| 198 | /** |
||
| 199 | * @var string |
||
| 200 | * |
||
| 201 | * @ORM\Column(name="meta_robots_index", type="string", length=255, nullable=true) |
||
| 202 | * @Gedmo\Translatable |
||
| 203 | */ |
||
| 204 | protected $metaRobotsIndex; |
||
| 205 | |||
| 206 | /** |
||
| 207 | * @var string |
||
| 208 | * |
||
| 209 | * @ORM\Column(name="meta_robots_follow", type="string", length=255, nullable=true) |
||
| 210 | * @Gedmo\Translatable |
||
| 211 | */ |
||
| 212 | protected $metaRobotsFollow; |
||
| 213 | |||
| 214 | /** |
||
| 215 | * @var string |
||
| 216 | * |
||
| 217 | * @ORM\Column(name="meta_robots_advanced", type="string", length=255, nullable=true) |
||
| 218 | * @Gedmo\Translatable |
||
| 219 | */ |
||
| 220 | protected $metaRobotsAdvanced; |
||
| 221 | |||
| 222 | /** |
||
| 223 | * @var bool |
||
| 224 | * |
||
| 225 | * @ORM\Column(name="sitemap_indexed", type="boolean", nullable=true, options={"default" = true}) |
||
| 226 | * @Gedmo\Translatable |
||
| 227 | */ |
||
| 228 | protected $sitemapIndexed = true; |
||
| 229 | |||
| 230 | /** |
||
| 231 | * @var float |
||
| 232 | * |
||
| 233 | * @ORM\Column(name="sitemap_priority", type="float", nullable=true, options={"default" = "0.8"}) |
||
| 234 | * @Gedmo\Translatable |
||
| 235 | */ |
||
| 236 | protected $sitemapPriority = 0.8; |
||
| 237 | |||
| 238 | /** |
||
| 239 | * @var string |
||
| 240 | * |
||
| 241 | * @ORM\Column(name="sitemap_changeFreq", type="string", length=20, nullable=true, options={"default" = "monthly"}) |
||
| 242 | * @Gedmo\Translatable |
||
| 243 | */ |
||
| 244 | protected $sitemapChangeFreq = 'monthly'; |
||
| 245 | |||
| 246 | /** |
||
| 247 | * @var string |
||
| 248 | * |
||
| 249 | * @ORM\Column(name="rel_canonical", type="string", length=255, nullable=true) |
||
| 250 | * @Gedmo\Translatable |
||
| 251 | */ |
||
| 252 | protected $relCanonical; |
||
| 253 | |||
| 254 | /** |
||
| 255 | * @var string |
||
| 256 | * |
||
| 257 | * @ORM\Column(name="keyword", type="string", length=255, nullable=true) |
||
| 258 | * @Gedmo\Translatable |
||
| 259 | */ |
||
| 260 | protected $keyword; |
||
| 261 | |||
| 262 | /** |
||
| 263 | * @var string |
||
| 264 | * |
||
| 265 | * @ORM\ManyToOne( |
||
| 266 | * targetEntity="\Victoire\Bundle\PageBundle\Entity\Page", |
||
| 267 | * inversedBy="referers", |
||
| 268 | * cascade={"persist"} |
||
| 269 | * ) |
||
| 270 | * @ORM\JoinColumn(name="redirect_to", referencedColumnName="id", onDelete="SET NULL") |
||
| 271 | */ |
||
| 272 | protected $redirectTo; |
||
| 273 | |||
| 274 | /** |
||
| 275 | * Set redirectTo w/ proxy. |
||
| 276 | * |
||
| 277 | * @param View $redirectTo |
||
| 278 | * |
||
| 279 | * @return PageSeo |
||
| 280 | */ |
||
| 281 | public function setRedirectTo(View $redirectTo, $locale = null) |
||
| 282 | { |
||
| 283 | $this->translate($locale, false)->setRedirectTo($redirectTo); |
||
|
|
|||
| 284 | $this->mergeNewTranslations(); |
||
| 285 | |||
| 286 | return $this; |
||
| 287 | } |
||
| 288 | |||
| 289 | /** |
||
| 290 | * Get redirectTo w/ proxy. |
||
| 291 | * |
||
| 292 | * @return string |
||
| 293 | */ |
||
| 294 | public function getRedirectTo() |
||
| 295 | { |
||
| 296 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getRedirectTo'); |
||
| 297 | } |
||
| 298 | |||
| 299 | /** |
||
| 300 | * Set metaTitle w/ proxy. |
||
| 301 | * |
||
| 302 | * @param string $metaTitle |
||
| 303 | * |
||
| 304 | * @return PageSeo |
||
| 305 | */ |
||
| 306 | public function setMetaTitle($metaTitle, $locale = null) |
||
| 307 | { |
||
| 308 | $this->translate($locale, false)->setMetaTitle($metaTitle); |
||
| 309 | $this->mergeNewTranslations(); |
||
| 310 | |||
| 311 | return $this; |
||
| 312 | } |
||
| 313 | |||
| 314 | /** |
||
| 315 | * Get metaTitle w/ proxy. |
||
| 316 | * |
||
| 317 | * @return string |
||
| 318 | */ |
||
| 319 | public function getMetaTitle() |
||
| 320 | { |
||
| 321 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getMetaTitle'); |
||
| 322 | } |
||
| 323 | |||
| 324 | /** |
||
| 325 | * Set metaDescription w/ proxy. |
||
| 326 | * |
||
| 327 | * @param string $metaDescription |
||
| 328 | * |
||
| 329 | * @return PageSeo |
||
| 330 | */ |
||
| 331 | public function setMetaDescription($metaDescription, $locale = null) |
||
| 332 | { |
||
| 333 | $this->translate($locale, false)->setMetaDescription($metaDescription); |
||
| 334 | $this->mergeNewTranslations(); |
||
| 335 | |||
| 336 | return $this; |
||
| 337 | } |
||
| 338 | |||
| 339 | /** |
||
| 340 | * Get metaDescription w/ proxy. |
||
| 341 | * |
||
| 342 | * @return string |
||
| 343 | */ |
||
| 344 | public function getMetaDescription() |
||
| 345 | { |
||
| 346 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getMetaDescription'); |
||
| 347 | } |
||
| 348 | |||
| 349 | /** |
||
| 350 | * Set relAuthor w/ proxy. |
||
| 351 | * |
||
| 352 | * @param string $relAuthor |
||
| 353 | * |
||
| 354 | * @return PageSeo |
||
| 355 | */ |
||
| 356 | public function setRelAuthor($relAuthor, $locale = null) |
||
| 357 | { |
||
| 358 | $this->translate($locale, false)->setRelAuthor($relAuthor); |
||
| 359 | $this->mergeNewTranslations(); |
||
| 360 | |||
| 361 | return $this; |
||
| 362 | } |
||
| 363 | |||
| 364 | /** |
||
| 365 | * Get relAuthor w/ proxy. |
||
| 366 | * |
||
| 367 | * @return string |
||
| 368 | */ |
||
| 369 | public function getRelAuthor() |
||
| 370 | { |
||
| 371 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getRelAuthor'); |
||
| 372 | } |
||
| 373 | |||
| 374 | /** |
||
| 375 | * Set relPublisher w/ proxy. |
||
| 376 | * |
||
| 377 | * @param string $relPublisher |
||
| 378 | * |
||
| 379 | * @return PageSeo |
||
| 380 | */ |
||
| 381 | public function setRelPublisher($relPublisher, $locale = null) |
||
| 382 | { |
||
| 383 | $this->translate($locale, false)->setRelPublisher($relPublisher); |
||
| 384 | $this->mergeNewTranslations(); |
||
| 385 | |||
| 386 | return $this; |
||
| 387 | } |
||
| 388 | |||
| 389 | /** |
||
| 390 | * Get relPublisher w/ proxy. |
||
| 391 | * |
||
| 392 | * @return string |
||
| 393 | */ |
||
| 394 | public function getRelPublisher() |
||
| 395 | { |
||
| 396 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getRelPublisher'); |
||
| 397 | } |
||
| 398 | |||
| 399 | /** |
||
| 400 | * Set ogTitle w/ proxy. |
||
| 401 | * |
||
| 402 | * @param string $ogTitle |
||
| 403 | * |
||
| 404 | * @return PageSeo |
||
| 405 | */ |
||
| 406 | public function setOgTitle($ogTitle, $locale = null) |
||
| 407 | { |
||
| 408 | $this->translate($locale, false)->setOgTitle($ogTitle); |
||
| 409 | $this->mergeNewTranslations(); |
||
| 410 | |||
| 411 | return $this; |
||
| 412 | } |
||
| 413 | |||
| 414 | /** |
||
| 415 | * Get ogTitle w/ proxy. |
||
| 416 | * |
||
| 417 | * @return string |
||
| 418 | */ |
||
| 419 | public function getOgTitle() |
||
| 420 | { |
||
| 421 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getOgTitle'); |
||
| 422 | } |
||
| 423 | |||
| 424 | /** |
||
| 425 | * Set ogType w/ proxy. |
||
| 426 | * |
||
| 427 | * @param string $ogType |
||
| 428 | * |
||
| 429 | * @return PageSeo |
||
| 430 | */ |
||
| 431 | public function setOgType($ogType, $locale = null) |
||
| 432 | { |
||
| 433 | $this->translate($locale, false)->setOgType($ogType); |
||
| 434 | $this->mergeNewTranslations(); |
||
| 435 | |||
| 436 | return $this; |
||
| 437 | } |
||
| 438 | |||
| 439 | /** |
||
| 440 | * Get ogType w/ proxy. |
||
| 441 | * |
||
| 442 | * @return string |
||
| 443 | */ |
||
| 444 | public function getOgType() |
||
| 445 | { |
||
| 446 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getOgType'); |
||
| 447 | } |
||
| 448 | |||
| 449 | /** |
||
| 450 | * Set ogImage w/ proxy. |
||
| 451 | * |
||
| 452 | * @param Image $ogImage |
||
| 453 | * |
||
| 454 | * @return PageSeo |
||
| 455 | */ |
||
| 456 | public function setOgImage($ogImage, $locale = null) |
||
| 457 | { |
||
| 458 | $this->translate($locale, false)->setOgImage($ogImage); |
||
| 459 | $this->mergeNewTranslations(); |
||
| 460 | |||
| 461 | return $this; |
||
| 462 | } |
||
| 463 | |||
| 464 | /** |
||
| 465 | * Get ogImage w/ proxy. |
||
| 466 | * |
||
| 467 | * @return string |
||
| 468 | */ |
||
| 469 | public function getOgImage() |
||
| 470 | { |
||
| 471 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getOgImage'); |
||
| 472 | } |
||
| 473 | |||
| 474 | /** |
||
| 475 | * Set ogUrl w/ proxy. |
||
| 476 | * |
||
| 477 | * @param string $ogUrl |
||
| 478 | * |
||
| 479 | * @return PageSeo |
||
| 480 | */ |
||
| 481 | public function setOgUrl($ogUrl, $locale = null) |
||
| 482 | { |
||
| 483 | $this->translate($locale, false)->setOgUrl($ogUrl); |
||
| 484 | $this->mergeNewTranslations(); |
||
| 485 | |||
| 486 | return $this; |
||
| 487 | } |
||
| 488 | |||
| 489 | /** |
||
| 490 | * Get ogUrl w/ proxy. |
||
| 491 | * |
||
| 492 | * @return string |
||
| 493 | */ |
||
| 494 | public function getOgUrl() |
||
| 495 | { |
||
| 496 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getOgUrl'); |
||
| 497 | } |
||
| 498 | |||
| 499 | /** |
||
| 500 | * Set ogDescription w/ proxy. |
||
| 501 | * |
||
| 502 | * @param string $ogDescription |
||
| 503 | * |
||
| 504 | * @return PageSeo |
||
| 505 | */ |
||
| 506 | public function setOgDescription($ogDescription, $locale = null) |
||
| 507 | { |
||
| 508 | $this->translate($locale, false)->setOgDescription($ogDescription); |
||
| 509 | $this->mergeNewTranslations(); |
||
| 510 | |||
| 511 | return $this; |
||
| 512 | } |
||
| 513 | |||
| 514 | /** |
||
| 515 | * Get ogDescription w/ proxy. |
||
| 516 | * |
||
| 517 | * @return string |
||
| 518 | */ |
||
| 519 | public function getOgDescription() |
||
| 520 | { |
||
| 521 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getOgDescription'); |
||
| 522 | } |
||
| 523 | |||
| 524 | /** |
||
| 525 | * Set fbAdmins w/ proxy. |
||
| 526 | * |
||
| 527 | * @param string $fbAdmins |
||
| 528 | * |
||
| 529 | * @return PageSeo |
||
| 530 | */ |
||
| 531 | public function setFbAdmins($fbAdmins, $locale = null) |
||
| 532 | { |
||
| 533 | $this->translate($locale, false)->setFbAdmins($fbAdmins); |
||
| 534 | $this->mergeNewTranslations(); |
||
| 535 | |||
| 536 | return $this; |
||
| 537 | } |
||
| 538 | |||
| 539 | /** |
||
| 540 | * Get fbAdmins w/ proxy. |
||
| 541 | * |
||
| 542 | * @return string |
||
| 543 | */ |
||
| 544 | public function getFbAdmins() |
||
| 545 | { |
||
| 546 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getFbAdmins'); |
||
| 547 | } |
||
| 548 | |||
| 549 | /** |
||
| 550 | * Set twitterCard w/ proxy. |
||
| 551 | * |
||
| 552 | * @param string $twitterCard |
||
| 553 | * |
||
| 554 | * @return PageSeo |
||
| 555 | */ |
||
| 556 | public function setTwitterCard($twitterCard, $locale = null) |
||
| 557 | { |
||
| 558 | $this->translate($locale, false)->setTwitterCard($twitterCard); |
||
| 559 | $this->mergeNewTranslations(); |
||
| 560 | |||
| 561 | return $this; |
||
| 562 | } |
||
| 563 | |||
| 564 | /** |
||
| 565 | * Get twitterCard w/ proxy. |
||
| 566 | * |
||
| 567 | * @return string |
||
| 568 | */ |
||
| 569 | public function getTwitterCard() |
||
| 570 | { |
||
| 571 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterCard'); |
||
| 572 | } |
||
| 573 | |||
| 574 | /** |
||
| 575 | * Set twitterUrl w/ proxy. |
||
| 576 | * |
||
| 577 | * @param string $twitterUrl |
||
| 578 | * |
||
| 579 | * @return PageSeo |
||
| 580 | */ |
||
| 581 | public function setTwitterUrl($twitterUrl, $locale = null) |
||
| 582 | { |
||
| 583 | $this->translate($locale, false)->setTwitterUrl($twitterUrl); |
||
| 584 | $this->mergeNewTranslations(); |
||
| 585 | |||
| 586 | return $this; |
||
| 587 | } |
||
| 588 | |||
| 589 | /** |
||
| 590 | * Get twitterUrl w/ proxy. |
||
| 591 | * |
||
| 592 | * @return string |
||
| 593 | */ |
||
| 594 | public function getTwitterUrl() |
||
| 595 | { |
||
| 596 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterUrl'); |
||
| 597 | } |
||
| 598 | |||
| 599 | /** |
||
| 600 | * Set twitterCreator w/ proxy. |
||
| 601 | * |
||
| 602 | * @param string $twitterCreator |
||
| 603 | * |
||
| 604 | * @return PageSeo |
||
| 605 | */ |
||
| 606 | public function setTwitterCreator($twitterCreator, $locale = null) |
||
| 607 | { |
||
| 608 | $this->translate($locale, false)->setTwitterCreator($twitterCreator); |
||
| 609 | $this->mergeNewTranslations(); |
||
| 610 | |||
| 611 | return $this; |
||
| 612 | } |
||
| 613 | |||
| 614 | /** |
||
| 615 | * Get twitterCreator w/ proxy. |
||
| 616 | * |
||
| 617 | * @return string |
||
| 618 | */ |
||
| 619 | public function getTwitterCreator() |
||
| 620 | { |
||
| 621 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterCreator'); |
||
| 622 | } |
||
| 623 | |||
| 624 | /** |
||
| 625 | * Set twitterTitle w/ proxy. |
||
| 626 | * |
||
| 627 | * @param string $twitterTitle |
||
| 628 | * |
||
| 629 | * @return PageSeo |
||
| 630 | */ |
||
| 631 | public function setTwitterTitle($twitterTitle, $locale = null) |
||
| 632 | { |
||
| 633 | $this->translate($locale, false)->setTwitterTitle($twitterTitle); |
||
| 634 | $this->mergeNewTranslations(); |
||
| 635 | |||
| 636 | return $this; |
||
| 637 | } |
||
| 638 | |||
| 639 | /** |
||
| 640 | * Get twitterTitle w/ proxy. |
||
| 641 | * |
||
| 642 | * @return string |
||
| 643 | */ |
||
| 644 | public function getTwitterTitle() |
||
| 645 | { |
||
| 646 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterTitle'); |
||
| 647 | } |
||
| 648 | |||
| 649 | /** |
||
| 650 | * Set twitterDescription w/ proxy. |
||
| 651 | * |
||
| 652 | * @param string $twitterDescription |
||
| 653 | * |
||
| 654 | * @return PageSeo |
||
| 655 | */ |
||
| 656 | public function setTwitterDescription($twitterDescription, $locale = null) |
||
| 657 | { |
||
| 658 | $this->translate($locale, false)->setTwitterDescription($twitterDescription); |
||
| 659 | $this->mergeNewTranslations(); |
||
| 660 | |||
| 661 | return $this; |
||
| 662 | } |
||
| 663 | |||
| 664 | /** |
||
| 665 | * Get twitterDescription w/ proxy. |
||
| 666 | * |
||
| 667 | * @return string |
||
| 668 | */ |
||
| 669 | public function getTwitterDescription() |
||
| 670 | { |
||
| 671 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterDescription'); |
||
| 672 | } |
||
| 673 | |||
| 674 | /** |
||
| 675 | * Set twitterImage w/ proxy. |
||
| 676 | * |
||
| 677 | * @param Image $twitterImage |
||
| 678 | * |
||
| 679 | * @return PageSeo |
||
| 680 | */ |
||
| 681 | public function setTwitterImage($twitterImage, $locale = null) |
||
| 682 | { |
||
| 683 | $this->translate($locale, false)->setTwitterImage($twitterImage); |
||
| 684 | $this->mergeNewTranslations(); |
||
| 685 | |||
| 686 | return $this; |
||
| 687 | } |
||
| 688 | |||
| 689 | /** |
||
| 690 | * Get twitterImage w/ proxy. |
||
| 691 | * |
||
| 692 | * @return string |
||
| 693 | */ |
||
| 694 | public function getTwitterImage() |
||
| 695 | { |
||
| 696 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getTwitterImage'); |
||
| 697 | } |
||
| 698 | |||
| 699 | /** |
||
| 700 | * Set schemaPageType w/ proxy. |
||
| 701 | * |
||
| 702 | * @param string $schemaPageType |
||
| 703 | * |
||
| 704 | * @return PageSeo |
||
| 705 | */ |
||
| 706 | public function setSchemaPageType($schemaPageType, $locale = null) |
||
| 707 | { |
||
| 708 | $this->translate($locale, false)->setSchemaPageType($schemaPageType); |
||
| 709 | $this->mergeNewTranslations(); |
||
| 710 | |||
| 711 | return $this; |
||
| 712 | } |
||
| 713 | |||
| 714 | /** |
||
| 715 | * Get schemaPageType w/ proxy. |
||
| 716 | * |
||
| 717 | * @return string |
||
| 718 | */ |
||
| 719 | public function getSchemaPageType() |
||
| 720 | { |
||
| 721 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getSchemaPageType'); |
||
| 722 | } |
||
| 723 | |||
| 724 | /** |
||
| 725 | * Set schemaName w/ proxy. |
||
| 726 | * |
||
| 727 | * @param string $schemaName |
||
| 728 | * |
||
| 729 | * @return PageSeo |
||
| 730 | */ |
||
| 731 | public function setSchemaName($schemaName, $locale = null) |
||
| 732 | { |
||
| 733 | $this->translate($locale, false)->setSchemaName($schemaName); |
||
| 734 | $this->mergeNewTranslations(); |
||
| 735 | |||
| 736 | return $this; |
||
| 737 | } |
||
| 738 | |||
| 739 | /** |
||
| 740 | * Get schemaName w/ proxy. |
||
| 741 | * |
||
| 742 | * @return string |
||
| 743 | */ |
||
| 744 | public function getSchemaName() |
||
| 745 | { |
||
| 746 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getSchemaName'); |
||
| 747 | } |
||
| 748 | |||
| 749 | /** |
||
| 750 | * Set schemaDescription w/ proxy. |
||
| 751 | * |
||
| 752 | * @param string $schemaDescription |
||
| 753 | * |
||
| 754 | * @return PageSeo |
||
| 755 | */ |
||
| 756 | public function setSchemaDescription($schemaDescription, $locale = null) |
||
| 757 | { |
||
| 758 | $this->translate($locale, false)->setSchemaDescription($schemaDescription); |
||
| 759 | $this->mergeNewTranslations(); |
||
| 760 | |||
| 761 | return $this; |
||
| 762 | } |
||
| 763 | |||
| 764 | /** |
||
| 765 | * Get schemaDescription w/ proxy. |
||
| 766 | * |
||
| 767 | * @return string |
||
| 768 | */ |
||
| 769 | public function getSchemaDescription() |
||
| 773 | |||
| 774 | /** |
||
| 775 | * Set schemaImage w/ proxy. |
||
| 776 | * |
||
| 777 | * @param Image $schemaImage |
||
| 778 | * |
||
| 779 | * @return PageSeo |
||
| 780 | */ |
||
| 781 | public function setSchemaImage($schemaImage, $locale = null) |
||
| 782 | { |
||
| 783 | $this->translate($locale, false)->setSchemaImage($schemaImage); |
||
| 784 | $this->mergeNewTranslations(); |
||
| 785 | |||
| 786 | return $this; |
||
| 787 | } |
||
| 788 | |||
| 789 | /** |
||
| 790 | * Get schemaImage w/ proxy. |
||
| 791 | * |
||
| 792 | * @return string |
||
| 793 | */ |
||
| 794 | public function getSchemaImage() |
||
| 795 | { |
||
| 796 | return PropertyAccess::createPropertyAccessor()->getValue($this->translate(null, false), 'getSchemaImage'); |
||
| 797 | } |
||
| 798 | |||
| 799 | /** |
||
| 800 | * Set metaRobotsIndex w/ proxy. |
||
| 801 | * |
||
| 802 | * @param string $metaRobotsIndex |
||
| 803 | * |
||
| 804 | * @return PageSeo |
||
| 805 | */ |
||
| 806 | public function setMetaRobotsIndex($metaRobotsIndex, $locale = null) |
||
| 807 | { |
||
| 808 | $this->translate($locale, false)->setMetaRobotsIndex($metaRobotsIndex); |
||
| 809 | $this->mergeNewTranslations(); |
||
| 810 | |||
| 811 | return $this; |
||
| 812 | } |
||
| 813 | |||
| 814 | /** |
||
| 815 | * Get metaRobotsIndex w/ proxy. |
||
| 816 | * |
||
| 817 | * @return string |
||
| 818 | */ |
||
| 819 | public function getMetaRobotsIndex() |
||
| 823 | |||
| 824 | /** |
||
| 825 | * Set metaRobotsFollow w/ proxy. |
||
| 826 | * |
||
| 827 | * @param string $metaRobotsFollow |
||
| 828 | * |
||
| 829 | * @return PageSeo |
||
| 830 | */ |
||
| 831 | public function setMetaRobotsFollow($metaRobotsFollow, $locale = null) |
||
| 838 | |||
| 839 | /** |
||
| 840 | * Get metaRobotsFollow w/ proxy. |
||
| 841 | * |
||
| 842 | * @return string |
||
| 843 | */ |
||
| 844 | public function getMetaRobotsFollow() |
||
| 848 | |||
| 849 | /** |
||
| 850 | * Set metaRobotsAdvanced w/ proxy. |
||
| 851 | * |
||
| 852 | * @param string $metaRobotsAdvanced |
||
| 853 | * |
||
| 854 | * @return PageSeo |
||
| 855 | */ |
||
| 856 | public function setMetaRobotsAdvanced($metaRobotsAdvanced, $locale = null) |
||
| 863 | |||
| 864 | /** |
||
| 865 | * Get metaRobotsAdvanced w/ proxy. |
||
| 866 | * |
||
| 867 | * @return string |
||
| 868 | */ |
||
| 869 | public function getMetaRobotsAdvanced() |
||
| 873 | |||
| 874 | /** |
||
| 875 | * Set sitemapIndexed w/ proxy. |
||
| 876 | * |
||
| 877 | * @param bool $sitemapIndexed |
||
| 878 | * |
||
| 879 | * @return PageSeo |
||
| 880 | */ |
||
| 881 | public function setSitemapIndexed($sitemapIndexed, $locale = null) |
||
| 888 | |||
| 889 | /** |
||
| 890 | * Get sitemapIndexed. |
||
| 891 | * |
||
| 892 | * @return bool |
||
| 893 | */ |
||
| 894 | public function isSitemapIndexed() |
||
| 898 | |||
| 899 | /** |
||
| 900 | * Set sitemapPriority w/ proxy. |
||
| 901 | * |
||
| 902 | * @param float $sitemapPriority |
||
| 903 | * |
||
| 904 | * @return PageSeo |
||
| 905 | */ |
||
| 906 | public function setSitemapPriority($sitemapPriority, $locale = null) |
||
| 913 | |||
| 914 | /** |
||
| 915 | * Get sitemapPriority w/ proxy. |
||
| 916 | * |
||
| 917 | * @return float |
||
| 918 | */ |
||
| 919 | public function getSitemapPriority() |
||
| 923 | |||
| 924 | /** |
||
| 925 | * Set sitemapChangeFreq w/ proxy. |
||
| 926 | * |
||
| 927 | * @param float $sitemapChangeFreq |
||
| 928 | * |
||
| 929 | * @return PageSeo |
||
| 930 | */ |
||
| 931 | public function setSitemapChangeFreq($sitemapChangeFreq, $locale = null) |
||
| 938 | |||
| 939 | /** |
||
| 940 | * Get sitemapChangeFreq w/ proxy. |
||
| 941 | * |
||
| 942 | * @return float |
||
| 943 | */ |
||
| 944 | public function getSitemapChangeFreq() |
||
| 948 | |||
| 949 | /** |
||
| 950 | * Set relCanonical w/ proxy. |
||
| 951 | * |
||
| 952 | * @param string $relCanonical |
||
| 953 | * |
||
| 954 | * @return PageSeo |
||
| 955 | */ |
||
| 956 | public function setRelCanonical($relCanonical, $locale = null) |
||
| 963 | |||
| 964 | /** |
||
| 965 | * Get relCanonical w/ proxy. |
||
| 966 | * |
||
| 967 | * @return string |
||
| 968 | */ |
||
| 969 | public function getRelCanonical() |
||
| 973 | |||
| 974 | /** |
||
| 975 | * Set keyword w/ proxy. |
||
| 976 | * |
||
| 977 | * @param string $keyword |
||
| 978 | * @param null $locale |
||
| 979 | * |
||
| 980 | * @return PageSeo |
||
| 981 | */ |
||
| 982 | public function setKeyword($keyword, $locale = null) |
||
| 989 | |||
| 990 | /** |
||
| 991 | * Get keyword w/ proxy. |
||
| 992 | * |
||
| 993 | * @return string |
||
| 994 | */ |
||
| 995 | public function getKeyword() |
||
| 999 | } |
||
| 1000 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.