Passed
Pull Request — master (#600)
by Mathias
13:24
created

Organization::setIsFeaturedCompany()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @copyright https://yawik.org/COPYRIGHT.php
6
 * @license       MIT
7
 */
8
9
namespace Organizations\Entity;
10
11
use Auth\Entity\UserInterface;
12
use Core\Entity\AbstractIdentifiableModificationDateAwareEntity as BaseEntity;
13
use Core\Entity\Collection\ArrayCollection;
14
use Core\Entity\DraftableEntityInterface;
15
use Core\Entity\EntityInterface;
16
use Core\Entity\Hydrator\EntityHydrator;
17
use Core\Entity\ImageSet;
18
use Core\Entity\MetaDataProviderTrait;
19
use Core\Entity\Permissions;
20
use Core\Entity\PermissionsInterface;
21
use Doctrine\Common\Collections\Collection;
22
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
23
use Laminas\Hydrator\HydratorInterface;
24
use Laminas\Permissions\Acl\Resource\ResourceInterface;
25
26
/**
27
 * The organization.
28
 *
29
 * @ODM\Document(collection="organizations", repositoryClass="Organizations\Repository\Organization")
30
 * @ODM\HasLifecycleCallbacks
31
 * @ODM\Indexes({
32
 *      @ODM\Index(keys={
33
 *          "_organizationName"="text"
34
 *      }, name="fulltext")
35
 * })
36
 *
37
 * @todo   write test
38
 * @author Mathias Weitz <[email protected]>
39
 * @author Mathias Gelhausen <[email protected]>
40
 * @author Anthonius Munthi <[email protected]>
41
 */
42
class Organization extends BaseEntity implements
43
    OrganizationInterface,
44
    DraftableEntityInterface,
45
    ResourceInterface
46
{
47
    use MetaDataProviderTrait;
48
49
    /**
50
     * Always enabled even if there are no active jobs
51
     */
52
    const PROFILE_ALWAYS_ENABLE     = 'always';
53
54
    /**
55
     * Hide if there are no jobs available
56
     */
57
    const PROFILE_ACTIVE_JOBS       = 'active-jobs';
58
59
    /**
60
     * Always disabled profile
61
     */
62
    const PROFILE_DISABLED          = 'disabled';
63
64
    /**
65
     * Event name of post construct event.
66
     *
67
     * @var string
68
     */
69
    const postConstruct = 'postRepositoryConstruct';
70
71
    /**
72
     * externalId. Allows external applications to reference their primary key.
73
     *
74
     * @var string
75
     * @ODM\Field(type="string")
76
     * @ODM\Index
77
     */
78
    protected $externalId;
79
80
    /**
81
     * The actual name of the organization.
82
     *
83
     * @var \Organizations\Entity\OrganizationName
84
     * @ODM\ReferenceOne(targetDocument="\Organizations\Entity\OrganizationName", storeAs="id", cascade="persist")
85
     */
86
    protected $organizationName;
87
88
    /**
89
     * Only for sorting/searching purposes
90
     *
91
     * @var string
92
     * @ODM\Field(type="string")
93
     */
94
    protected $_organizationName;
95
96
    /**
97
     * Assigned permissions.
98
     *
99
     * @var PermissionsInterface
100
     * @ODM\EmbedOne(targetDocument="\Core\Entity\Permissions")
101
     */
102
    protected $permissions;
103
104
    /**
105
     * primary logo of an organization
106
     *
107
     * @var \Organizations\Entity\OrganizationImage
108
     * @ODM\ReferenceOne(targetDocument="\Organizations\Entity\OrganizationImage", inversedBy="organization", storeAs="id", nullable="true", cascade={"all"})
109
     */
110
    protected $image;
111
112
    /**
113
     *
114
     *
115
     * @ODM\EmbedOne(targetDocument="\Core\Entity\ImageSet")
116
     * @var ImageSet
117
     */
118
    protected $images;
119
120
    /**
121
     * Flag indicating draft state of this job.
122
     *
123
     * @var bool
124
     * @ODM\Field(type="boolean")
125
     */
126
    protected $isDraft = false;
127
128
    /**
129
     * Organization contact data.
130
     *
131
     * @ODM\EmbedOne(targetDocument="\Organizations\Entity\OrganizationContact")
132
     */
133
    protected $contact;
134
135
    /**
136
     * The organizations' description.
137
     *
138
     * @var string
139
     * @ODM\Field(type="string")
140
     */
141
    protected $description;
142
143
    /**
144
     * The parent of this organization.
145
     *
146
     * @see   setParent()
147
     * @var OrganizationInterface | null
148
     * @ODM\ReferenceOne(targetDocument="\Organizations\Entity\Organization", storeAs="id", nullable=true)
149
     * @since 0.18
150
     */
151
    protected $parent;
152
153
    /**
154
     * The hiring organizations of this organization.
155
     *
156
     * @var Collection
157
     * @ODM\ReferenceMany(
158
     *      targetDocument="Organizations\Entity\Organization",
159
     *      repositoryMethod="getHiringOrganizationsCursor"
160
     * )
161
     * @since 0.18
162
     */
163
    protected $hiringOrganizations;
164
165
    /**
166
     * The associated employees (users)
167
     *
168
     * @ODM\EmbedMany(targetDocument="\Organizations\Entity\Employee")
169
     * @var Collection
170
     */
171
    protected $employees;
172
173
    /**
174
     * Jobs of this organization.
175
     *
176
     * @var Collection
177
     * @ODM\ReferenceMany(targetDocument="\Jobs\Entity\Job", storeAs="id", mappedBy="organization")
178
     * @since 0.18
179
     */
180
    protected $jobs;
181
182
    /**
183
     * the owner of a Organization
184
     *
185
     * @var UserInterface $user
186
     * @ODM\ReferenceOne(targetDocument="\Auth\Entity\User", storeAs="id")
187
     * @ODM\Index
188
     */
189
    protected $user;
190
191
    /**
192
     * Default values of an organizations job template
193
     *
194
     * @var TemplateInterface;
195
     * @ODM\EmbedOne(targetDocument="\Organizations\Entity\Template")
196
     */
197
    protected $template;
198
199
    /**
200
     * Default values Workflow
201
     *
202
     * @var WorkflowSettingsInterface $workflowSettings ;
203
     * @ODM\EmbedOne(targetDocument="\Organizations\Entity\WorkflowSettings")
204
     */
205
    protected $workflowSettings;
206
207
    /**
208
     * Profile Setting
209
     * @var string
210
     * @ODM\Field(type="string", nullable=true)
211
     */
212
    protected $profileSetting;
213
214
    /**
215
     * @ODM\Field(type="bool")
216
     * @var bool
217 1
     */
218
    protected $isFeaturedCompany = false;
219 1
220
221
    /**
222
     * @return string
223
     */
224
    public function getProfileSetting()
225
    {
226
        return $this->profileSetting;
227 1
    }
228
229 1
    /**
230
     * @param string $profileSetting
231 1
     *
232
     * @return $this
233
     */
234
    public function setProfileSetting($profileSetting)
235
    {
236
        $this->profileSetting = $profileSetting;
237
238
        return $this;
239
    }
240
241
    /**
242
     * Returns the string identifier of the Resource
243
     *
244
     * @return string
245
     */
246
    public function getResourceId()
247
    {
248
        return 'Entity/Organization';
249 2
    }
250
251 2
    /**
252 1
     * Gets the organization name
253
     *
254
     * @return string
255 1
     */
256
    public function getName()
257
    {
258
        if (empty($this->organizationName)) {
259
            return '';
260
        }
261
262
        return $this->organizationName->getName();
263
    }
264
265 2
    /**
266
     * Sets the parent of an organization
267 2
     *
268
     * @param OrganizationInterface $parent
269 2
     *
270
     * @return $this
271
     */
272
    public function setParent(OrganizationInterface $parent)
273
    {
274
        $this->parent = $parent;
275
276
        return $this;
277
    }
278
279
    /**
280
     * @deprecated
281
     * @return array
282
     */
283
    public function getSearchableProperties()
284
    {
285
        return array();
286
    }
287
288 1
    /**
289
     * Gets the parent of an organization
290 1
     *
291
     * @param bool $returnSelf returns itself, if this organization does not have a parent?
292
     *
293
     * @return null|OrganizationInterface
294
     */
295
    public function getParent($returnSelf = false)
296
    {
297
        return $this->parent ? : ($returnSelf ? $this : null);
298 1
    }
299
300 1
    /**
301
     * Gets the Draft flag
302
     *
303
     * @return bool
304
     */
305
    public function isDraft()
306
    {
307
        return $this->isDraft;
308 1
    }
309
310 1
    /**
311
     * Gets linked organizations
312
     *
313
     * @return Collection
314
     */
315
    public function getHiringOrganizations()
316
    {
317
        return $this->hiringOrganizations;
318
    }
319
320 1
    /**
321
     * Sets the draft flag
322 1
     *
323
     * @param bool $flag
324 1
     *
325
     * @return $this
326
     */
327
    public function setIsDraft($flag)
328
    {
329
        $this->isDraft = (bool) $flag;
330 5
331
        return $this;
332 5
    }
333
334
    /**
335
     * @return bool
336
     */
337
    public function isHiringOrganization()
338
    {
339
        return null !== $this->parent;
340
    }
341
342
    /**
343
     * Returns true, if the user belongs to the organization.
344
     *
345
     * @param UserInterface $user
346
     *
347
     * @return bool
348
     */
349
    public function isAssociated(UserInterface $user)
350
    {
351
        return $this->isOwner($user) || $this->isEmployee($user);
352
    }
353
354 1
    /**
355
     * Sets the external id.
356 1
     *
357
     * @param $externalId
358 1
     *
359
     * @return self
360
     */
361
    public function setExternalId($externalId)
362
    {
363
        $this->externalId = $externalId;
364
365
        return $this;
366
    }
367
368
    /**
369
     * Checks, if a User is the owner of an organization
370
     *
371
     * @param UserInterface $user
372
     *
373
     * @return bool
374
     */
375
    public function isOwner(UserInterface $user)
376
    {
377
        return $this->getUser()->getId() == $user->getId();
378 1
    }
379
380 1
    /**
381
     * Gets the internal id.
382
     *
383
     * @return string
384
     */
385
    public function getExternalId()
386
    {
387
        return $this->externalId;
388
    }
389
390
    /**
391
     * Returns true, if a User is an employee of the organization
392
     *
393
     * @param UserInterface $user
394
     *
395
     * @return bool
396
     */
397
    public function isEmployee(UserInterface $user)
398
    {
399
        return $this->refs && in_array($user->getId(), $this->refs->getEmployeeIds());
0 ignored issues
show
Bug Best Practice introduced by
The property refs does not exist on Organizations\Entity\Organization. Since you implemented __get, consider adding a @property annotation.
Loading history...
400
    }
401
402
    /**
403
     * @todo review this
404
     *
405
     * @param HydratorInterface $hydrator
406
     *
407
     * @return $this
408
     */
409
    public function setHydrator(HydratorInterface $hydrator)
410
    {
411
        return $this;
412
    }
413
414
    /**
415
     * Updates the organizationsPermissions to allow all employees to view this organization.
416
     *
417 1
     * In case of a HiringOrganization Permissions are granted to all employees of the parent
418
     * organization.
419 1
     *
420
     * @ODM\PreUpdate
421
     * @ODM\PrePersist
422
     * @since 0.18
423
     */
424
    public function updatePermissions()
425 1
    {
426
        if ($this->isHiringOrganization()) {
427
            $organization = $this->getParent();
428
            $owner        = $organization->getUser();
429 1
430
            $this->setUser($owner);
431 1
        } else {
432
            $organization = $this;
433 1
        }
434
435 1
        /* @var $employees null | ArrayCollection | \Doctrine\ODM\MongoDB\PersistentCollection */
436
        $employees = $organization->getEmployees();
437 1
438
        $perms = $this->getPermissions();
439
440
        foreach ($employees as $emp) {
441
            /* @var $emp \Organizations\Entity\Employee */
442
            $perms->grant($emp->getUser(), PermissionsInterface::PERMISSION_CHANGE, false);
0 ignored issues
show
Unused Code introduced by
The call to Core\Entity\PermissionsInterface::grant() has too many arguments starting with false. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

442
            $perms->/** @scrutinizer ignore-call */ 
443
                    grant($emp->getUser(), PermissionsInterface::PERMISSION_CHANGE, false);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
443
        }
444 1
        $perms->build();
0 ignored issues
show
Bug introduced by
The method build() does not exist on Core\Entity\PermissionsInterface. Since it exists in all sub-types, consider adding an abstract or default implementation to Core\Entity\PermissionsInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

444
        $perms->/** @scrutinizer ignore-call */ 
445
                build();
Loading history...
445
    }
446 1
447
    /**
448
     * * @todo review this
449
     * @return EntityHydrator
450
     */
451
    public function getHydrator()
452
    {
453
        return new EntityHydrator();
454
    }
455
456 4
    /**
457
     * Sets the name of an organization
458 4
     *
459 1
     * @param OrganizationName $organizationName
460
     *
461 4
     * @return $this
462 4
     */
463 4
    public function setOrganizationName(OrganizationName $organizationName)
464
    {
465 4
        if (isset($this->organizationName)) {
466
            $this->organizationName->refCounterDec()->refCompanyCounterDec();
467
        }
468
        $this->organizationName = $organizationName;
469
        $this->organizationName->refCounterInc()->refCompanyCounterInc();
470
        $this->_organizationName = $organizationName->getName();
471
472
        return $this;
473 2
    }
474
475 2
    /**
476
     * Gets the organization name entity of an organisation
477
     *
478
     * @return OrganizationName
479
     */
480
    public function getOrganizationName()
481
    {
482
        return $this->organizationName;
483 4
    }
484
485 4
    /**
486 2
     * Gets the Permissions of an organization
487 2
     *
488 2
     * @return PermissionsInterface
489
     */
490 2
    public function getPermissions()
491
    {
492
        if (!$this->permissions) {
493 4
            $permissions = new Permissions();
494
            if ($this->user) {
495
                $permissions->grant($this->user, Permissions::PERMISSION_ALL);
496
            }
497
            $this->setPermissions($permissions);
498
        }
499
500
        return $this->permissions;
501
    }
502
503 4
    /**
504
     * Sets the Permissions of an Organization
505
     *
506 4
     * @param PermissionsInterface $permissions
507 2
     *
508
     * @return $this
509 4
     */
510
    public function setPermissions(PermissionsInterface $permissions)
511 4
    {
512
        // Assure the user has always all rights.
513
        if ($this->user) {
514
            $permissions->grant($this->user, Permissions::PERMISSION_ALL);
515
        }
516
        $this->permissions = $permissions;
517
518
        return $this;
519 2
    }
520
521 2
    /**
522
     * Gets the Permissions Resource ID
523
     *
524
     * @return string
525
     */
526
    public function getPermissionsResourceId()
527
    {
528
        return 'organization:' . $this->getId();
529 2
    }
530
531
    /**
532 2
     * @param null $type
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $type is correct as it would always require null to be passed?
Loading history...
533 2
     *
534 1
     * @return array
535 2
     */
536
    public function getPermissionsUserIds($type = null)
537 2
    {
538 1
        // if we have a user, grant him full access to all associated permissions.
539
        $user = $this->getUser();
540
        $spec = $user
0 ignored issues
show
introduced by
$user is of type Auth\Entity\UserInterface, thus it always evaluated to true.
Loading history...
541 2
            ? $spec = array(PermissionsInterface::PERMISSION_ALL => array($this->getUser()->getId()))
0 ignored issues
show
Unused Code introduced by
The assignment to $spec is dead and can be removed.
Loading history...
542 2
            : array();
543 2
544
        if (null === $type || ('Job/Permissions' != $type && 'Application' != $type)) {
0 ignored issues
show
introduced by
The condition null === $type is always true.
Loading history...
545 1
            return $spec;
546 1
        }
547
548
        if ('Job/Permissions' == $type) {
549 2
            $change = EmployeePermissionsInterface::JOBS_CHANGE;
550
            $view   = EmployeePermissionsInterface::JOBS_VIEW;
551 2
        } else {
552
            $change = EmployeePermissionsInterface::APPLICATIONS_CHANGE;
553 2
            $view   = EmployeePermissionsInterface::APPLICATIONS_VIEW;
554
        }
555 1
556 1
        $employees = $this->isHiringOrganization()
557
            ? $this->getParent()->getEmployees()
558
            : $this->getEmployees();
559 1
560 1
        foreach ($employees as $emp) {
561 1
            /* @var $emp EmployeeInterface */
562 1
            if ($emp->isUnassigned()) {
563 1
                continue;
564
            }
565
566
            $perm = $emp->getPermissions();
567 2
            if ($perm->isAllowed($change)) {
568
                $spec[PermissionsInterface::PERMISSION_CHANGE][] = $emp->getUser()->getId();
569
            } elseif ($perm->isAllowed($view)) {
570
                $spec[PermissionsInterface::PERMISSION_VIEW][] = $emp->getUser()->getId();
571
            }
572
        }
573
574
        return $spec;
575
    }
576
577
    /**
578
     * Sets the logo of an organization
579
     *
580
     * @param OrganizationImage $image
581
     *
582
     * @return self
583
     * @deprecated since 0.29; use $this->getImages()->set()
584
     */
585
    public function setImage(OrganizationImage $image = null)
586
    {
587
        $this->image = $image;
588
589
        return $this;
590
    }
591
592
    /**
593
     * Gets the Logo of an organization
594
     *
595
     * @param string|bool $key Key of the image to get.
596
     *                         If true: get Thumbnail
597
     *                         If false: get Original
598
     *
599
     * @return OrganizationImage
600
     * @deprecated since 0.29; use $this->getImages()->get()
601
     * @since 0.29 modified to return images from the image set for compatibility reasons
602
     */
603
    public function getImage($key = ImageSet::ORIGINAL)
604
    {
605
        if (is_bool($key)) {
606
            $key = $key ? ImageSet::THUMBNAIL : ImageSet::ORIGINAL;
607
        }
608
609
        return $this->getImages()->get($key, false) ?: $this->image;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getImages(... false) ?: $this->image also could return the type Core\Entity\ImageInterface which includes types incompatible with the return type mandated by Organizations\Entity\Org...onInterface::getImage() of Organizations\Entity\OrganizationImage. Consider adding a type-check to rule them out.
Loading history...
610 2
    }
611
612 2
    /**
613
     * @param ImageSet $images
614 2
     *
615
     * @return self
616
     */
617
    public function setImages(ImageSet $images)
618
    {
619
        $this->images = $images;
620 3
621
        return $this;
622 3
    }
623 2
624
    /**
625
     * @return ImageSet
626 3
     */
627
    public function getImages()
628
    {
629
        if (!$this->images) {
630
            $this->images = new ImageSet();
631
        }
632
633
        return $this->images;
634 1
    }
635
636 1
    /**
637
     *
638 1
     *
639
     * @return self
640
     */
641
    public function removeImages()
642
    {
643
        $this->images = null;
644
645
        return $this;
646
    }
647
648 1
    /**
649
     * Sets the Contact Data of an organization
650 1
     *
651
     * @param EntityInterface $contact
652
     *
653 1
     * @return $this
654
     */
655 1
    public function setContact(EntityInterface $contact = null)
656
    {
657
        if (!$contact instanceof OrganizationContact) {
658
            $contact = new OrganizationContact($contact);
0 ignored issues
show
Unused Code introduced by
The call to Organizations\Entity\Org...nContact::__construct() has too many arguments starting with $contact. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

658
            $contact = /** @scrutinizer ignore-call */ new OrganizationContact($contact);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
659
        }
660
        $this->contact = $contact;
661
662
        return $this;
663 1
    }
664
665 1
    /**
666
     * Gets the contact Data of an organization
667
     *
668
     * @return OrganizationContact
669 1
     */
670
    public function getContact()
671
    {
672
        if (!$this->contact instanceof OrganizationContact) {
673
            $this->contact = new OrganizationContact();
674
        }
675
676
        return $this->contact;
677
    }
678
679
    /**
680 1
     * Gets the default description of an organization.
681
     *
682 1
     * This description is used as the default of the company_description
683
     * used in a job template
684
     *
685
     * @return string
686
     */
687
    public function getDescription()
688
    {
689
        return $this->description;
690
    }
691
692 1
    /**
693
     * Set the default description af an organization
694 1
     *
695
     * @param string $description
696 1
     *
697
     * @return $this
698
     */
699
    public function setDescription($description)
700
    {
701
        $this->description = $description;
702
703
        return $this;
704
    }
705
706 5
    /**
707
     * Sets the the list of employees
708
     *
709 5
     * @param Collection $employees
710 5
     *
711
     * @return $this
712
     */
713 5
    public function setEmployees(Collection $employees)
714
    {
715
        /* todo: Throw exception or at least log incidents, where employees are added to "hiring orgs" */
716
        if (!$this->isHiringOrganization()) {
717
            $this->employees = $employees;
718
        }
719
720
        return $this;
721 5
    }
722
723 5
    /**
724
     * Gets the list of employees
725 1
     *
726
     * @return ArrayCollection|Collection
727
     */
728 5
    public function getEmployees()
729 2
    {
730
        if ($this->isHiringOrganization()) {
731
            // Always return empty list, as we never have employees in this case.
732 5
            return new ArrayCollection();
733
        }
734
735
        if (!$this->employees) {
736
            $this->setEmployees(new ArrayCollection());
737
        }
738
739
        return $this->employees;
740
    }
741
742 1
    /**
743
     * Gets an employee by User or ID.
744 1
     *
745 1
     * @param UserInterface|string $userOrId
746
     *
747 1
     * @return mixed|null
748 1
     */
749 1
    public function getEmployee($userOrId)
750
    {
751
        $employees = $this->getEmployees();
752
        $userId    = $userOrId instanceof \Auth\Entity\UserInterface ? $userOrId->getId() : $userOrId;
753 1
754
        foreach ($employees as $employee) {
755
            if ($employee->getUser()->getId() == $userId) {
756
                return $employee;
757
            }
758
        }
759
760
        return null;
761
    }
762
763 1
    /**
764
     * Gets a list of Employees by a user role
765 1
     *
766
     * @param string $role
767
     *
768 1
     * @return ArrayCollection
769 1
     */
770 1
    public function getEmployeesByRole($role)
771
    {
772
        $employees = new ArrayCollection();
773
774 1
        /* @var \Organizations\Entity\Employee $employee */
775
        foreach ($this->getEmployees() as $employee) {
776
            if ($role === $employee->getRole()) {
777 2
                $employees->add($employee);
778
            }
779 2
        }
780
781
        return $employees;
782 2
    }
783 2
784
    public function setUser(UserInterface $user)
785 2
    {
786
        if ($this->user) {
787
            $this->getPermissions()->revoke($this->user, Permissions::PERMISSION_ALL, false);
0 ignored issues
show
Unused Code introduced by
The call to Core\Entity\PermissionsInterface::revoke() has too many arguments starting with false. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

787
            $this->getPermissions()->/** @scrutinizer ignore-call */ revoke($this->user, Permissions::PERMISSION_ALL, false);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
788
        }
789
        $this->user = $user;
790
        $this->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
791
792
        return $this;
793 3
    }
794
795 3
    /**
796
     * Gets the owner of the organization
797
     *
798
     * @return UserInterface
799
     */
800
    public function getUser()
801
    {
802
        return $this->user;
803 1
    }
804
805 1
    /**
806
     * Gets the Jobs of an organization
807
     *
808
     * @return Collection
809
     */
810
    public function getJobs()
811
    {
812
        return $this->jobs;
813 2
    }
814
815 2
    /**
816 1
     * Gets default values of an organizations job template
817
     *
818
     * @return TemplateInterface
819 2
     */
820
    public function getTemplate()
821
    {
822
        if (null === $this->template) {
823
            $this->template = new Template();
824
        }
825
826
        return $this->template;
827 1
    }
828
829 1
    /**
830
     * Sets default values of an organizations job template
831 1
     *
832
     * @return self
833
     */
834
    public function setTemplate(TemplateInterface $template)
835
    {
836
        $this->template = $template;
837
838
        return $this;
839 1
    }
840
841 1
    /**
842
     * Gets Workflow Settings
843
     *
844
     * @return WorkflowSettings|WorkflowSettingsInterface
845 1
     */
846
    public function getWorkflowSettings()
847
    {
848
        if (null == $this->workflowSettings) {
849
            $this->workflowSettings = new WorkflowSettings();
850
        }
851
852
        return $this->workflowSettings;
853
    }
854
855 1
    /**
856
     * Sets Workflow Settings
857 1
     *
858
     * @param $workflowSettings
859 1
     *
860
     * @return self
861
     */
862
    public function setWorkflowSettings($workflowSettings)
863
    {
864
        $this->workflowSettings = $workflowSettings;
865
866
        return $this;
867
    }
868
869
    /**
870
     * Get isFeaturedCompany
871
     *
872
     * @return bool
873
     */
874
    public function isFeaturedCompany(): bool
875
    {
876
        return $this->isFeaturedCompany;
877
    }
878
879
    /**
880
     * Set isFeaturedCompany
881
     *
882
     * @param bool $isFeaturedCompany
883
     */
884
    public function setIsFeaturedCompany(bool $isFeaturedCompany): void
885
    {
886
        $this->isFeaturedCompany = $isFeaturedCompany;
887
    }
888
}
889