| Total Complexity | 131 |
| Total Lines | 1173 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like Course 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.
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 Course, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 34 | #[ApiResource( |
||
| 35 | types: ['https://schema.org/Course'], |
||
| 36 | operations: [ |
||
| 37 | new Get(security: "is_granted('VIEW', object)"), |
||
| 38 | new Post(), |
||
| 39 | new GetCollection(), |
||
| 40 | ], |
||
| 41 | normalizationContext: [ |
||
| 42 | 'groups' => ['course:read'], |
||
| 43 | ], |
||
| 44 | denormalizationContext: [ |
||
| 45 | 'groups' => ['course:write'], |
||
| 46 | ], |
||
| 47 | filters: [ |
||
| 48 | 'course.sticky_boolean_filter', |
||
| 49 | ], |
||
| 50 | security: "is_granted('ROLE_USER')" |
||
| 51 | )] |
||
| 52 | #[ORM\Table(name: 'course')] |
||
| 53 | #[ORM\Index(columns: ['sticky'], name: 'idx_course_sticky')] |
||
| 54 | #[UniqueEntity('code')] |
||
| 55 | #[UniqueEntity('visualCode')] |
||
| 56 | #[ORM\Entity(repositoryClass: CourseRepository::class)] |
||
| 57 | #[ORM\EntityListeners([ResourceListener::class, CourseListener::class])] |
||
| 58 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['title' => 'partial', 'code' => 'partial'])] |
||
| 59 | #[ApiFilter(filterClass: OrderFilter::class, properties: ['id', 'title'])] |
||
| 60 | class Course extends AbstractResource implements ResourceInterface, ResourceWithAccessUrlInterface, ResourceIllustrationInterface, ExtraFieldItemInterface, Stringable |
||
| 61 | { |
||
| 62 | public const CLOSED = 0; |
||
| 63 | public const REGISTERED = 1; |
||
| 64 | // Only registered users in the course. |
||
| 65 | public const OPEN_PLATFORM = 2; |
||
| 66 | // All users registered in the platform (default). |
||
| 67 | public const OPEN_WORLD = 3; |
||
| 68 | public const HIDDEN = 4; |
||
| 69 | |||
| 70 | #[Groups([ |
||
| 71 | 'course:read', |
||
| 72 | 'course_rel_user:read', |
||
| 73 | 'session:read', |
||
| 74 | 'session_rel_course_rel_user:read', |
||
| 75 | 'session_rel_user:read', |
||
| 76 | 'session_rel_course:read', |
||
| 77 | 'track_e_exercise:read', |
||
| 78 | 'user_subscriptions:sessions', |
||
| 79 | ])] |
||
| 80 | #[ORM\Column(name: 'id', type: 'integer')] |
||
| 81 | #[ORM\Id] |
||
| 82 | #[ORM\GeneratedValue(strategy: 'AUTO')] |
||
| 83 | protected ?int $id = null; |
||
| 84 | |||
| 85 | /** |
||
| 86 | * The course title. |
||
| 87 | */ |
||
| 88 | #[Groups([ |
||
| 89 | 'course:read', |
||
| 90 | 'course:write', |
||
| 91 | 'course_rel_user:read', |
||
| 92 | 'session:read', |
||
| 93 | 'session_rel_course_rel_user:read', |
||
| 94 | 'session_rel_user:read', |
||
| 95 | 'session_rel_course:read', |
||
| 96 | 'track_e_exercise:read', |
||
| 97 | 'user_subscriptions:sessions', |
||
| 98 | ])] |
||
| 99 | #[Assert\NotBlank(message: 'A Course requires a title')] |
||
| 100 | #[ORM\Column(name: 'title', type: 'string', length: 250, unique: false, nullable: true)] |
||
| 101 | protected ?string $title = null; |
||
| 102 | |||
| 103 | /** |
||
| 104 | * The course code. |
||
| 105 | */ |
||
| 106 | #[ApiProperty(iris: ['http://schema.org/courseCode'])] |
||
| 107 | #[Groups(['course:read', 'user:write', 'course_rel_user:read'])] |
||
| 108 | #[Assert\NotBlank] |
||
| 109 | #[Assert\Length(max: 40, maxMessage: 'Code cannot be longer than {{ limit }} characters')] |
||
| 110 | #[Gedmo\Slug(fields: ['title'], updatable: false, style: 'upper', unique: true, separator: '')] |
||
| 111 | #[ORM\Column(name: 'code', type: 'string', length: 40, unique: true, nullable: false)] |
||
| 112 | protected string $code; |
||
| 113 | |||
| 114 | #[Assert\Length(max: 40, maxMessage: 'Code cannot be longer than {{ limit }} characters')] |
||
| 115 | #[ORM\Column(name: 'visual_code', type: 'string', length: 40, unique: false, nullable: true)] |
||
| 116 | protected ?string $visualCode = null; |
||
| 117 | |||
| 118 | /** |
||
| 119 | * @var Collection<int, CourseRelUser> |
||
| 120 | */ |
||
| 121 | #[Groups([ |
||
| 122 | 'course:read', |
||
| 123 | 'user:read', |
||
| 124 | 'course_rel_user:read', |
||
| 125 | ])] |
||
| 126 | #[ORM\OneToMany(mappedBy: 'course', targetEntity: CourseRelUser::class, cascade: ['persist'], orphanRemoval: true)] |
||
| 127 | protected Collection $users; |
||
| 128 | |||
| 129 | /** |
||
| 130 | * @var Collection<int, EntityAccessUrlInterface> |
||
| 131 | */ |
||
| 132 | #[ORM\OneToMany( |
||
| 133 | mappedBy: 'course', |
||
| 134 | targetEntity: AccessUrlRelCourse::class, |
||
| 135 | cascade: ['persist', 'remove'], |
||
| 136 | orphanRemoval: true |
||
| 137 | )] |
||
| 138 | protected Collection $urls; |
||
| 139 | |||
| 140 | /** |
||
| 141 | * @var Collection<int, SessionRelCourse> |
||
| 142 | */ |
||
| 143 | #[ORM\OneToMany(mappedBy: 'course', targetEntity: SessionRelCourse::class, cascade: ['persist', 'remove'])] |
||
| 144 | protected Collection $sessions; |
||
| 145 | |||
| 146 | /** |
||
| 147 | * @var Collection<int, SessionRelCourseRelUser> |
||
| 148 | */ |
||
| 149 | #[ORM\OneToMany(mappedBy: 'course', targetEntity: SessionRelCourseRelUser::class, cascade: [ |
||
| 150 | 'persist', |
||
| 151 | 'remove', |
||
| 152 | ])] |
||
| 153 | protected Collection $sessionRelCourseRelUsers; |
||
| 154 | |||
| 155 | /** |
||
| 156 | * @var Collection<int, CTool> |
||
| 157 | */ |
||
| 158 | #[ORM\OneToMany( |
||
| 159 | mappedBy: 'course', |
||
| 160 | targetEntity: CTool::class, |
||
| 161 | cascade: [ |
||
| 162 | 'persist', |
||
| 163 | 'remove', |
||
| 164 | ], |
||
| 165 | orphanRemoval: true |
||
| 166 | )] |
||
| 167 | protected Collection $tools; |
||
| 168 | |||
| 169 | #[Groups(['course:read'])] |
||
| 170 | #[ORM\OneToOne( |
||
| 171 | mappedBy: 'course', |
||
| 172 | targetEntity: TrackCourseRanking::class, |
||
| 173 | cascade: [ |
||
| 174 | 'persist', |
||
| 175 | 'remove', |
||
| 176 | ], |
||
| 177 | orphanRemoval: true |
||
| 178 | )] |
||
| 179 | protected ?TrackCourseRanking $trackCourseRanking = null; |
||
| 180 | |||
| 181 | protected Session $currentSession; |
||
| 182 | |||
| 183 | protected AccessUrl $currentUrl; |
||
| 184 | |||
| 185 | /** |
||
| 186 | * @var Collection<int, SkillRelCourse> |
||
| 187 | */ |
||
| 188 | #[ORM\OneToMany(mappedBy: 'course', targetEntity: SkillRelCourse::class, cascade: ['persist', 'remove'])] |
||
| 189 | protected Collection $skills; |
||
| 190 | |||
| 191 | /** |
||
| 192 | * @var Collection<int, SkillRelUser> |
||
| 193 | */ |
||
| 194 | #[ORM\OneToMany(mappedBy: 'course', targetEntity: SkillRelUser::class, cascade: ['persist', 'remove'])] |
||
| 195 | protected Collection $issuedSkills; |
||
| 196 | |||
| 197 | /** |
||
| 198 | * @var Collection<int, GradebookCategory> |
||
| 199 | */ |
||
| 200 | #[ORM\OneToMany(mappedBy: 'course', targetEntity: GradebookCategory::class, cascade: ['persist', 'remove'])] |
||
| 201 | protected Collection $gradebookCategories; |
||
| 202 | |||
| 203 | /** |
||
| 204 | * @var Collection<int, GradebookEvaluation> |
||
| 205 | */ |
||
| 206 | #[ORM\OneToMany(mappedBy: 'course', targetEntity: GradebookEvaluation::class, cascade: ['persist', 'remove'])] |
||
| 207 | protected Collection $gradebookEvaluations; |
||
| 208 | |||
| 209 | /** |
||
| 210 | * @var Collection<int, GradebookLink> |
||
| 211 | */ |
||
| 212 | #[ORM\OneToMany(mappedBy: 'course', targetEntity: GradebookLink::class, cascade: ['persist', 'remove'])] |
||
| 213 | protected Collection $gradebookLinks; |
||
| 214 | |||
| 215 | /** |
||
| 216 | * @var Collection<int, TrackEHotspot> |
||
| 217 | */ |
||
| 218 | #[ORM\OneToMany(mappedBy: 'course', targetEntity: TrackEHotspot::class, cascade: ['persist', 'remove'])] |
||
| 219 | protected Collection $trackEHotspots; |
||
| 220 | |||
| 221 | /** |
||
| 222 | * @var Collection<int, SearchEngineRef> |
||
| 223 | */ |
||
| 224 | #[ORM\OneToMany(mappedBy: 'course', targetEntity: SearchEngineRef::class, cascade: ['persist', 'remove'])] |
||
| 225 | protected Collection $searchEngineRefs; |
||
| 226 | |||
| 227 | /** |
||
| 228 | * @var Collection<int, Templates> |
||
| 229 | */ |
||
| 230 | #[ORM\OneToMany(mappedBy: 'course', targetEntity: Templates::class, cascade: ['persist', 'remove'])] |
||
| 231 | protected Collection $templates; |
||
| 232 | |||
| 233 | /** |
||
| 234 | * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SpecificFieldValues", mappedBy="course"). |
||
| 235 | */ |
||
| 236 | // protected $specificFieldValues; |
||
| 237 | |||
| 238 | /** |
||
| 239 | * ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\SharedSurvey", mappedBy="course"). |
||
| 240 | */ |
||
| 241 | // protected $sharedSurveys; |
||
| 242 | |||
| 243 | #[ORM\Column(name: 'directory', type: 'string', length: 40, unique: false, nullable: true)] |
||
| 244 | protected ?string $directory = null; |
||
| 245 | |||
| 246 | #[Groups(['course:read', 'session:read'])] |
||
| 247 | #[Assert\NotBlank] |
||
| 248 | #[ORM\Column(name: 'course_language', type: 'string', length: 20, unique: false, nullable: false)] |
||
| 249 | protected string $courseLanguage; |
||
| 250 | |||
| 251 | #[Groups(['course:read', 'course_rel_user:read'])] |
||
| 252 | #[ORM\Column(name: 'description', type: 'text', unique: false, nullable: true)] |
||
| 253 | protected ?string $description; |
||
| 254 | |||
| 255 | #[Groups(['course:read', 'course_rel_user:read'])] |
||
| 256 | #[ORM\Column(name: 'introduction', type: 'text', nullable: true)] |
||
| 257 | protected ?string $introduction; |
||
| 258 | |||
| 259 | /** |
||
| 260 | * @var Collection<int, CourseCategory> |
||
| 261 | */ |
||
| 262 | #[Groups(['course:read', 'course:write', 'course_rel_user:read', 'session:read'])] |
||
| 263 | #[ORM\JoinTable(name: 'course_rel_category')] |
||
| 264 | #[ORM\JoinColumn(name: 'course_id', referencedColumnName: 'id')] |
||
| 265 | #[ORM\InverseJoinColumn(name: 'course_category_id', referencedColumnName: 'id')] |
||
| 266 | #[ORM\ManyToMany(targetEntity: CourseCategory::class, inversedBy: 'courses')] |
||
| 267 | protected Collection $categories; |
||
| 268 | |||
| 269 | #[Assert\NotBlank] |
||
| 270 | #[Groups(['course:read', 'course:write'])] |
||
| 271 | #[ORM\Column(name: 'visibility', type: 'integer', unique: false, nullable: false)] |
||
| 272 | protected int $visibility; |
||
| 273 | |||
| 274 | #[ORM\Column(name: 'show_score', type: 'integer', unique: false, nullable: true)] |
||
| 275 | protected ?int $showScore = null; |
||
| 276 | |||
| 277 | #[ORM\Column(name: 'tutor_name', type: 'string', length: 200, unique: false, nullable: true)] |
||
| 278 | protected ?string $tutorName; |
||
| 279 | |||
| 280 | #[Groups(['course:read'])] |
||
| 281 | #[ORM\Column(name: 'department_name', type: 'string', length: 30, unique: false, nullable: true)] |
||
| 282 | protected ?string $departmentName = null; |
||
| 283 | |||
| 284 | #[Assert\Url] |
||
| 285 | #[Groups(['course:read', 'course:write'])] |
||
| 286 | #[ORM\Column(name: 'department_url', type: 'string', length: 180, unique: false, nullable: true)] |
||
| 287 | protected ?string $departmentUrl = null; |
||
| 288 | |||
| 289 | #[Assert\Url] |
||
| 290 | #[Groups(['course:read', 'course:write'])] |
||
| 291 | #[ORM\Column(name: 'video_url', type: 'string', length: 255)] |
||
| 292 | protected string $videoUrl; |
||
| 293 | |||
| 294 | #[Groups(['course:read', 'course:write'])] |
||
| 295 | #[ORM\Column(name: 'sticky', type: 'boolean')] |
||
| 296 | protected bool $sticky; |
||
| 297 | |||
| 298 | #[ORM\Column(name: 'disk_quota', type: 'integer', unique: false, nullable: true)] |
||
| 299 | protected ?int $diskQuota = null; |
||
| 300 | |||
| 301 | #[ORM\Column(name: 'last_visit', type: 'datetime', unique: false, nullable: true)] |
||
| 302 | protected ?DateTime $lastVisit; |
||
| 303 | |||
| 304 | #[ORM\Column(name: 'last_edit', type: 'datetime', unique: false, nullable: true)] |
||
| 305 | protected ?DateTime $lastEdit; |
||
| 306 | |||
| 307 | #[ORM\Column(name: 'creation_date', type: 'datetime', unique: false, nullable: false)] |
||
| 308 | protected DateTime $creationDate; |
||
| 309 | |||
| 310 | #[Groups(['course:read'])] |
||
| 311 | #[ORM\Column(name: 'expiration_date', type: 'datetime', unique: false, nullable: true)] |
||
| 312 | protected ?DateTime $expirationDate = null; |
||
| 313 | |||
| 314 | #[Assert\NotNull] |
||
| 315 | #[ORM\Column(name: 'subscribe', type: 'boolean', unique: false, nullable: false)] |
||
| 316 | protected bool $subscribe; |
||
| 317 | |||
| 318 | #[Assert\NotNull] |
||
| 319 | #[ORM\Column(name: 'unsubscribe', type: 'boolean', unique: false, nullable: false)] |
||
| 320 | protected bool $unsubscribe; |
||
| 321 | |||
| 322 | #[ORM\Column(name: 'registration_code', type: 'string', length: 255, unique: false, nullable: true)] |
||
| 323 | protected ?string $registrationCode; |
||
| 324 | |||
| 325 | #[ORM\Column(name: 'legal', type: 'text', unique: false, nullable: true)] |
||
| 326 | protected ?string $legal; |
||
| 327 | |||
| 328 | #[ORM\Column(name: 'activate_legal', type: 'integer', unique: false, nullable: true)] |
||
| 329 | protected ?int $activateLegal; |
||
| 330 | |||
| 331 | #[ORM\Column(name: 'add_teachers_to_sessions_courses', type: 'boolean', nullable: true)] |
||
| 332 | protected ?bool $addTeachersToSessionsCourses; |
||
| 333 | |||
| 334 | #[ORM\Column(name: 'course_type_id', type: 'integer', unique: false, nullable: true)] |
||
| 335 | protected ?int $courseTypeId; |
||
| 336 | |||
| 337 | /** |
||
| 338 | * ORM\OneToMany(targetEntity="CurriculumCategory", mappedBy="course"). |
||
| 339 | */ |
||
| 340 | // protected $curriculumCategories; |
||
| 341 | |||
| 342 | #[ORM\ManyToOne(targetEntity: Room::class)] |
||
| 343 | #[ORM\JoinColumn(name: 'room_id', referencedColumnName: 'id')] |
||
| 344 | protected ?Room $room; |
||
| 345 | |||
| 346 | #[Groups(['course:read', 'course_rel_user:read', 'course:write'])] |
||
| 347 | #[ORM\Column(type: 'integer', nullable: true)] |
||
| 348 | private ?int $duration = null; |
||
| 349 | |||
| 350 | public function __construct() |
||
| 351 | { |
||
| 352 | $this->visibility = self::OPEN_PLATFORM; |
||
| 353 | $this->sessions = new ArrayCollection(); |
||
| 354 | $this->sessionRelCourseRelUsers = new ArrayCollection(); |
||
| 355 | $this->skills = new ArrayCollection(); |
||
| 356 | $this->issuedSkills = new ArrayCollection(); |
||
| 357 | $this->creationDate = new DateTime(); |
||
| 358 | $this->lastVisit = new DateTime(); |
||
| 359 | $this->lastEdit = new DateTime(); |
||
| 360 | $this->description = ''; |
||
| 361 | $this->introduction = ''; |
||
| 362 | $this->tutorName = ''; |
||
| 363 | $this->legal = ''; |
||
| 364 | $this->videoUrl = ''; |
||
| 365 | $this->registrationCode = null; |
||
| 366 | $this->users = new ArrayCollection(); |
||
| 367 | $this->urls = new ArrayCollection(); |
||
| 368 | $this->tools = new ArrayCollection(); |
||
| 369 | $this->categories = new ArrayCollection(); |
||
| 370 | $this->gradebookCategories = new ArrayCollection(); |
||
| 371 | $this->gradebookEvaluations = new ArrayCollection(); |
||
| 372 | $this->gradebookLinks = new ArrayCollection(); |
||
| 373 | $this->trackEHotspots = new ArrayCollection(); |
||
| 374 | $this->searchEngineRefs = new ArrayCollection(); |
||
| 375 | $this->templates = new ArrayCollection(); |
||
| 376 | $this->activateLegal = 0; |
||
| 377 | $this->addTeachersToSessionsCourses = false; |
||
| 378 | $this->courseTypeId = null; |
||
| 379 | $this->room = null; |
||
| 380 | $this->courseLanguage = 'en'; |
||
| 381 | $this->subscribe = true; |
||
| 382 | $this->unsubscribe = false; |
||
| 383 | $this->sticky = false; |
||
| 384 | // $this->specificFieldValues = new ArrayCollection(); |
||
| 385 | // $this->sharedSurveys = new ArrayCollection(); |
||
| 386 | } |
||
| 387 | |||
| 388 | public function __toString(): string |
||
| 389 | { |
||
| 390 | return $this->getTitle(); |
||
| 391 | } |
||
| 392 | |||
| 393 | public static function getStatusList(): array |
||
| 394 | { |
||
| 395 | return [ |
||
| 396 | self::CLOSED => 'Closed', |
||
| 397 | self::REGISTERED => 'Registered', |
||
| 398 | self::OPEN_PLATFORM => 'Open platform', |
||
| 399 | self::OPEN_WORLD => 'Open world', |
||
| 400 | self::HIDDEN => 'Hidden', |
||
| 401 | ]; |
||
| 402 | } |
||
| 403 | |||
| 404 | public function getTitle(): string |
||
| 405 | { |
||
| 406 | return $this->title; |
||
|
|
|||
| 407 | } |
||
| 408 | |||
| 409 | public function setTitle(string $title): self |
||
| 410 | { |
||
| 411 | $this->title = $title; |
||
| 412 | // Set the code based in the title if it doesnt exists. |
||
| 413 | if (empty($this->code)) { |
||
| 414 | $this->setCode($title); |
||
| 415 | } |
||
| 416 | |||
| 417 | return $this; |
||
| 418 | } |
||
| 419 | |||
| 420 | /** |
||
| 421 | * @return Collection<int, CTool> |
||
| 422 | */ |
||
| 423 | public function getTools(): Collection |
||
| 424 | { |
||
| 425 | return $this->tools; |
||
| 426 | } |
||
| 427 | |||
| 428 | public function setTools(array $tools): self |
||
| 429 | { |
||
| 430 | foreach ($tools as $tool) { |
||
| 431 | $this->addTool($tool); |
||
| 432 | } |
||
| 433 | |||
| 434 | return $this; |
||
| 435 | } |
||
| 436 | |||
| 437 | public function addTool(CTool $tool): self |
||
| 438 | { |
||
| 439 | $tool->setCourse($this); |
||
| 440 | $this->tools->add($tool); |
||
| 441 | |||
| 442 | return $this; |
||
| 443 | } |
||
| 444 | |||
| 445 | public function getTrackCourseRanking(): ?TrackCourseRanking |
||
| 446 | { |
||
| 447 | return $this->trackCourseRanking; |
||
| 448 | } |
||
| 449 | |||
| 450 | public function setTrackCourseRanking(?TrackCourseRanking $trackCourseRanking): self |
||
| 451 | { |
||
| 452 | $this->trackCourseRanking = $trackCourseRanking; |
||
| 453 | |||
| 454 | return $this; |
||
| 455 | } |
||
| 456 | |||
| 457 | public function hasSubscriptionByUser(User $user): bool |
||
| 458 | { |
||
| 459 | return (bool) $this->getSubscriptionByUser($user); |
||
| 460 | } |
||
| 461 | |||
| 462 | public function getSubscriptionByUser(User $user): ?CourseRelUser |
||
| 463 | { |
||
| 464 | $users = $this->getUsers(); |
||
| 465 | |||
| 466 | if (0 === $users->count()) { |
||
| 467 | return null; |
||
| 468 | } |
||
| 469 | |||
| 470 | $matching = $users->filter( |
||
| 471 | fn (CourseRelUser $subscription) => $subscription->getUser()->getId() === $user->getId() |
||
| 472 | ); |
||
| 473 | |||
| 474 | return $matching->count() > 0 ? $matching->first() : null; |
||
| 475 | } |
||
| 476 | |||
| 477 | /** |
||
| 478 | * @return Collection<int, CourseRelUser> |
||
| 479 | */ |
||
| 480 | public function getUsers(): Collection |
||
| 481 | { |
||
| 482 | return $this->users; |
||
| 483 | } |
||
| 484 | |||
| 485 | public function addSubscription(CourseRelUser $courseRelUser): self |
||
| 486 | { |
||
| 487 | $courseRelUser->setCourse($this); |
||
| 488 | if (!$this->hasUsers($courseRelUser)) { |
||
| 489 | $this->users->add($courseRelUser); |
||
| 490 | } |
||
| 491 | |||
| 492 | return $this; |
||
| 493 | } |
||
| 494 | |||
| 495 | public function removeSubscription(CourseRelUser $user): void |
||
| 496 | { |
||
| 497 | foreach ($this->users as $key => $value) { |
||
| 498 | if ($value->getId() === $user->getId()) { |
||
| 499 | unset($this->users[$key]); |
||
| 500 | } |
||
| 501 | } |
||
| 502 | } |
||
| 503 | |||
| 504 | public function hasUsers(CourseRelUser $subscription): bool |
||
| 505 | { |
||
| 506 | if (0 !== $this->users->count()) { |
||
| 507 | $criteria = Criteria::create() |
||
| 508 | ->where( |
||
| 509 | Criteria::expr()->eq('user', $subscription->getUser()) |
||
| 510 | ) |
||
| 511 | ->andWhere( |
||
| 512 | Criteria::expr()->eq('status', $subscription->getStatus()) |
||
| 513 | ) |
||
| 514 | ->andWhere( |
||
| 515 | Criteria::expr()->eq('relationType', $subscription->getRelationType()) |
||
| 516 | ) |
||
| 517 | ; |
||
| 518 | $relation = $this->users->matching($criteria); |
||
| 519 | |||
| 520 | return $relation->count() > 0; |
||
| 521 | } |
||
| 522 | |||
| 523 | return false; |
||
| 524 | } |
||
| 525 | |||
| 526 | public function addSubscriptionForUser(User $user, int $relationType, ?string $role, int $status): self |
||
| 527 | { |
||
| 528 | $courseRelUser = (new CourseRelUser()) |
||
| 529 | ->setCourse($this) |
||
| 530 | ->setUser($user) |
||
| 531 | ->setRelationType($relationType) |
||
| 532 | ->setStatus($status) |
||
| 533 | ; |
||
| 534 | $this->addSubscription($courseRelUser); |
||
| 535 | |||
| 536 | return $this; |
||
| 537 | } |
||
| 538 | |||
| 539 | public function hasUserAsStudent(User $user): bool |
||
| 540 | { |
||
| 541 | $criteria = Criteria::create()->where(Criteria::expr()->eq('user', $user)); |
||
| 542 | |||
| 543 | return $this->getStudentSubscriptions()->matching($criteria)->count() > 0; |
||
| 544 | } |
||
| 545 | |||
| 546 | public function getStudentSubscriptions(): Collection |
||
| 547 | { |
||
| 548 | $criteria = Criteria::create(); |
||
| 549 | $criteria->where(Criteria::expr()->eq('status', CourseRelUser::STUDENT)); |
||
| 550 | |||
| 551 | return $this->users->matching($criteria); |
||
| 552 | } |
||
| 553 | |||
| 554 | public function addUserAsStudent(User $user): self |
||
| 555 | { |
||
| 556 | $this->addSubscriptionForUser($user, 0, '', CourseRelUser::STUDENT); |
||
| 557 | |||
| 558 | return $this; |
||
| 559 | } |
||
| 560 | |||
| 561 | public function hasUserAsTeacher(User $user): bool |
||
| 562 | { |
||
| 563 | $users = $this->getTeachersSubscriptions(); |
||
| 564 | |||
| 565 | if (0 === $users->count()) { |
||
| 566 | return false; |
||
| 567 | } |
||
| 568 | |||
| 569 | $matching = $users->filter( |
||
| 570 | fn (CourseRelUser $subscription) => $subscription->getUser()->getId() === $user->getId() |
||
| 571 | ); |
||
| 572 | |||
| 573 | return $matching->count() > 0; |
||
| 574 | } |
||
| 575 | |||
| 576 | #[SerializedName('teachers')] |
||
| 577 | #[Groups(['course:read'])] |
||
| 578 | public function getTeachersSubscriptions(): Collection |
||
| 579 | { |
||
| 580 | $teacherSubscriptions = new ArrayCollection(); |
||
| 581 | |||
| 582 | foreach ($this->users as $subscription) { |
||
| 583 | if (CourseRelUser::TEACHER === $subscription->getStatus()) { |
||
| 584 | $teacherSubscriptions->add($subscription); |
||
| 585 | } |
||
| 586 | } |
||
| 587 | |||
| 588 | return $teacherSubscriptions; |
||
| 589 | } |
||
| 590 | |||
| 591 | public function addUserAsTeacher(User $user): self |
||
| 592 | { |
||
| 593 | $this->addSubscriptionForUser($user, 0, 'Trainer', CourseRelUser::TEACHER); |
||
| 594 | |||
| 595 | return $this; |
||
| 596 | } |
||
| 597 | |||
| 598 | public function hasGroup(CGroup $group): void |
||
| 599 | { |
||
| 600 | /*$criteria = Criteria::create()->where( |
||
| 601 | Criteria::expr()->eq('groups', $group) |
||
| 602 | );*/ |
||
| 603 | // return $this->getGroups()->contains($group); |
||
| 604 | } |
||
| 605 | |||
| 606 | public function getId(): ?int |
||
| 607 | { |
||
| 608 | return $this->id; |
||
| 609 | } |
||
| 610 | |||
| 611 | /** |
||
| 612 | * Get directory, needed in migrations. |
||
| 613 | */ |
||
| 614 | public function getDirectory(): ?string |
||
| 615 | { |
||
| 616 | return $this->directory; |
||
| 617 | } |
||
| 618 | |||
| 619 | public function getCourseLanguage(): string |
||
| 620 | { |
||
| 621 | return $this->courseLanguage; |
||
| 622 | } |
||
| 623 | |||
| 624 | public function setCourseLanguage(string $courseLanguage): self |
||
| 625 | { |
||
| 626 | $this->courseLanguage = $courseLanguage; |
||
| 627 | |||
| 628 | return $this; |
||
| 629 | } |
||
| 630 | |||
| 631 | public function getTitleAndCode(): string |
||
| 632 | { |
||
| 633 | return $this->getTitle().' ('.$this->getCode().')'; |
||
| 634 | } |
||
| 635 | |||
| 636 | public function getCode(): string |
||
| 639 | } |
||
| 640 | |||
| 641 | public function setCode(string $code): self |
||
| 642 | { |
||
| 643 | $this->code = $code; |
||
| 644 | $this->visualCode = $code; |
||
| 645 | |||
| 646 | return $this; |
||
| 647 | } |
||
| 648 | |||
| 649 | public function getDescription(): ?string |
||
| 650 | { |
||
| 651 | return $this->description; |
||
| 652 | } |
||
| 653 | |||
| 654 | public function setDescription(string $description): self |
||
| 655 | { |
||
| 656 | $this->description = $description; |
||
| 657 | |||
| 658 | return $this; |
||
| 659 | } |
||
| 660 | |||
| 661 | /** |
||
| 662 | * @return Collection<int, CourseCategory> |
||
| 663 | */ |
||
| 664 | public function getCategories(): Collection |
||
| 665 | { |
||
| 666 | return $this->categories; |
||
| 667 | } |
||
| 668 | |||
| 669 | public function setCategories(Collection $categories): self |
||
| 674 | } |
||
| 675 | |||
| 676 | public function addCategory(CourseCategory $category): self |
||
| 677 | { |
||
| 678 | $this->categories[] = $category; |
||
| 679 | |||
| 680 | return $this; |
||
| 681 | } |
||
| 682 | |||
| 683 | public function removeCategory(CourseCategory $category): void |
||
| 684 | { |
||
| 685 | $this->categories->removeElement($category); |
||
| 686 | } |
||
| 687 | |||
| 688 | public function getVisibility(): int |
||
| 689 | { |
||
| 690 | return $this->visibility; |
||
| 691 | } |
||
| 692 | |||
| 693 | public function setVisibility(int $visibility): self |
||
| 698 | } |
||
| 699 | |||
| 700 | public function getShowScore(): ?int |
||
| 701 | { |
||
| 702 | return $this->showScore; |
||
| 703 | } |
||
| 704 | |||
| 705 | public function setShowScore(int $showScore): self |
||
| 710 | } |
||
| 711 | |||
| 712 | public function getTutorName(): ?string |
||
| 713 | { |
||
| 714 | return $this->tutorName; |
||
| 715 | } |
||
| 716 | |||
| 717 | public function setTutorName(?string $tutorName): self |
||
| 722 | } |
||
| 723 | |||
| 724 | public function getVisualCode(): ?string |
||
| 725 | { |
||
| 726 | return $this->visualCode; |
||
| 727 | } |
||
| 728 | |||
| 729 | public function setVisualCode(string $visualCode): self |
||
| 734 | } |
||
| 735 | |||
| 736 | public function getDepartmentName(): ?string |
||
| 737 | { |
||
| 738 | return $this->departmentName; |
||
| 739 | } |
||
| 740 | |||
| 741 | public function setDepartmentName(string $departmentName): self |
||
| 742 | { |
||
| 743 | $this->departmentName = $departmentName; |
||
| 744 | |||
| 745 | return $this; |
||
| 746 | } |
||
| 747 | |||
| 748 | public function getDepartmentUrl(): ?string |
||
| 749 | { |
||
| 750 | return $this->departmentUrl; |
||
| 751 | } |
||
| 752 | |||
| 753 | public function setDepartmentUrl(string $departmentUrl): self |
||
| 754 | { |
||
| 755 | $this->departmentUrl = $departmentUrl; |
||
| 756 | |||
| 757 | return $this; |
||
| 758 | } |
||
| 759 | |||
| 760 | public function getDiskQuota(): ?int |
||
| 761 | { |
||
| 762 | return $this->diskQuota; |
||
| 763 | } |
||
| 764 | |||
| 765 | public function setDiskQuota(int $diskQuota): self |
||
| 766 | { |
||
| 767 | $this->diskQuota = $diskQuota; |
||
| 768 | |||
| 769 | return $this; |
||
| 770 | } |
||
| 771 | |||
| 772 | public function getLastVisit(): ?DateTime |
||
| 773 | { |
||
| 774 | return $this->lastVisit; |
||
| 775 | } |
||
| 776 | |||
| 777 | public function setLastVisit(DateTime $lastVisit): self |
||
| 778 | { |
||
| 779 | $this->lastVisit = $lastVisit; |
||
| 780 | |||
| 781 | return $this; |
||
| 782 | } |
||
| 783 | |||
| 784 | public function getLastEdit(): ?DateTime |
||
| 785 | { |
||
| 786 | return $this->lastEdit; |
||
| 787 | } |
||
| 788 | |||
| 789 | public function setLastEdit(DateTime $lastEdit): self |
||
| 790 | { |
||
| 791 | $this->lastEdit = $lastEdit; |
||
| 792 | |||
| 793 | return $this; |
||
| 794 | } |
||
| 795 | |||
| 796 | public function getCreationDate(): DateTime |
||
| 797 | { |
||
| 798 | return $this->creationDate; |
||
| 799 | } |
||
| 800 | |||
| 801 | public function setCreationDate(DateTime $creationDate): self |
||
| 802 | { |
||
| 803 | $this->creationDate = $creationDate; |
||
| 804 | |||
| 805 | return $this; |
||
| 806 | } |
||
| 807 | |||
| 808 | public function getExpirationDate(): ?DateTime |
||
| 809 | { |
||
| 810 | return $this->expirationDate; |
||
| 811 | } |
||
| 812 | |||
| 813 | public function setExpirationDate(DateTime $expirationDate): self |
||
| 814 | { |
||
| 815 | $this->expirationDate = $expirationDate; |
||
| 816 | |||
| 817 | return $this; |
||
| 818 | } |
||
| 819 | |||
| 820 | public function getSubscribe(): bool |
||
| 821 | { |
||
| 822 | return $this->subscribe; |
||
| 823 | } |
||
| 824 | |||
| 825 | public function setSubscribe(bool $subscribe): self |
||
| 826 | { |
||
| 827 | $this->subscribe = $subscribe; |
||
| 828 | |||
| 829 | return $this; |
||
| 830 | } |
||
| 831 | |||
| 832 | public function getUnsubscribe(): bool |
||
| 833 | { |
||
| 834 | return $this->unsubscribe; |
||
| 835 | } |
||
| 836 | |||
| 837 | public function setUnsubscribe(bool $unsubscribe): self |
||
| 838 | { |
||
| 839 | $this->unsubscribe = $unsubscribe; |
||
| 840 | |||
| 841 | return $this; |
||
| 842 | } |
||
| 843 | |||
| 844 | public function getRegistrationCode(): ?string |
||
| 845 | { |
||
| 846 | return $this->registrationCode; |
||
| 847 | } |
||
| 848 | |||
| 849 | public function setRegistrationCode(string $registrationCode): self |
||
| 850 | { |
||
| 851 | $this->registrationCode = $registrationCode; |
||
| 852 | |||
| 853 | return $this; |
||
| 854 | } |
||
| 855 | |||
| 856 | public function getLegal(): ?string |
||
| 857 | { |
||
| 858 | return $this->legal; |
||
| 859 | } |
||
| 860 | |||
| 861 | public function setLegal(string $legal): self |
||
| 862 | { |
||
| 863 | $this->legal = $legal; |
||
| 864 | |||
| 865 | return $this; |
||
| 866 | } |
||
| 867 | |||
| 868 | public function getActivateLegal(): ?int |
||
| 869 | { |
||
| 870 | return $this->activateLegal; |
||
| 871 | } |
||
| 872 | |||
| 873 | public function setActivateLegal(int $activateLegal): self |
||
| 874 | { |
||
| 875 | $this->activateLegal = $activateLegal; |
||
| 876 | |||
| 877 | return $this; |
||
| 878 | } |
||
| 879 | |||
| 880 | public function isAddTeachersToSessionsCourses(): ?bool |
||
| 881 | { |
||
| 882 | return $this->addTeachersToSessionsCourses; |
||
| 883 | } |
||
| 884 | |||
| 885 | public function setAddTeachersToSessionsCourses(bool $addTeachersToSessionsCourses): self |
||
| 886 | { |
||
| 887 | $this->addTeachersToSessionsCourses = $addTeachersToSessionsCourses; |
||
| 888 | |||
| 889 | return $this; |
||
| 890 | } |
||
| 891 | |||
| 892 | public function getCourseTypeId(): ?int |
||
| 893 | { |
||
| 894 | return $this->courseTypeId; |
||
| 895 | } |
||
| 896 | |||
| 897 | public function setCourseTypeId(int $courseTypeId): self |
||
| 898 | { |
||
| 899 | $this->courseTypeId = $courseTypeId; |
||
| 900 | |||
| 901 | return $this; |
||
| 902 | } |
||
| 903 | |||
| 904 | public function getRoom(): ?Room |
||
| 905 | { |
||
| 906 | return $this->room; |
||
| 907 | } |
||
| 908 | |||
| 909 | public function setRoom(Room $room): self |
||
| 910 | { |
||
| 911 | $this->room = $room; |
||
| 912 | |||
| 913 | return $this; |
||
| 914 | } |
||
| 915 | |||
| 916 | public function isActive(): bool |
||
| 917 | { |
||
| 918 | $activeVisibilityList = [self::REGISTERED, self::OPEN_PLATFORM, self::OPEN_WORLD]; |
||
| 919 | |||
| 920 | return \in_array($this->visibility, $activeVisibilityList, true); |
||
| 921 | } |
||
| 922 | |||
| 923 | /** |
||
| 924 | * Anybody can see this course. |
||
| 925 | */ |
||
| 926 | public function isPublic(): bool |
||
| 927 | { |
||
| 928 | return self::OPEN_WORLD === $this->visibility; |
||
| 929 | } |
||
| 930 | |||
| 931 | public function isHidden(): bool |
||
| 932 | { |
||
| 933 | return self::HIDDEN === $this->visibility; |
||
| 934 | } |
||
| 935 | |||
| 936 | public function getCurrentSession(): Session |
||
| 937 | { |
||
| 938 | return $this->currentSession; |
||
| 939 | } |
||
| 940 | |||
| 941 | public function setCurrentSession(Session $session): self |
||
| 942 | { |
||
| 943 | // If the session is registered in the course session list. |
||
| 944 | /*if ($this->getSessions()->contains($session->getId())) { |
||
| 945 | $this->currentSession = $session; |
||
| 946 | }*/ |
||
| 947 | $list = $this->getSessions(); |
||
| 948 | |||
| 949 | /** @var SessionRelCourse $item */ |
||
| 950 | foreach ($list as $item) { |
||
| 951 | if ($item->getSession()->getId() === $session->getId()) { |
||
| 952 | $this->currentSession = $session; |
||
| 953 | |||
| 954 | break; |
||
| 955 | } |
||
| 956 | } |
||
| 957 | |||
| 958 | return $this; |
||
| 959 | } |
||
| 960 | |||
| 961 | /** |
||
| 962 | * @return Collection<int, SessionRelCourse> |
||
| 963 | */ |
||
| 964 | public function getSessions(): Collection |
||
| 965 | { |
||
| 966 | return $this->sessions; |
||
| 967 | } |
||
| 968 | |||
| 969 | public function getCurrentUrl(): AccessUrl |
||
| 970 | { |
||
| 971 | return $this->currentUrl; |
||
| 972 | } |
||
| 973 | |||
| 974 | public function setCurrentUrl(AccessUrl $url): self |
||
| 975 | { |
||
| 976 | $urlList = $this->getUrls(); |
||
| 977 | |||
| 978 | /** @var AccessUrlRelCourse $item */ |
||
| 979 | foreach ($urlList as $item) { |
||
| 980 | if ($item->getUrl()->getId() === $url->getId()) { |
||
| 981 | $this->currentUrl = $url; |
||
| 982 | |||
| 983 | break; |
||
| 984 | } |
||
| 985 | } |
||
| 986 | |||
| 987 | return $this; |
||
| 988 | } |
||
| 989 | |||
| 990 | public function getUrls(): Collection |
||
| 993 | } |
||
| 994 | |||
| 995 | public function addUrls(AccessUrlRelCourse $urlRelCourse): static |
||
| 996 | { |
||
| 997 | if (!$this->urls->contains($urlRelCourse)) { |
||
| 998 | $this->urls->add($urlRelCourse); |
||
| 999 | $urlRelCourse->setCourse($this); |
||
| 1000 | } |
||
| 1001 | |||
| 1002 | return $this; |
||
| 1003 | } |
||
| 1004 | |||
| 1005 | public function addAccessUrl(?AccessUrl $url): self |
||
| 1006 | { |
||
| 1007 | $urlRelCourse = (new AccessUrlRelCourse())->setUrl($url); |
||
| 1008 | $this->addUrls($urlRelCourse); |
||
| 1009 | |||
| 1010 | return $this; |
||
| 1011 | } |
||
| 1012 | |||
| 1013 | /** |
||
| 1014 | * @return Collection<int, SkillRelUser> |
||
| 1015 | */ |
||
| 1016 | public function getIssuedSkills(): Collection |
||
| 1017 | { |
||
| 1018 | return $this->issuedSkills; |
||
| 1019 | } |
||
| 1020 | |||
| 1021 | /** |
||
| 1022 | * @return Collection<int, SessionRelCourseRelUser> |
||
| 1023 | */ |
||
| 1024 | public function getSessionRelCourseRelUsers(): Collection |
||
| 1025 | { |
||
| 1026 | return $this->sessionRelCourseRelUsers; |
||
| 1027 | } |
||
| 1028 | |||
| 1029 | public function setSessionRelCourseRelUsers(Collection $sessionUserSubscriptions): self |
||
| 1030 | { |
||
| 1031 | $this->sessionRelCourseRelUsers = $sessionUserSubscriptions; |
||
| 1032 | |||
| 1033 | return $this; |
||
| 1034 | } |
||
| 1035 | |||
| 1036 | /** |
||
| 1037 | * @return Collection<int, SkillRelCourse> |
||
| 1038 | */ |
||
| 1039 | public function getSkills(): Collection |
||
| 1040 | { |
||
| 1041 | return $this->skills; |
||
| 1042 | } |
||
| 1043 | |||
| 1044 | public function setSkills(Collection $skills): self |
||
| 1045 | { |
||
| 1046 | $this->skills = $skills; |
||
| 1047 | |||
| 1048 | return $this; |
||
| 1049 | } |
||
| 1050 | |||
| 1051 | /** |
||
| 1052 | * @return Collection<int, GradebookCategory> |
||
| 1053 | */ |
||
| 1054 | public function getGradebookCategories(): Collection |
||
| 1055 | { |
||
| 1056 | return $this->gradebookCategories; |
||
| 1057 | } |
||
| 1058 | |||
| 1059 | public function setGradebookCategories(Collection $gradebookCategories): self |
||
| 1060 | { |
||
| 1061 | $this->gradebookCategories = $gradebookCategories; |
||
| 1062 | |||
| 1063 | return $this; |
||
| 1064 | } |
||
| 1065 | |||
| 1066 | /** |
||
| 1067 | * @return Collection<int, GradebookEvaluation> |
||
| 1068 | */ |
||
| 1069 | public function getGradebookEvaluations(): Collection |
||
| 1070 | { |
||
| 1071 | return $this->gradebookEvaluations; |
||
| 1072 | } |
||
| 1073 | |||
| 1074 | public function setGradebookEvaluations(Collection $gradebookEvaluations): self |
||
| 1075 | { |
||
| 1076 | $this->gradebookEvaluations = $gradebookEvaluations; |
||
| 1077 | |||
| 1078 | return $this; |
||
| 1079 | } |
||
| 1080 | |||
| 1081 | /** |
||
| 1082 | * @return Collection<int, GradebookLink> |
||
| 1083 | */ |
||
| 1084 | public function getGradebookLinks(): Collection |
||
| 1085 | { |
||
| 1086 | return $this->gradebookLinks; |
||
| 1087 | } |
||
| 1088 | |||
| 1089 | public function setGradebookLinks(Collection $gradebookLinks): self |
||
| 1094 | } |
||
| 1095 | |||
| 1096 | /** |
||
| 1097 | * @return Collection<int, TrackEHotspot> |
||
| 1098 | */ |
||
| 1099 | public function getTrackEHotspots(): Collection |
||
| 1100 | { |
||
| 1101 | return $this->trackEHotspots; |
||
| 1102 | } |
||
| 1103 | |||
| 1104 | public function setTrackEHotspots(Collection $trackEHotspots): self |
||
| 1105 | { |
||
| 1106 | $this->trackEHotspots = $trackEHotspots; |
||
| 1107 | |||
| 1108 | return $this; |
||
| 1109 | } |
||
| 1110 | |||
| 1111 | /** |
||
| 1112 | * @return Collection<int, SearchEngineRef> |
||
| 1113 | */ |
||
| 1114 | public function getSearchEngineRefs(): Collection |
||
| 1115 | { |
||
| 1116 | return $this->searchEngineRefs; |
||
| 1117 | } |
||
| 1118 | |||
| 1119 | public function setSearchEngineRefs(Collection $searchEngineRefs): self |
||
| 1120 | { |
||
| 1121 | $this->searchEngineRefs = $searchEngineRefs; |
||
| 1122 | |||
| 1123 | return $this; |
||
| 1124 | } |
||
| 1125 | |||
| 1126 | public function getIntroduction(): ?string |
||
| 1127 | { |
||
| 1128 | return $this->introduction; |
||
| 1129 | } |
||
| 1130 | |||
| 1131 | public function setIntroduction(?string $introduction): self |
||
| 1132 | { |
||
| 1133 | $this->introduction = $introduction; |
||
| 1134 | |||
| 1135 | return $this; |
||
| 1136 | } |
||
| 1137 | |||
| 1138 | /** |
||
| 1139 | * @return Collection<int, Templates> |
||
| 1140 | */ |
||
| 1141 | public function getTemplates(): Collection |
||
| 1142 | { |
||
| 1143 | return $this->templates; |
||
| 1144 | } |
||
| 1145 | |||
| 1146 | public function setTemplates(Collection $templates): self |
||
| 1147 | { |
||
| 1148 | $this->templates = $templates; |
||
| 1149 | |||
| 1150 | return $this; |
||
| 1151 | } |
||
| 1152 | |||
| 1153 | public function getVideoUrl(): string |
||
| 1154 | { |
||
| 1155 | return $this->videoUrl; |
||
| 1156 | } |
||
| 1157 | |||
| 1158 | public function setVideoUrl(string $videoUrl): self |
||
| 1163 | } |
||
| 1164 | |||
| 1165 | public function isSticky(): bool |
||
| 1166 | { |
||
| 1167 | return $this->sticky; |
||
| 1168 | } |
||
| 1169 | |||
| 1170 | public function setSticky(bool $sticky): self |
||
| 1171 | { |
||
| 1172 | $this->sticky = $sticky; |
||
| 1173 | |||
| 1174 | return $this; |
||
| 1175 | } |
||
| 1176 | |||
| 1177 | public function getDefaultIllustration(int $size): string |
||
| 1180 | } |
||
| 1181 | |||
| 1182 | public function getDuration(): ?int |
||
| 1183 | { |
||
| 1184 | return $this->duration; |
||
| 1185 | } |
||
| 1186 | |||
| 1187 | public function setDuration(?int $duration): self |
||
| 1188 | { |
||
| 1189 | $this->duration = $duration; |
||
| 1190 | |||
| 1191 | return $this; |
||
| 1192 | } |
||
| 1193 | |||
| 1194 | public function getResourceIdentifier(): int |
||
| 1195 | { |
||
| 1196 | return $this->getId(); |
||
| 1197 | } |
||
| 1198 | |||
| 1199 | public function getResourceName(): string |
||
| 1202 | } |
||
| 1203 | |||
| 1204 | public function setResourceName(string $name): self |
||
| 1205 | { |
||
| 1206 | return $this->setCode($name); |
||
| 1207 | } |
||
| 1208 | } |
||
| 1209 |