Passed
Push — master ( b95980...a81919 )
by Julito
08:46
created

BranchSync::getSslPubKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Entity;
8
9
use DateTime;
10
use Doctrine\Common\Collections\Collection;
11
use Doctrine\ORM\Mapping as ORM;
12
use Gedmo\Mapping\Annotation as Gedmo;
13
14
/**
15
 * BranchSync.
16
 *
17
 * @ORM\Table(name="branch_sync")
18
 * @ORM\Entity(repositoryClass="Chamilo\CoreBundle\Repository\BranchSyncRepository")
19
 * @Gedmo\Tree(type="nested")
20
 */
21
class BranchSync
22
{
23
    /**
24
     * @ORM\Column(name="id", type="integer")
25
     * @ORM\Id
26
     * @ORM\GeneratedValue
27
     */
28
    protected int $id;
29
30
    /**
31
     * @ORM\ManyToOne(targetEntity="AccessUrl", cascade={"persist"})
32
     * @ORM\JoinColumn(name="access_url_id", referencedColumnName="id")
33
     */
34
    protected AccessUrl $url;
35
36
    /**
37
     * @ORM\Column(name="unique_id", type="string", length=50, nullable=false, unique=true)
38
     */
39
    protected string $uniqueId;
40
41
    /**
42
     * @ORM\Column(name="branch_name", type="string", length=250)
43
     */
44
    protected string $branchName;
45
46
    /**
47
     * @ORM\Column(name="description", type="text", nullable=true)
48
     */
49
    protected ?string $description;
50
51
    /**
52
     * @ORM\Column(name="branch_ip", type="string", length=40, nullable=true, unique=false)
53
     */
54
    protected ?string $branchIp;
55
56
    /**
57
     * @ORM\Column(name="latitude", type="decimal", nullable=true, unique=false)
58
     */
59
    protected ?float $latitude;
60
61
    /**
62
     * @ORM\Column(name="longitude", type="decimal", nullable=true, unique=false)
63
     */
64
    protected ?float $longitude;
65
66
    /**
67
     * @ORM\Column(name="dwn_speed", type="integer", nullable=true, unique=false)
68
     */
69
    protected ?int $dwnSpeed;
70
71
    /**
72
     * @ORM\Column(name="up_speed", type="integer", nullable=true, unique=false)
73
     */
74
    protected ?int $upSpeed;
75
76
    /**
77
     * @ORM\Column(name="delay", type="integer", nullable=true, unique=false)
78
     */
79
    protected ?int $delay;
80
81
    /**
82
     * @ORM\Column(name="admin_mail", type="string", length=250, nullable=true, unique=false)
83
     */
84
    protected ?string $adminMail;
85
86
    /**
87
     * @ORM\Column(name="admin_name", type="string", length=250, nullable=true, unique=false)
88
     */
89
    protected ?string $adminName;
90
91
    /**
92
     * @ORM\Column(name="admin_phone", type="string", length=250, nullable=true, unique=false)
93
     */
94
    protected ?string $adminPhone;
95
96
    /**
97
     * @ORM\Column(name="last_sync_trans_id", type="bigint", nullable=true, unique=false)
98
     */
99
    protected ?int $lastSyncTransId;
100
101
    /**
102
     * @ORM\Column(name="last_sync_trans_date", type="datetime", nullable=true, unique=false)
103
     */
104
    protected ?DateTime $lastSyncTransDate;
105
106
    /**
107
     * @ORM\Column(name="last_sync_type", type="string", length=20, nullable=true, unique=false)
108
     */
109
    protected ?string $lastSyncType;
110
111
    /**
112
     * @ORM\Column(name="ssl_pub_key", type="string", length=250, nullable=true, unique=false)
113
     */
114
    protected ?string $sslPubKey;
115
116
    /**
117
     * @ORM\Column(name="branch_type", type="string", length=250, nullable=true, unique=false)
118
     */
119
    protected ?string $branchType;
120
121
    /**
122
     * @Gedmo\TreeLeft
123
     * @ORM\Column(name="lft", type="integer", nullable=true, unique=false)
124
     */
125
    protected ?int $lft;
126
127
    /**
128
     * @Gedmo\TreeRight
129
     * @ORM\Column(name="rgt", type="integer", nullable=true, unique=false)
130
     */
131
    protected ?int $rgt;
132
133
    /**
134
     * @Gedmo\TreeLevel
135
     * @ORM\Column(name="lvl", type="integer", nullable=true, unique=false)
136
     */
137
    protected ?int $lvl;
138
139
    /**
140
     * @Gedmo\TreeRoot
141
     * @ORM\Column(name="root", type="integer", nullable=true, unique=false)
142
     */
143
    protected ?int $root;
144
145
    /**
146
     * @Gedmo\TreeParent
147
     * @ORM\ManyToOne(targetEntity="BranchSync", inversedBy="children")
148
     * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL")
149
     */
150
    protected ?BranchSync $parent = null;
151
152
    /**
153
     * @ORM\OneToMany(targetEntity="BranchSync", mappedBy="parent")
154
     * @ORM\OrderBy({"lft"="ASC"})
155
     *
156
     * @var BranchSync[]|Collection
157
     */
158
    protected $children;
159
160
    public function __construct()
161
    {
162
        $this->uniqueId = sha1(uniqid());
163
        $this->sslPubKey = sha1(uniqid());
164
        // $this->lastSyncTransDate = new \DateTime();
165
    }
166
167
    /**
168
     * Get id.
169
     *
170
     * @return int
171
     */
172
    public function getId()
173
    {
174
        return $this->id;
175
    }
176
177
    /**
178
     * Set branchName.
179
     *
180
     * @param string $branchName
181
     *
182
     * @return BranchSync
183
     */
184
    public function setBranchName($branchName)
185
    {
186
        $this->branchName = $branchName;
187
188
        return $this;
189
    }
190
191
    /**
192
     * Get branchName.
193
     *
194
     * @return string
195
     */
196
    public function getBranchName()
197
    {
198
        return $this->branchName;
199
    }
200
201
    /**
202
     * Set branchIp.
203
     *
204
     * @param string $branchIp
205
     *
206
     * @return BranchSync
207
     */
208
    public function setBranchIp($branchIp)
209
    {
210
        $this->branchIp = $branchIp;
211
212
        return $this;
213
    }
214
215
    /**
216
     * Get branchIp.
217
     *
218
     * @return string
219
     */
220
    public function getBranchIp()
221
    {
222
        return $this->branchIp;
223
    }
224
225
    /**
226
     * Set latitude.
227
     *
228
     * @param float $latitude
229
     *
230
     * @return BranchSync
231
     */
232
    public function setLatitude($latitude)
233
    {
234
        $this->latitude = $latitude;
235
236
        return $this;
237
    }
238
239
    /**
240
     * Get latitude.
241
     *
242
     * @return float
243
     */
244
    public function getLatitude()
245
    {
246
        return $this->latitude;
247
    }
248
249
    /**
250
     * Set longitude.
251
     *
252
     * @param float $longitude
253
     *
254
     * @return BranchSync
255
     */
256
    public function setLongitude($longitude)
257
    {
258
        $this->longitude = $longitude;
259
260
        return $this;
261
    }
262
263
    /**
264
     * Get longitude.
265
     *
266
     * @return float
267
     */
268
    public function getLongitude()
269
    {
270
        return $this->longitude;
271
    }
272
273
    /**
274
     * Set dwnSpeed.
275
     *
276
     * @param int $dwnSpeed
277
     *
278
     * @return BranchSync
279
     */
280
    public function setDwnSpeed($dwnSpeed)
281
    {
282
        $this->dwnSpeed = $dwnSpeed;
283
284
        return $this;
285
    }
286
287
    /**
288
     * Get dwnSpeed.
289
     *
290
     * @return int
291
     */
292
    public function getDwnSpeed()
293
    {
294
        return $this->dwnSpeed;
295
    }
296
297
    /**
298
     * Set upSpeed.
299
     *
300
     * @param int $upSpeed
301
     *
302
     * @return BranchSync
303
     */
304
    public function setUpSpeed($upSpeed)
305
    {
306
        $this->upSpeed = $upSpeed;
307
308
        return $this;
309
    }
310
311
    /**
312
     * Get upSpeed.
313
     *
314
     * @return int
315
     */
316
    public function getUpSpeed()
317
    {
318
        return $this->upSpeed;
319
    }
320
321
    /**
322
     * Set delay.
323
     *
324
     * @param int $delay
325
     *
326
     * @return BranchSync
327
     */
328
    public function setDelay($delay)
329
    {
330
        $this->delay = $delay;
331
332
        return $this;
333
    }
334
335
    /**
336
     * Get delay.
337
     *
338
     * @return int
339
     */
340
    public function getDelay()
341
    {
342
        return $this->delay;
343
    }
344
345
    /**
346
     * Set adminMail.
347
     *
348
     * @param string $adminMail
349
     *
350
     * @return BranchSync
351
     */
352
    public function setAdminMail($adminMail)
353
    {
354
        $this->adminMail = $adminMail;
355
356
        return $this;
357
    }
358
359
    /**
360
     * Get adminMail.
361
     *
362
     * @return string
363
     */
364
    public function getAdminMail()
365
    {
366
        return $this->adminMail;
367
    }
368
369
    /**
370
     * Set adminName.
371
     *
372
     * @param string $adminName
373
     *
374
     * @return BranchSync
375
     */
376
    public function setAdminName($adminName)
377
    {
378
        $this->adminName = $adminName;
379
380
        return $this;
381
    }
382
383
    /**
384
     * Get adminName.
385
     *
386
     * @return string
387
     */
388
    public function getAdminName()
389
    {
390
        return $this->adminName;
391
    }
392
393
    /**
394
     * Set adminPhone.
395
     *
396
     * @param string $adminPhone
397
     *
398
     * @return BranchSync
399
     */
400
    public function setAdminPhone($adminPhone)
401
    {
402
        $this->adminPhone = $adminPhone;
403
404
        return $this;
405
    }
406
407
    /**
408
     * Get adminPhone.
409
     *
410
     * @return string
411
     */
412
    public function getAdminPhone()
413
    {
414
        return $this->adminPhone;
415
    }
416
417
    /**
418
     * Set lastSyncTransId.
419
     *
420
     * @param int $lastSyncTransId
421
     *
422
     * @return BranchSync
423
     */
424
    public function setLastSyncTransId($lastSyncTransId)
425
    {
426
        $this->lastSyncTransId = $lastSyncTransId;
427
428
        return $this;
429
    }
430
431
    /**
432
     * Get lastSyncTransId.
433
     *
434
     * @return int
435
     */
436
    public function getLastSyncTransId()
437
    {
438
        return $this->lastSyncTransId;
439
    }
440
441
    /**
442
     * Set lastSyncTransDate.
443
     *
444
     * @param DateTime $lastSyncTransDate
445
     *
446
     * @return BranchSync
447
     */
448
    public function setLastSyncTransDate($lastSyncTransDate)
449
    {
450
        $this->lastSyncTransDate = $lastSyncTransDate;
451
452
        return $this;
453
    }
454
455
    /**
456
     * Set sslPubKey.
457
     *
458
     * @param string $sslPubKey
459
     *
460
     * @return BranchSync
461
     */
462
    public function setSslPubKey($sslPubKey)
463
    {
464
        $this->sslPubKey = $sslPubKey;
465
466
        return $this;
467
    }
468
469
    /**
470
     * Get sslPubKey.
471
     *
472
     * @return string
473
     */
474
    public function getSslPubKey()
475
    {
476
        return $this->sslPubKey;
477
    }
478
479
    /**
480
     * Set sslPubKey.
481
     *
482
     * @param string $branchType
483
     *
484
     * @return BranchSync
485
     */
486
    public function setBranchType($branchType)
487
    {
488
        $this->branchType = $branchType;
489
490
        return $this;
491
    }
492
493
    /**
494
     * Get sslPubKey.
495
     *
496
     * @return string
497
     */
498
    public function getBranchType()
499
    {
500
        return $this->branchType;
501
    }
502
503
    /**
504
     * Get lastSyncTransDate.
505
     *
506
     * @return DateTime
507
     */
508
    public function getLastSyncTransDate()
509
    {
510
        return $this->lastSyncTransDate;
511
    }
512
513
    /**
514
     * Set lastSyncType.
515
     *
516
     * @param string $lastSyncType
517
     *
518
     * @return BranchSync
519
     */
520
    public function setLastSyncType($lastSyncType)
521
    {
522
        $this->lastSyncType = $lastSyncType;
523
524
        return $this;
525
    }
526
527
    /**
528
     * Get lastSyncType.
529
     *
530
     * @return string
531
     */
532
    public function getLastSyncType()
533
    {
534
        return $this->lastSyncType;
535
    }
536
537
    /**
538
     * Set lft.
539
     *
540
     * @param int $lft
541
     *
542
     * @return BranchSync
543
     */
544
    public function setLft($lft)
545
    {
546
        $this->lft = $lft;
547
548
        return $this;
549
    }
550
551
    /**
552
     * Get lft.
553
     *
554
     * @return int
555
     */
556
    public function getLft()
557
    {
558
        return $this->lft;
559
    }
560
561
    /**
562
     * Set rgt.
563
     *
564
     * @param int $rgt
565
     *
566
     * @return BranchSync
567
     */
568
    public function setRgt($rgt)
569
    {
570
        $this->rgt = $rgt;
571
572
        return $this;
573
    }
574
575
    /**
576
     * Get rgt.
577
     *
578
     * @return int
579
     */
580
    public function getRgt()
581
    {
582
        return $this->rgt;
583
    }
584
585
    /**
586
     * Set lvl.
587
     *
588
     * @param int $lvl
589
     *
590
     * @return BranchSync
591
     */
592
    public function setLvl($lvl)
593
    {
594
        $this->lvl = $lvl;
595
596
        return $this;
597
    }
598
599
    /**
600
     * Get lvl.
601
     *
602
     * @return int
603
     */
604
    public function getLvl()
605
    {
606
        return $this->lvl;
607
    }
608
609
    /**
610
     * Set root.
611
     *
612
     * @param int $root
613
     *
614
     * @return BranchSync
615
     */
616
    public function setRoot($root)
617
    {
618
        $this->root = $root;
619
620
        return $this;
621
    }
622
623
    /**
624
     * Get root.
625
     *
626
     * @return int
627
     */
628
    public function getRoot()
629
    {
630
        return $this->root;
631
    }
632
633
    /**
634
     * @param BranchSync $parent
635
     */
636
    public function setParent(self $parent = null): self
637
    {
638
        $this->parent = $parent;
639
640
        return $this;
641
    }
642
643
    public function getParent()
644
    {
645
        return $this->parent;
646
    }
647
648
    /**
649
     * @return string
650
     */
651
    public function getUniqueId()
652
    {
653
        return $this->uniqueId;
654
    }
655
656
    /**
657
     * @param string $uniqueId
658
     *
659
     * @return $this
660
     */
661
    public function setUniqueId($uniqueId)
662
    {
663
        $this->uniqueId = $uniqueId;
664
665
        return $this;
666
    }
667
668
    /**
669
     * @return string
670
     */
671
    public function getDescription()
672
    {
673
        return $this->description;
674
    }
675
676
    /**
677
     * @param string $description
678
     */
679
    public function setDescription($description): self
680
    {
681
        $this->description = $description;
682
683
        return $this;
684
    }
685
686
    public function getUrl(): AccessUrl
687
    {
688
        return $this->url;
689
    }
690
691
    public function setUrl(AccessUrl $url): self
692
    {
693
        $this->url = $url;
694
695
        return $this;
696
    }
697
698
    /**
699
     * @return BranchSync[]|Collection
700
     */
701
    public function getChildren()
702
    {
703
        return $this->children;
704
    }
705
}
706