Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like User 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 User, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 21 | class User extends BaseUser |
||
| 22 | { |
||
| 23 | const COURSE_MANAGER = 1; |
||
| 24 | const TEACHER = 1; |
||
| 25 | const SESSION_ADMIN = 3; |
||
| 26 | const DRH = 4; |
||
| 27 | const STUDENT = 5; |
||
| 28 | const ANONYMOUS = 6; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var integer |
||
| 32 | * |
||
| 33 | * @ORM\Column(name="id", type="integer") |
||
| 34 | * @ORM\Id |
||
| 35 | * @ORM\GeneratedValue(strategy="AUTO") |
||
| 36 | */ |
||
| 37 | protected $id; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @var integer |
||
| 41 | * |
||
| 42 | * @ORM\Column(name="user_id", type="integer", nullable=true) |
||
| 43 | */ |
||
| 44 | protected $userId; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @var string |
||
| 48 | * |
||
| 49 | * @ORM\Column(name="username", type="string", length=100, nullable=false, unique=true) |
||
| 50 | */ |
||
| 51 | //protected $username; |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @var string |
||
| 55 | * |
||
| 56 | * * @ORM\Column(name="username_canonical", type="string", length=100, nullable=false, unique=true) |
||
| 57 | */ |
||
| 58 | //protected $usernameCanonical; |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @var string |
||
| 62 | * |
||
| 63 | * @ORM\Column(name="email", type="string", length=100, nullable=false, unique=false) |
||
| 64 | */ |
||
| 65 | //protected $email; |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @var boolean |
||
| 69 | * @ORM\Column(name="locked", type="boolean") |
||
| 70 | */ |
||
| 71 | //protected $locked; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @var boolean |
||
| 75 | * @ORM\Column(name="enabled", type="boolean") |
||
| 76 | */ |
||
| 77 | //protected $enabled; |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @var boolean |
||
| 81 | * @ORM\Column(name="expired", type="boolean") |
||
| 82 | */ |
||
| 83 | //protected $expired; |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @var boolean |
||
| 87 | * @ORM\Column(name="credentials_expired", type="boolean") |
||
| 88 | */ |
||
| 89 | //protected $credentialsExpired; |
||
| 90 | |||
| 91 | /** |
||
| 92 | * @var \DateTime |
||
| 93 | * @ORM\Column(name="credentials_expire_at", type="datetime", nullable=true, unique=false) |
||
| 94 | */ |
||
| 95 | //protected $credentialsExpireAt; |
||
| 96 | |||
| 97 | /** |
||
| 98 | * @var \DateTime |
||
| 99 | * @ORM\Column(name="expires_at", type="datetime", nullable=true, unique=false) |
||
| 100 | */ |
||
| 101 | //protected $expiresAt; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * @var string |
||
| 105 | * |
||
| 106 | * @ORM\Column(name="lastname", type="string", length=60, nullable=true, unique=false) |
||
| 107 | */ |
||
| 108 | protected $lastname; |
||
| 109 | |||
| 110 | /** |
||
| 111 | * @var string |
||
| 112 | * |
||
| 113 | * @ORM\Column(name="firstname", type="string", length=60, nullable=true, unique=false) |
||
| 114 | */ |
||
| 115 | protected $firstname; |
||
| 116 | |||
| 117 | /** |
||
| 118 | * @var string |
||
| 119 | * |
||
| 120 | * @ORM\Column(name="password", type="string", length=255, nullable=false, unique=false) |
||
| 121 | */ |
||
| 122 | //protected $password; |
||
| 123 | |||
| 124 | /** |
||
| 125 | * @var string |
||
| 126 | * |
||
| 127 | * @ORM\Column(name="auth_source", type="string", length=50, nullable=true, unique=false) |
||
| 128 | */ |
||
| 129 | private $authSource; |
||
| 130 | |||
| 131 | /** |
||
| 132 | * @var integer |
||
| 133 | * |
||
| 134 | * @ORM\Column(name="status", type="integer", nullable=false) |
||
| 135 | */ |
||
| 136 | private $status; |
||
| 137 | |||
| 138 | /** |
||
| 139 | * @var string |
||
| 140 | * |
||
| 141 | * @ORM\Column(name="official_code", type="string", length=40, nullable=true, unique=false) |
||
| 142 | */ |
||
| 143 | private $officialCode; |
||
| 144 | |||
| 145 | /** |
||
| 146 | * @var string |
||
| 147 | * |
||
| 148 | * @ORM\Column(name="phone", type="string", length=30, nullable=true, unique=false) |
||
| 149 | */ |
||
| 150 | protected $phone; |
||
| 151 | |||
| 152 | /** |
||
| 153 | * Vich\UploadableField(mapping="user_image", fileNameProperty="picture_uri") |
||
| 154 | * |
||
| 155 | * note This is not a mapped field of entity metadata, just a simple property. |
||
| 156 | * |
||
| 157 | * @var File $imageFile |
||
| 158 | */ |
||
| 159 | protected $imageFile; |
||
| 160 | |||
| 161 | /** |
||
| 162 | * @var string |
||
| 163 | * @ORM\Column(name="picture_uri", type="string", length=250, nullable=true, unique=false) |
||
| 164 | */ |
||
| 165 | private $pictureUri; |
||
| 166 | |||
| 167 | /** |
||
| 168 | * ORM\ManyToOne(targetEntity="Application\Sonata\MediaBundle\Entity\Media", cascade={"all"} ) |
||
| 169 | * @ORM\JoinColumn(name="picture_uri", referencedColumnName="id") |
||
| 170 | */ |
||
| 171 | //protected $pictureUri; |
||
| 172 | |||
| 173 | /** |
||
| 174 | * @var integer |
||
| 175 | * |
||
| 176 | * @ORM\Column(name="creator_id", type="integer", nullable=true, unique=false) |
||
| 177 | */ |
||
| 178 | private $creatorId; |
||
| 179 | |||
| 180 | /** |
||
| 181 | * @var string |
||
| 182 | * |
||
| 183 | * @ORM\Column(name="competences", type="text", nullable=true, unique=false) |
||
| 184 | */ |
||
| 185 | private $competences; |
||
| 186 | |||
| 187 | /** |
||
| 188 | * @var string |
||
| 189 | * |
||
| 190 | * @ORM\Column(name="diplomas", type="text", nullable=true, unique=false) |
||
| 191 | */ |
||
| 192 | private $diplomas; |
||
| 193 | |||
| 194 | /** |
||
| 195 | * @var string |
||
| 196 | * |
||
| 197 | * @ORM\Column(name="openarea", type="text", nullable=true, unique=false) |
||
| 198 | */ |
||
| 199 | private $openarea; |
||
| 200 | |||
| 201 | /** |
||
| 202 | * @var string |
||
| 203 | * |
||
| 204 | * @ORM\Column(name="teach", type="text", nullable=true, unique=false) |
||
| 205 | */ |
||
| 206 | private $teach; |
||
| 207 | |||
| 208 | /** |
||
| 209 | * @var string |
||
| 210 | * |
||
| 211 | * @ORM\Column(name="productions", type="string", length=250, nullable=true, unique=false) |
||
| 212 | */ |
||
| 213 | private $productions; |
||
| 214 | |||
| 215 | /** |
||
| 216 | * @var string |
||
| 217 | * |
||
| 218 | * @ORM\Column(name="language", type="string", length=40, nullable=true, unique=false) |
||
| 219 | */ |
||
| 220 | private $language; |
||
| 221 | |||
| 222 | /** |
||
| 223 | * @var \DateTime |
||
| 224 | * |
||
| 225 | * @ORM\Column(name="registration_date", type="datetime", nullable=false, unique=false) |
||
| 226 | */ |
||
| 227 | private $registrationDate; |
||
| 228 | |||
| 229 | /** |
||
| 230 | * @var \DateTime |
||
| 231 | * |
||
| 232 | * @ORM\Column(name="expiration_date", type="datetime", nullable=true, unique=false) |
||
| 233 | */ |
||
| 234 | private $expirationDate; |
||
| 235 | |||
| 236 | /** |
||
| 237 | * @var int |
||
| 238 | * |
||
| 239 | * @ORM\Column(name="active", type="boolean", nullable=false, unique=false) |
||
| 240 | */ |
||
| 241 | private $active; |
||
| 242 | |||
| 243 | /** |
||
| 244 | * @var string |
||
| 245 | * |
||
| 246 | * @ORM\Column(name="openid", type="string", length=255, nullable=true, unique=false) |
||
| 247 | */ |
||
| 248 | private $openid; |
||
| 249 | |||
| 250 | /** |
||
| 251 | * @var string |
||
| 252 | * |
||
| 253 | * @ORM\Column(name="theme", type="string", length=255, nullable=true, unique=false) |
||
| 254 | */ |
||
| 255 | private $theme; |
||
| 256 | |||
| 257 | /** |
||
| 258 | * @var integer |
||
| 259 | * |
||
| 260 | * @ORM\Column(name="hr_dept_id", type="smallint", nullable=true, unique=false) |
||
| 261 | */ |
||
| 262 | private $hrDeptId; |
||
| 263 | |||
| 264 | /** |
||
| 265 | * @ORM\Column(type="string", length=255) |
||
| 266 | */ |
||
| 267 | //protected $salt; |
||
| 268 | |||
| 269 | /** |
||
| 270 | * @var \DateTime |
||
| 271 | * |
||
| 272 | * @ORM\Column(name="last_login", type="datetime", nullable=true, unique=false) |
||
| 273 | */ |
||
| 274 | //protected $lastLogin; |
||
| 275 | |||
| 276 | /** |
||
| 277 | * Random string sent to the user email address in order to verify it |
||
| 278 | * |
||
| 279 | * @var string |
||
| 280 | * @ORM\Column(name="confirmation_token", type="string", length=255, nullable=true) |
||
| 281 | */ |
||
| 282 | //protected $confirmationToken; |
||
| 283 | |||
| 284 | /** |
||
| 285 | * @var \DateTime |
||
| 286 | * |
||
| 287 | * @ORM\Column(name="password_requested_at", type="datetime", nullable=true, unique=false) |
||
| 288 | */ |
||
| 289 | //protected $passwordRequestedAt; |
||
| 290 | |||
| 291 | /** |
||
| 292 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\CourseRelUser", mappedBy="user") |
||
| 293 | **/ |
||
| 294 | protected $courses; |
||
| 295 | |||
| 296 | /** |
||
| 297 | * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CItemProperty", mappedBy="user") |
||
| 298 | **/ |
||
| 299 | //protected $items; |
||
| 300 | |||
| 301 | /** |
||
| 302 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UsergroupRelUser", mappedBy="user") |
||
| 303 | **/ |
||
| 304 | protected $classes; |
||
| 305 | |||
| 306 | /** |
||
| 307 | * ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CDropboxPost", mappedBy="user") |
||
| 308 | **/ |
||
| 309 | protected $dropBoxReceivedFiles; |
||
| 310 | |||
| 311 | /** |
||
| 312 | * ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CDropboxFile", mappedBy="userSent") |
||
| 313 | **/ |
||
| 314 | protected $dropBoxSentFiles; |
||
| 315 | |||
| 316 | /** |
||
| 317 | * @ORM\Column(type="array") |
||
| 318 | */ |
||
| 319 | //protected $roles; |
||
| 320 | |||
| 321 | /** |
||
| 322 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\JuryMembers", mappedBy="user") |
||
| 323 | **/ |
||
| 324 | //protected $jurySubscriptions; |
||
| 325 | |||
| 326 | /** |
||
| 327 | * @ORM\ManyToMany(targetEntity="Chamilo\UserBundle\Entity\Group") |
||
| 328 | * @ORM\JoinTable(name="fos_user_user_group", |
||
| 329 | * joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")}, |
||
| 330 | * inverseJoinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id")} |
||
| 331 | * ) |
||
| 332 | */ |
||
| 333 | protected $groups; |
||
| 334 | |||
| 335 | |||
| 336 | //private $isActive; |
||
| 337 | |||
| 338 | /** |
||
| 339 | * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\CurriculumItemRelUser", mappedBy="user") |
||
| 340 | **/ |
||
| 341 | protected $curriculumItems; |
||
| 342 | |||
| 343 | /* |
||
| 344 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\AccessUrlRelUser", mappedBy="user") |
||
| 345 | * |
||
| 346 | */ |
||
| 347 | protected $portals; |
||
| 348 | |||
| 349 | /** |
||
| 350 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Session", mappedBy="generalCoach") |
||
| 351 | **/ |
||
| 352 | protected $sessionAsGeneralCoach; |
||
| 353 | |||
| 354 | /** |
||
| 355 | * @var ArrayCollection |
||
| 356 | * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\UserFieldValues", mappedBy="user", orphanRemoval=true, cascade={"persist"}) |
||
| 357 | **/ |
||
| 358 | protected $extraFields; |
||
| 359 | |||
| 360 | /** |
||
| 361 | * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\Resource\ResourceNode", mappedBy="creator") |
||
| 362 | **/ |
||
| 363 | protected $resourceNodes; |
||
| 364 | |||
| 365 | /** |
||
| 366 | * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SessionRelCourseRelUser", mappedBy="user", cascade={"persist"}) |
||
| 367 | **/ |
||
| 368 | protected $sessionCourseSubscriptions; |
||
| 369 | |||
| 370 | /** |
||
| 371 | * Constructor |
||
| 372 | */ |
||
| 373 | public function __construct() |
||
| 374 | { |
||
| 375 | $this->status = self::STUDENT; |
||
| 376 | |||
| 377 | $this->salt = sha1(uniqid(null, true)); |
||
| 378 | $this->isActive = true; |
||
| 379 | $this->active = 1; |
||
| 380 | $this->registrationDate = new \DateTime(); |
||
| 381 | $this->authSource = 'platform'; |
||
| 382 | $this->courses = new ArrayCollection(); |
||
| 383 | $this->items = new ArrayCollection(); |
||
| 384 | $this->classes = new ArrayCollection(); |
||
| 385 | $this->curriculumItems = new ArrayCollection(); |
||
| 386 | $this->portals = new ArrayCollection(); |
||
| 387 | $this->dropBoxSentFiles = new ArrayCollection(); |
||
| 388 | $this->dropBoxReceivedFiles = new ArrayCollection(); |
||
| 389 | //$this->extraFields = new ArrayCollection(); |
||
| 390 | //$this->userId = 0; |
||
| 391 | //$this->createdAt = new \DateTime(); |
||
| 392 | //$this->updatedAt = new \DateTime(); |
||
| 393 | |||
| 394 | $this->enabled = false; |
||
| 395 | $this->locked = false; |
||
| 396 | $this->expired = false; |
||
| 397 | $this->roles = array(); |
||
| 398 | $this->credentialsExpired = false; |
||
| 399 | } |
||
| 400 | |||
| 401 | /** |
||
| 402 | * @return string |
||
| 403 | */ |
||
| 404 | public function __toString() |
||
| 408 | |||
| 409 | /** |
||
| 410 | * Updates the id with the user_id |
||
| 411 | * @ORM\PostPersist() |
||
| 412 | */ |
||
| 413 | public function postPersist(LifecycleEventArgs $args) |
||
| 423 | |||
| 424 | /** |
||
| 425 | * @param int $userId |
||
| 426 | */ |
||
| 427 | public function setId($userId) |
||
| 431 | |||
| 432 | /** |
||
| 433 | * @param int $userId |
||
| 434 | */ |
||
| 435 | public function setUserId($userId) |
||
| 441 | |||
| 442 | /** |
||
| 443 | * @return int |
||
| 444 | */ |
||
| 445 | public function getId() |
||
| 449 | |||
| 450 | /** |
||
| 451 | * @return string |
||
| 452 | */ |
||
| 453 | public function getEncoderName() |
||
| 457 | |||
| 458 | /** |
||
| 459 | * @return ArrayCollection |
||
| 460 | */ |
||
| 461 | public function getDropBoxSentFiles() |
||
| 465 | |||
| 466 | /** |
||
| 467 | * @return ArrayCollection |
||
| 468 | */ |
||
| 469 | public function getDropBoxReceivedFiles() |
||
| 473 | |||
| 474 | /** |
||
| 475 | * @return ArrayCollection |
||
| 476 | */ |
||
| 477 | public function getCourses() |
||
| 481 | |||
| 482 | /** |
||
| 483 | * @return array |
||
| 484 | */ |
||
| 485 | View Code Duplication | public static function getPasswordConstraints() |
|
| 508 | |||
| 509 | /** |
||
| 510 | * @param ClassMetadata $metadata |
||
| 511 | */ |
||
| 512 | public static function loadValidatorMetadata(ClassMetadata $metadata) |
||
| 537 | |||
| 538 | /** |
||
| 539 | * @inheritDoc |
||
| 540 | */ |
||
| 541 | public function isEqualTo(UserInterface $user) |
||
| 561 | |||
| 562 | /** |
||
| 563 | * @return ArrayCollection |
||
| 564 | */ |
||
| 565 | public function getPortals() |
||
| 569 | |||
| 570 | /** |
||
| 571 | * @param $portal |
||
| 572 | */ |
||
| 573 | public function setPortal($portal) |
||
| 577 | |||
| 578 | /** |
||
| 579 | * @return ArrayCollection |
||
| 580 | */ |
||
| 581 | public function getCurriculumItems() |
||
| 585 | |||
| 586 | /** |
||
| 587 | * @param $items |
||
| 588 | */ |
||
| 589 | public function setCurriculumItems($items) |
||
| 593 | |||
| 594 | /** |
||
| 595 | * @return bool |
||
| 596 | */ |
||
| 597 | public function getIsActive() |
||
| 601 | |||
| 602 | /** |
||
| 603 | * @return bool |
||
| 604 | */ |
||
| 605 | public function isActive() |
||
| 609 | |||
| 610 | |||
| 611 | /** |
||
| 612 | * @inheritDoc |
||
| 613 | */ |
||
| 614 | public function isEnabled() |
||
| 618 | |||
| 619 | /** |
||
| 620 | * |
||
| 621 | * @return ArrayCollection |
||
| 622 | */ |
||
| 623 | /*public function getRolesObj() |
||
| 624 | { |
||
| 625 | return $this->roles; |
||
| 626 | }*/ |
||
| 627 | |||
| 628 | /** |
||
| 629 | * Set salt |
||
| 630 | * |
||
| 631 | * @param string $salt |
||
| 632 | * |
||
| 633 | * @return User |
||
| 634 | */ |
||
| 635 | public function setSalt($salt) |
||
| 641 | |||
| 642 | /** |
||
| 643 | * Get salt |
||
| 644 | * |
||
| 645 | * @return string |
||
| 646 | */ |
||
| 647 | public function getSalt() |
||
| 651 | |||
| 652 | /** |
||
| 653 | * @return ArrayCollection |
||
| 654 | */ |
||
| 655 | public function getClasses() |
||
| 659 | |||
| 660 | /** |
||
| 661 | * |
||
| 662 | */ |
||
| 663 | public function getLps() |
||
| 678 | |||
| 679 | /** |
||
| 680 | * @todo don't use api_get_person_name |
||
| 681 | * @return string |
||
| 682 | */ |
||
| 683 | public function getCompleteName() |
||
| 687 | |||
| 688 | /** |
||
| 689 | * Returns the list of classes for the user |
||
| 690 | * @return string |
||
| 691 | */ |
||
| 692 | View Code Duplication | public function getCompleteNameWithClasses() |
|
| 705 | |||
| 706 | /** |
||
| 707 | * Get userId |
||
| 708 | * |
||
| 709 | * @return integer |
||
| 710 | */ |
||
| 711 | public function getUserId() |
||
| 715 | |||
| 716 | /** |
||
| 717 | * Set lastname |
||
| 718 | * |
||
| 719 | * @param string $lastname |
||
| 720 | * |
||
| 721 | * @return User |
||
| 722 | */ |
||
| 723 | public function setLastname($lastname) |
||
| 729 | |||
| 730 | |||
| 731 | /** |
||
| 732 | * Set firstname |
||
| 733 | * |
||
| 734 | * @param string $firstname |
||
| 735 | * |
||
| 736 | * @return User |
||
| 737 | */ |
||
| 738 | public function setFirstname($firstname) |
||
| 744 | |||
| 745 | /** |
||
| 746 | * Set password |
||
| 747 | * |
||
| 748 | * @param string $password |
||
| 749 | * @return User |
||
| 750 | */ |
||
| 751 | public function setPassword($password) |
||
| 757 | |||
| 758 | /** |
||
| 759 | * Get password |
||
| 760 | * |
||
| 761 | * @return string |
||
| 762 | */ |
||
| 763 | public function getPassword() |
||
| 767 | |||
| 768 | /** |
||
| 769 | * Set authSource |
||
| 770 | * |
||
| 771 | * @param string $authSource |
||
| 772 | * @return User |
||
| 773 | */ |
||
| 774 | public function setAuthSource($authSource) |
||
| 780 | |||
| 781 | /** |
||
| 782 | * Get authSource |
||
| 783 | * |
||
| 784 | * @return string |
||
| 785 | */ |
||
| 786 | public function getAuthSource() |
||
| 790 | |||
| 791 | /** |
||
| 792 | * Set email |
||
| 793 | * |
||
| 794 | * @param string $email |
||
| 795 | * @return User |
||
| 796 | */ |
||
| 797 | public function setEmail($email) |
||
| 803 | |||
| 804 | /** |
||
| 805 | * Get email |
||
| 806 | * |
||
| 807 | * @return string |
||
| 808 | */ |
||
| 809 | public function getEmail() |
||
| 813 | |||
| 814 | /** |
||
| 815 | * Set status |
||
| 816 | * |
||
| 817 | * @param int $status |
||
| 818 | * |
||
| 819 | * @return User |
||
| 820 | */ |
||
| 821 | public function setStatus($status) |
||
| 827 | |||
| 828 | /** |
||
| 829 | * Get status |
||
| 830 | * |
||
| 831 | * @return boolean |
||
| 832 | */ |
||
| 833 | public function getStatus() |
||
| 837 | |||
| 838 | /** |
||
| 839 | * Set officialCode |
||
| 840 | * |
||
| 841 | * @param string $officialCode |
||
| 842 | * @return User |
||
| 843 | */ |
||
| 844 | public function setOfficialCode($officialCode) |
||
| 850 | |||
| 851 | /** |
||
| 852 | * Get officialCode |
||
| 853 | * |
||
| 854 | * @return string |
||
| 855 | */ |
||
| 856 | public function getOfficialCode() |
||
| 860 | |||
| 861 | /** |
||
| 862 | * Set phone |
||
| 863 | * |
||
| 864 | * @param string $phone |
||
| 865 | * @return User |
||
| 866 | */ |
||
| 867 | public function setPhone($phone) |
||
| 873 | |||
| 874 | /** |
||
| 875 | * Get phone |
||
| 876 | * |
||
| 877 | * @return string |
||
| 878 | */ |
||
| 879 | public function getPhone() |
||
| 883 | |||
| 884 | /** |
||
| 885 | * Set pictureUri |
||
| 886 | * |
||
| 887 | * @param string $pictureUri |
||
| 888 | * @return User |
||
| 889 | */ |
||
| 890 | public function setPictureUri($pictureUri) |
||
| 896 | |||
| 897 | /** |
||
| 898 | * Get pictureUri |
||
| 899 | * |
||
| 900 | * @return Media |
||
| 901 | */ |
||
| 902 | public function getPictureUri() |
||
| 906 | |||
| 907 | /** |
||
| 908 | * Set creatorId |
||
| 909 | * |
||
| 910 | * @param integer $creatorId |
||
| 911 | * @return User |
||
| 912 | */ |
||
| 913 | public function setCreatorId($creatorId) |
||
| 919 | |||
| 920 | /** |
||
| 921 | * Get creatorId |
||
| 922 | * |
||
| 923 | * @return integer |
||
| 924 | */ |
||
| 925 | public function getCreatorId() |
||
| 929 | |||
| 930 | /** |
||
| 931 | * Set competences |
||
| 932 | * |
||
| 933 | * @param string $competences |
||
| 934 | * @return User |
||
| 935 | */ |
||
| 936 | public function setCompetences($competences) |
||
| 942 | |||
| 943 | /** |
||
| 944 | * Get competences |
||
| 945 | * |
||
| 946 | * @return string |
||
| 947 | */ |
||
| 948 | public function getCompetences() |
||
| 952 | |||
| 953 | /** |
||
| 954 | * Set diplomas |
||
| 955 | * |
||
| 956 | * @param string $diplomas |
||
| 957 | * @return User |
||
| 958 | */ |
||
| 959 | public function setDiplomas($diplomas) |
||
| 965 | |||
| 966 | /** |
||
| 967 | * Get diplomas |
||
| 968 | * |
||
| 969 | * @return string |
||
| 970 | */ |
||
| 971 | public function getDiplomas() |
||
| 975 | |||
| 976 | /** |
||
| 977 | * Set openarea |
||
| 978 | * |
||
| 979 | * @param string $openarea |
||
| 980 | * @return User |
||
| 981 | */ |
||
| 982 | public function setOpenarea($openarea) |
||
| 988 | |||
| 989 | /** |
||
| 990 | * Get openarea |
||
| 991 | * |
||
| 992 | * @return string |
||
| 993 | */ |
||
| 994 | public function getOpenarea() |
||
| 998 | |||
| 999 | /** |
||
| 1000 | * Set teach |
||
| 1001 | * |
||
| 1002 | * @param string $teach |
||
| 1003 | * @return User |
||
| 1004 | */ |
||
| 1005 | public function setTeach($teach) |
||
| 1011 | |||
| 1012 | /** |
||
| 1013 | * Get teach |
||
| 1014 | * |
||
| 1015 | * @return string |
||
| 1016 | */ |
||
| 1017 | public function getTeach() |
||
| 1021 | |||
| 1022 | /** |
||
| 1023 | * Set productions |
||
| 1024 | * |
||
| 1025 | * @param string $productions |
||
| 1026 | * @return User |
||
| 1027 | */ |
||
| 1028 | public function setProductions($productions) |
||
| 1034 | |||
| 1035 | /** |
||
| 1036 | * Get productions |
||
| 1037 | * |
||
| 1038 | * @return string |
||
| 1039 | */ |
||
| 1040 | public function getProductions() |
||
| 1044 | |||
| 1045 | /** |
||
| 1046 | * Set language |
||
| 1047 | * |
||
| 1048 | * @param string $language |
||
| 1049 | * @return User |
||
| 1050 | */ |
||
| 1051 | public function setLanguage($language) |
||
| 1057 | |||
| 1058 | /** |
||
| 1059 | * Get language |
||
| 1060 | * |
||
| 1061 | * @return string |
||
| 1062 | */ |
||
| 1063 | public function getLanguage() |
||
| 1067 | |||
| 1068 | /** |
||
| 1069 | * Set registrationDate |
||
| 1070 | * |
||
| 1071 | * @param \DateTime $registrationDate |
||
| 1072 | * @return User |
||
| 1073 | */ |
||
| 1074 | public function setRegistrationDate($registrationDate) |
||
| 1075 | { |
||
| 1076 | $this->registrationDate = $registrationDate; |
||
| 1077 | |||
| 1078 | return $this; |
||
| 1079 | } |
||
| 1080 | |||
| 1081 | /** |
||
| 1082 | * Get registrationDate |
||
| 1083 | * |
||
| 1084 | * @return \DateTime |
||
| 1085 | */ |
||
| 1086 | public function getRegistrationDate() |
||
| 1087 | { |
||
| 1088 | return $this->registrationDate; |
||
| 1089 | } |
||
| 1090 | |||
| 1091 | /** |
||
| 1092 | * Set expirationDate |
||
| 1093 | * |
||
| 1094 | * @param \DateTime $expirationDate |
||
| 1095 | * |
||
| 1096 | * @return User |
||
| 1097 | */ |
||
| 1098 | public function setExpirationDate($expirationDate) |
||
| 1099 | { |
||
| 1100 | $this->expirationDate = $expirationDate; |
||
| 1101 | |||
| 1102 | return $this; |
||
| 1103 | } |
||
| 1104 | |||
| 1105 | /** |
||
| 1106 | * Get expirationDate |
||
| 1107 | * |
||
| 1108 | * @return \DateTime |
||
| 1109 | */ |
||
| 1110 | public function getExpirationDate() |
||
| 1111 | { |
||
| 1112 | return $this->expirationDate; |
||
| 1113 | } |
||
| 1114 | |||
| 1115 | /** |
||
| 1116 | * Set active |
||
| 1117 | * |
||
| 1118 | * @param boolean $active |
||
| 1119 | * @return User |
||
| 1120 | */ |
||
| 1121 | public function setActive($active) |
||
| 1122 | { |
||
| 1123 | $this->active = $active; |
||
|
|
|||
| 1124 | |||
| 1125 | return $this; |
||
| 1126 | } |
||
| 1127 | |||
| 1128 | /** |
||
| 1129 | * Get active |
||
| 1130 | * |
||
| 1131 | * @return boolean |
||
| 1132 | */ |
||
| 1133 | public function getActive() |
||
| 1134 | { |
||
| 1135 | return $this->active; |
||
| 1136 | } |
||
| 1137 | |||
| 1138 | /** |
||
| 1139 | * Set openid |
||
| 1140 | * |
||
| 1141 | * @param string $openid |
||
| 1142 | * @return User |
||
| 1143 | */ |
||
| 1144 | public function setOpenid($openid) |
||
| 1150 | |||
| 1151 | /** |
||
| 1152 | * Get openid |
||
| 1153 | * |
||
| 1154 | * @return string |
||
| 1155 | */ |
||
| 1156 | public function getOpenid() |
||
| 1160 | |||
| 1161 | /** |
||
| 1162 | * Set theme |
||
| 1163 | * |
||
| 1164 | * @param string $theme |
||
| 1165 | * @return User |
||
| 1166 | */ |
||
| 1167 | public function setTheme($theme) |
||
| 1173 | |||
| 1174 | /** |
||
| 1175 | * Get theme |
||
| 1176 | * |
||
| 1177 | * @return string |
||
| 1178 | */ |
||
| 1179 | public function getTheme() |
||
| 1183 | |||
| 1184 | /** |
||
| 1185 | * Set hrDeptId |
||
| 1186 | * |
||
| 1187 | * @param integer $hrDeptId |
||
| 1188 | * @return User |
||
| 1189 | */ |
||
| 1190 | public function setHrDeptId($hrDeptId) |
||
| 1196 | |||
| 1197 | /** |
||
| 1198 | * Get hrDeptId |
||
| 1199 | * |
||
| 1200 | * @return integer |
||
| 1201 | */ |
||
| 1202 | public function getHrDeptId() |
||
| 1206 | |||
| 1207 | /** |
||
| 1208 | * @return Media |
||
| 1209 | */ |
||
| 1210 | public function getAvatar() |
||
| 1214 | |||
| 1215 | /** |
||
| 1216 | * @return \DateTime |
||
| 1217 | */ |
||
| 1218 | public function getMemberSince() |
||
| 1222 | |||
| 1223 | /** |
||
| 1224 | * @return bool |
||
| 1225 | */ |
||
| 1226 | public function isOnline() |
||
| 1230 | |||
| 1231 | /** |
||
| 1232 | * @return int |
||
| 1233 | */ |
||
| 1234 | public function getIdentifier() |
||
| 1238 | |||
| 1239 | /** |
||
| 1240 | * If manually uploading a file (i.e. not using Symfony Form) ensure an instance |
||
| 1241 | * of 'UploadedFile' is injected into this setter to trigger the update. If this |
||
| 1242 | * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter |
||
| 1243 | * must be able to accept an instance of 'File' as the bundle will inject one here |
||
| 1244 | * during Doctrine hydration. |
||
| 1245 | * |
||
| 1246 | * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image |
||
| 1247 | */ |
||
| 1248 | public function setImageFile(File $image) |
||
| 1258 | |||
| 1259 | /** |
||
| 1260 | * @return File |
||
| 1261 | */ |
||
| 1262 | public function getImageFile() |
||
| 1266 | |||
| 1267 | /** |
||
| 1268 | * @param string $imageName |
||
| 1269 | */ |
||
| 1270 | public function setImageName($imageName) |
||
| 1274 | |||
| 1275 | /** |
||
| 1276 | * @return string |
||
| 1277 | */ |
||
| 1278 | public function getImageName() |
||
| 1282 | |||
| 1283 | /** |
||
| 1284 | * @return string |
||
| 1285 | */ |
||
| 1286 | public function getSlug() |
||
| 1290 | |||
| 1291 | /** |
||
| 1292 | * @param $slug |
||
| 1293 | * @return User |
||
| 1294 | */ |
||
| 1295 | public function setSlug($slug) |
||
| 1299 | |||
| 1300 | /** |
||
| 1301 | * Set lastLogin |
||
| 1302 | * |
||
| 1303 | * @param \DateTime $lastLogin |
||
| 1304 | * |
||
| 1305 | * @return User |
||
| 1306 | */ |
||
| 1307 | public function setLastLogin(\DateTime $lastLogin) |
||
| 1313 | |||
| 1314 | /** |
||
| 1315 | * Get lastLogin |
||
| 1316 | * |
||
| 1317 | * @return \DateTime |
||
| 1318 | */ |
||
| 1319 | public function getLastLogin() |
||
| 1323 | |||
| 1324 | /** |
||
| 1325 | * {@inheritdoc} |
||
| 1326 | */ |
||
| 1327 | public function getExtraFields() |
||
| 1331 | |||
| 1332 | /** |
||
| 1333 | * {@inheritdoc} |
||
| 1334 | */ |
||
| 1335 | public function setExtraFields($extraFields) |
||
| 1344 | |||
| 1345 | /** |
||
| 1346 | * {@inheritdoc} |
||
| 1347 | */ |
||
| 1348 | /*public function addExtraFields(ExtraFieldValues $extraFieldValue) |
||
| 1349 | { |
||
| 1350 | $extraFieldValue->setUser($this); |
||
| 1351 | $this->extraFields[] = $extraFieldValue; |
||
| 1352 | |||
| 1353 | return $this; |
||
| 1354 | }*/ |
||
| 1355 | |||
| 1356 | /** |
||
| 1357 | * {@inheritdoc} |
||
| 1358 | */ |
||
| 1359 | public function addExtraFields(ExtraFieldValues $extraFieldValue) |
||
| 1368 | |||
| 1369 | /** |
||
| 1370 | * {@inheritdoc} |
||
| 1371 | */ |
||
| 1372 | public function removeExtraField(ExtraFieldValues $attribute) |
||
| 1381 | |||
| 1382 | /** |
||
| 1383 | * {@inheritdoc} |
||
| 1384 | */ |
||
| 1385 | /*public function hasExtraField($attribute) |
||
| 1386 | { |
||
| 1387 | if (!$this->extraFields) { |
||
| 1388 | return false; |
||
| 1389 | } |
||
| 1390 | return $this->extraFields->contains($attribute); |
||
| 1391 | }*/ |
||
| 1392 | |||
| 1393 | /** |
||
| 1394 | * {@inheritdoc} |
||
| 1395 | */ |
||
| 1396 | public function hasExtraFieldByName($attributeName) |
||
| 1406 | |||
| 1407 | /** |
||
| 1408 | * {@inheritdoc} |
||
| 1409 | */ |
||
| 1410 | public function getExtraFieldByName($attributeName) |
||
| 1420 | |||
| 1421 | /** |
||
| 1422 | * Get sessionCourseSubscription |
||
| 1423 | * @return ArrayCollection |
||
| 1424 | */ |
||
| 1425 | public function getSessionCourseSubscriptions() |
||
| 1429 | |||
| 1430 | /** |
||
| 1431 | * @return string |
||
| 1432 | */ |
||
| 1433 | public function getConfirmationToken() |
||
| 1437 | |||
| 1438 | /** |
||
| 1439 | * @param string $confirmationToken |
||
| 1440 | * |
||
| 1441 | * @return User |
||
| 1442 | */ |
||
| 1443 | public function setConfirmationToken($confirmationToken) |
||
| 1449 | |||
| 1450 | /** |
||
| 1451 | * @return \DateTime |
||
| 1452 | */ |
||
| 1453 | public function getPasswordRequestedAt() |
||
| 1457 | |||
| 1458 | |||
| 1459 | /** |
||
| 1460 | * @param int $ttl |
||
| 1461 | * @return bool |
||
| 1462 | */ |
||
| 1463 | public function isPasswordRequestNonExpired($ttl) |
||
| 1468 | |||
| 1469 | public function getUsername() |
||
| 1473 | |||
| 1474 | /** |
||
| 1475 | * Returns the creation date. |
||
| 1476 | * |
||
| 1477 | * @return \DateTime|null |
||
| 1478 | */ |
||
| 1479 | public function getCreatedAt() |
||
| 1483 | |||
| 1484 | /** |
||
| 1485 | * Sets the last update date. |
||
| 1486 | * |
||
| 1487 | * @param \DateTime|null $updatedAt |
||
| 1488 | * |
||
| 1489 | * @return User |
||
| 1490 | */ |
||
| 1491 | public function setUpdatedAt(\DateTime $updatedAt = null) |
||
| 1497 | |||
| 1498 | /** |
||
| 1499 | * Returns the last update date. |
||
| 1500 | * |
||
| 1501 | * @return \DateTime|null |
||
| 1502 | */ |
||
| 1503 | public function getUpdatedAt() |
||
| 1507 | |||
| 1508 | /** |
||
| 1509 | * Returns the expiration date. |
||
| 1510 | * |
||
| 1511 | * @return \DateTime|null |
||
| 1512 | */ |
||
| 1513 | public function getExpiresAt() |
||
| 1517 | |||
| 1518 | /** |
||
| 1519 | * Returns the credentials expiration date. |
||
| 1520 | * |
||
| 1521 | * @return \DateTime |
||
| 1522 | */ |
||
| 1523 | public function getCredentialsExpireAt() |
||
| 1527 | |||
| 1528 | /** |
||
| 1529 | * Sets the credentials expiration date. |
||
| 1530 | * |
||
| 1531 | * @param \DateTime|null $date |
||
| 1532 | * |
||
| 1533 | * @return User |
||
| 1534 | */ |
||
| 1535 | public function setCredentialsExpireAt(\DateTime $date = null) |
||
| 1541 | |||
| 1542 | /** |
||
| 1543 | * Sets the user groups. |
||
| 1544 | * |
||
| 1545 | * @param array $groups |
||
| 1546 | * |
||
| 1547 | * @return User |
||
| 1548 | */ |
||
| 1549 | public function setGroups($groups) |
||
| 1557 | |||
| 1558 | /** |
||
| 1559 | * Sets the two-step verification code. |
||
| 1560 | * |
||
| 1561 | * @param string $twoStepVerificationCode |
||
| 1562 | * |
||
| 1563 | * @return User |
||
| 1564 | */ |
||
| 1565 | public function setTwoStepVerificationCode($twoStepVerificationCode) |
||
| 1571 | |||
| 1572 | /** |
||
| 1573 | * Returns the two-step verification code. |
||
| 1574 | * |
||
| 1575 | * @return string |
||
| 1576 | */ |
||
| 1577 | public function getTwoStepVerificationCode() |
||
| 1581 | |||
| 1582 | /** |
||
| 1583 | * @param string $biography |
||
| 1584 | * |
||
| 1585 | * @return User |
||
| 1586 | */ |
||
| 1587 | public function setBiography($biography) |
||
| 1593 | |||
| 1594 | /** |
||
| 1595 | * @return string |
||
| 1596 | */ |
||
| 1597 | public function getBiography() |
||
| 1601 | |||
| 1602 | /** |
||
| 1603 | * @param \DateTime $dateOfBirth |
||
| 1604 | * |
||
| 1605 | * @return User |
||
| 1606 | */ |
||
| 1607 | public function setDateOfBirth($dateOfBirth) |
||
| 1613 | |||
| 1614 | /** |
||
| 1615 | * @return \DateTime |
||
| 1616 | */ |
||
| 1617 | public function getDateOfBirth() |
||
| 1621 | |||
| 1622 | /** |
||
| 1623 | * @param string $facebookData |
||
| 1624 | * |
||
| 1625 | * @return User |
||
| 1626 | */ |
||
| 1627 | public function setFacebookData($facebookData) |
||
| 1633 | |||
| 1634 | /** |
||
| 1635 | * @return string |
||
| 1636 | */ |
||
| 1637 | public function getFacebookData() |
||
| 1641 | |||
| 1642 | /** |
||
| 1643 | * @param string $facebookName |
||
| 1644 | * |
||
| 1645 | * @return User |
||
| 1646 | */ |
||
| 1647 | public function setFacebookName($facebookName) |
||
| 1653 | |||
| 1654 | /** |
||
| 1655 | * @return string |
||
| 1656 | */ |
||
| 1657 | public function getFacebookName() |
||
| 1661 | |||
| 1662 | /** |
||
| 1663 | * @param string $facebookUid |
||
| 1664 | * |
||
| 1665 | * @return User |
||
| 1666 | */ |
||
| 1667 | public function setFacebookUid($facebookUid) |
||
| 1673 | |||
| 1674 | /** |
||
| 1675 | * @return string |
||
| 1676 | */ |
||
| 1677 | public function getFacebookUid() |
||
| 1681 | |||
| 1682 | /** |
||
| 1683 | * @return string |
||
| 1684 | */ |
||
| 1685 | public function getFirstname() |
||
| 1689 | |||
| 1690 | /** |
||
| 1691 | * @param string $gender |
||
| 1692 | * |
||
| 1693 | * @return User |
||
| 1694 | */ |
||
| 1695 | public function setGender($gender) |
||
| 1701 | |||
| 1702 | /** |
||
| 1703 | * @return string |
||
| 1704 | */ |
||
| 1705 | public function getGender() |
||
| 1709 | |||
| 1710 | /** |
||
| 1711 | * @param string $gplusData |
||
| 1712 | * |
||
| 1713 | * @return User |
||
| 1714 | */ |
||
| 1715 | public function setGplusData($gplusData) |
||
| 1721 | |||
| 1722 | /** |
||
| 1723 | * @return string |
||
| 1724 | */ |
||
| 1725 | public function getGplusData() |
||
| 1729 | |||
| 1730 | /** |
||
| 1731 | * @param string $gplusName |
||
| 1732 | * |
||
| 1733 | * @return User |
||
| 1734 | */ |
||
| 1735 | public function setGplusName($gplusName) |
||
| 1741 | |||
| 1742 | /** |
||
| 1743 | * @return string |
||
| 1744 | */ |
||
| 1745 | public function getGplusName() |
||
| 1749 | |||
| 1750 | /** |
||
| 1751 | * @param string $gplusUid |
||
| 1752 | * |
||
| 1753 | * @return User |
||
| 1754 | */ |
||
| 1755 | public function setGplusUid($gplusUid) |
||
| 1761 | |||
| 1762 | /** |
||
| 1763 | * @return string |
||
| 1764 | */ |
||
| 1765 | public function getGplusUid() |
||
| 1769 | |||
| 1770 | |||
| 1771 | /** |
||
| 1772 | * @return string |
||
| 1773 | */ |
||
| 1774 | public function getLastname() |
||
| 1778 | |||
| 1779 | /** |
||
| 1780 | * @param string $locale |
||
| 1781 | * |
||
| 1782 | * @return User |
||
| 1783 | */ |
||
| 1784 | public function setLocale($locale) |
||
| 1790 | |||
| 1791 | /** |
||
| 1792 | * @return string |
||
| 1793 | */ |
||
| 1794 | public function getLocale() |
||
| 1798 | |||
| 1799 | /** |
||
| 1800 | * @param string $timezone |
||
| 1801 | * |
||
| 1802 | * @return User |
||
| 1803 | */ |
||
| 1804 | public function setTimezone($timezone) |
||
| 1810 | |||
| 1811 | /** |
||
| 1812 | * @return string |
||
| 1813 | */ |
||
| 1814 | public function getTimezone() |
||
| 1818 | |||
| 1819 | /** |
||
| 1820 | * @param string $twitterData |
||
| 1821 | * |
||
| 1822 | * @return User |
||
| 1823 | */ |
||
| 1824 | public function setTwitterData($twitterData) |
||
| 1830 | |||
| 1831 | /** |
||
| 1832 | * @return string |
||
| 1833 | */ |
||
| 1834 | public function getTwitterData() |
||
| 1838 | |||
| 1839 | /** |
||
| 1840 | * @param string $twitterName |
||
| 1841 | * |
||
| 1842 | * @return User |
||
| 1843 | */ |
||
| 1844 | public function setTwitterName($twitterName) |
||
| 1850 | |||
| 1851 | /** |
||
| 1852 | * @return string |
||
| 1853 | */ |
||
| 1854 | public function getTwitterName() |
||
| 1858 | |||
| 1859 | /** |
||
| 1860 | * @param string $twitterUid |
||
| 1861 | * |
||
| 1862 | * @return User |
||
| 1863 | */ |
||
| 1864 | public function setTwitterUid($twitterUid) |
||
| 1870 | |||
| 1871 | /** |
||
| 1872 | * @return string |
||
| 1873 | */ |
||
| 1874 | public function getTwitterUid() |
||
| 1878 | |||
| 1879 | /** |
||
| 1880 | * @param string $website |
||
| 1881 | * |
||
| 1882 | * @return User |
||
| 1883 | */ |
||
| 1884 | public function setWebsite($website) |
||
| 1890 | |||
| 1891 | /** |
||
| 1892 | * @return string |
||
| 1893 | */ |
||
| 1894 | public function getWebsite() |
||
| 1898 | |||
| 1899 | /** |
||
| 1900 | * @param string $token |
||
| 1901 | * |
||
| 1902 | * @return User |
||
| 1903 | */ |
||
| 1904 | public function setToken($token) |
||
| 1910 | |||
| 1911 | /** |
||
| 1912 | * @return string |
||
| 1913 | */ |
||
| 1914 | public function getToken() |
||
| 1918 | |||
| 1919 | /** |
||
| 1920 | * @return string |
||
| 1921 | */ |
||
| 1922 | public function getFullname() |
||
| 1926 | |||
| 1927 | /** |
||
| 1928 | * @return array |
||
| 1929 | */ |
||
| 1930 | public function getRealRoles() |
||
| 1934 | |||
| 1935 | /** |
||
| 1936 | * @param array $roles |
||
| 1937 | * |
||
| 1938 | * @return User |
||
| 1939 | */ |
||
| 1940 | public function setRealRoles(array $roles) |
||
| 1946 | |||
| 1947 | /** |
||
| 1948 | * Removes sensitive data from the user. |
||
| 1949 | */ |
||
| 1950 | public function eraseCredentials() |
||
| 1954 | |||
| 1955 | |||
| 1956 | public function getUsernameCanonical() |
||
| 1960 | |||
| 1961 | |||
| 1962 | public function getEmailCanonical() |
||
| 1966 | |||
| 1967 | public function getPlainPassword() |
||
| 1971 | |||
| 1972 | /** |
||
| 1973 | * Returns the user roles |
||
| 1974 | * |
||
| 1975 | * @return array The roles |
||
| 1976 | */ |
||
| 1977 | View Code Duplication | public function getRoles() |
|
| 1990 | |||
| 1991 | /** |
||
| 1992 | * Never use this to check if this user has access to anything! |
||
| 1993 | * |
||
| 1994 | * Use the SecurityContext, or an implementation of AccessDecisionManager |
||
| 1995 | * instead, e.g. |
||
| 1996 | * |
||
| 1997 | * $securityContext->isGranted('ROLE_USER'); |
||
| 1998 | * |
||
| 1999 | * @param string $role |
||
| 2000 | * |
||
| 2001 | * @return boolean |
||
| 2002 | */ |
||
| 2003 | public function hasRole($role) |
||
| 2007 | |||
| 2008 | View Code Duplication | public function isAccountNonExpired() |
|
| 2020 | |||
| 2021 | public function isAccountNonLocked() |
||
| 2025 | |||
| 2026 | View Code Duplication | public function isCredentialsNonExpired() |
|
| 2038 | |||
| 2039 | public function isCredentialsExpired() |
||
| 2043 | |||
| 2044 | public function isExpired() |
||
| 2048 | |||
| 2049 | public function isLocked() |
||
| 2053 | |||
| 2054 | public function isSuperAdmin() |
||
| 2058 | |||
| 2059 | public function isUser(UserInterface $user = null) |
||
| 2063 | |||
| 2064 | View Code Duplication | public function removeRole($role) |
|
| 2073 | |||
| 2074 | public function setUsername($username) |
||
| 2080 | |||
| 2081 | public function setUsernameCanonical($usernameCanonical) |
||
| 2087 | |||
| 2088 | |||
| 2089 | /** |
||
| 2090 | * @param boolean $boolean |
||
| 2091 | * |
||
| 2092 | * @return User |
||
| 2093 | */ |
||
| 2094 | public function setCredentialsExpired($boolean) |
||
| 2100 | |||
| 2101 | public function setEmailCanonical($emailCanonical) |
||
| 2107 | |||
| 2108 | public function setEnabled($boolean) |
||
| 2114 | |||
| 2115 | /** |
||
| 2116 | * Sets this user to expired. |
||
| 2117 | * |
||
| 2118 | * @param Boolean $boolean |
||
| 2119 | * |
||
| 2120 | * @return User |
||
| 2121 | */ |
||
| 2122 | public function setExpired($boolean) |
||
| 2128 | |||
| 2129 | /** |
||
| 2130 | * @param \DateTime $date |
||
| 2131 | * |
||
| 2132 | * @return User |
||
| 2133 | */ |
||
| 2134 | public function setExpiresAt(\DateTime $date = null) |
||
| 2140 | |||
| 2141 | public function setSuperAdmin($boolean) |
||
| 2142 | { |
||
| 2143 | if (true === $boolean) { |
||
| 2144 | $this->addRole(static::ROLE_SUPER_ADMIN); |
||
| 2145 | } else { |
||
| 2146 | $this->removeRole(static::ROLE_SUPER_ADMIN); |
||
| 2147 | } |
||
| 2148 | |||
| 2149 | return $this; |
||
| 2150 | } |
||
| 2151 | |||
| 2152 | public function setPlainPassword($password) |
||
| 2158 | |||
| 2159 | public function setLocked($boolean) |
||
| 2165 | |||
| 2166 | public function setPasswordRequestedAt(\DateTime $date = null) |
||
| 2172 | |||
| 2173 | |||
| 2174 | public function setRoles(array $roles) |
||
| 2184 | |||
| 2185 | /** |
||
| 2186 | * Gets the groups granted to the user. |
||
| 2187 | * |
||
| 2188 | * @return Collection |
||
| 2189 | */ |
||
| 2190 | public function getGroups() |
||
| 2194 | |||
| 2195 | public function getGroupNames() |
||
| 2204 | |||
| 2205 | public function hasGroup($name) |
||
| 2209 | |||
| 2210 | public function addGroup(GroupInterface $group) |
||
| 2218 | |||
| 2219 | public function removeGroup(GroupInterface $group) |
||
| 2227 | |||
| 2228 | public function addRole($role) |
||
| 2229 | { |
||
| 2230 | $role = strtoupper($role); |
||
| 2231 | if ($role === static::ROLE_DEFAULT) { |
||
| 2232 | return $this; |
||
| 2233 | } |
||
| 2234 | |||
| 2235 | if (!in_array($role, $this->roles, true)) { |
||
| 2236 | $this->roles[] = $role; |
||
| 2237 | } |
||
| 2238 | |||
| 2239 | return $this; |
||
| 2240 | } |
||
| 2241 | |||
| 2242 | /** |
||
| 2243 | * Serializes the user. |
||
| 2244 | * |
||
| 2245 | * The serialized data have to contain the fields used by the equals method and the username. |
||
| 2246 | * |
||
| 2247 | * @return string |
||
| 2248 | */ |
||
| 2249 | View Code Duplication | public function serialize() |
|
| 2263 | |||
| 2264 | /** |
||
| 2265 | * Unserializes the user. |
||
| 2266 | * |
||
| 2267 | * @param string $serialized |
||
| 2268 | */ |
||
| 2269 | View Code Duplication | public function unserialize($serialized) |
|
| 2288 | } |
||
| 2289 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.