src/Entity/MatterRequest/MatterRequestDefaults.php line 34

Open in your IDE?
  1. <?php
  2. namespace MedBrief\MSR\Entity\MatterRequest;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use DH\Auditor\Provider\Doctrine\Auditing\Annotation as Audit;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use MedBrief\MSR\Entity\Account;
  8. use MedBrief\MSR\Entity\MatterRequest\Details\Sort;
  9. use MedBrief\MSR\Traits\FilterableClassConstantsTrait;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. /**
  13. * @ApiResource(
  14. * itemOperations={
  15. * "get"={"access_control"="is_granted('READ', object.getAccount())"}
  16. * },
  17. * collectionOperations={},
  18. * attributes={
  19. * "normalization_context"={"groups"={"account:read"}},
  20. * }
  21. * )
  22. *
  23. * @ORM\Table(name="MatterRequestDefaults")
  24. *
  25. * @ORM\Entity
  26. *
  27. * @Audit\Auditable
  28. *
  29. * @Audit\Security(view={"ROLE_ALLOWED_TO_AUDIT"})
  30. */
  31. class MatterRequestDefaults
  32. {
  33. use FilterableClassConstantsTrait;
  34. // forceOptionalFields Constants
  35. public const FORCE_OPTIONAL_FIELDS_CLAIM_CATEGORY = 'claimCategory';
  36. public const FORCE_OPTIONAL_FIELDS_CLAIM_CATEGORY__LABEL = 'Case Type';
  37. public const FORCE_OPTIONAL_FIELDS_KEY_ALLEGATIONS = 'keyAllegations';
  38. public const FORCE_OPTIONAL_FIELDS_KEY_ALLEGATIONS__LABEL = 'Key Allegations';
  39. public const FORCE_OPTIONAL_FIELDS_CLAIM_VALUE = 'claimValue';
  40. public const FORCE_OPTIONAL_FIELDS_CLAIM_VALUE__LABEL = 'Estimated Claim Value';
  41. public const FORCE_OPTIONAL_FIELDS_NEGLIGENCE_DATE = 'negligenceDate';
  42. public const FORCE_OPTIONAL_FIELDS_NEGLIGENCE_DATE__LABEL = 'Date of Alleged Negligence';
  43. public const FORCE_OPTIONAL_FIELDS_LIMITATION_DATE = 'limitationDate';
  44. public const FORCE_OPTIONAL_FIELDS_LIMITATION_DATE__LABEL = 'Limitation Date';
  45. public const FORCE_OPTIONAL_FIELDS_LIABILITY = 'liability';
  46. public const FORCE_OPTIONAL_FIELDS_LIABILITY__LABEL = 'Is liability admitted?';
  47. // forceCompulsoryFields Constants
  48. public const FORCE_COMPULSORY_FIELDS_BILLING_CODE = 'billingCode';
  49. public const FORCE_COMPULSORY_FIELDS_BILLING_CODE__LABEL = 'Billing Code';
  50. /**
  51. * @var int
  52. *
  53. * @Groups({"account:read", "matter_request:read"})
  54. *
  55. * @ORM\Column(name="id", type="integer")
  56. *
  57. * @ORM\Id
  58. *
  59. * @ORM\GeneratedValue(strategy="IDENTITY")
  60. */
  61. protected $id;
  62. /**
  63. * @var string
  64. *
  65. * @Groups({"account:read", "matter_request:read"})
  66. *
  67. * @ORM\Column(name="selectedServiceGroup", type="string", nullable=true)
  68. */
  69. protected $selectedServiceGroup;
  70. /**
  71. * @var string
  72. *
  73. * @Groups({"account:read", "matter_request:read"})
  74. *
  75. * @ORM\Column(name="requestingChoice", type="string", nullable=true)
  76. */
  77. protected $requestingChoice;
  78. /**
  79. * @var string
  80. *
  81. * @Groups({"account:read", "matter_request:read"})
  82. *
  83. * @ORM\Column(type="string", nullable=true)
  84. */
  85. protected ?string $firmReviewChoice;
  86. /**
  87. * @var string
  88. *
  89. * @Groups({"account:read", "matter_request:read"})
  90. *
  91. * @ORM\Column(name="reviewChoice", type="string", nullable=true)
  92. */
  93. protected $reviewChoice;
  94. /**
  95. * @var string
  96. *
  97. * @Groups({"account:read", "matter_request:read"})
  98. *
  99. * @ORM\Column(name="sortChoice", type="string", nullable=true)
  100. */
  101. protected $sortChoice;
  102. /**
  103. * @var string
  104. *
  105. * @Groups({"account:read", "matter_request:read"})
  106. *
  107. * @ORM\Column(name="chronologyChoice", type="string", nullable=true)
  108. *
  109. * @Assert\Expression(
  110. * "this.getReviewChoice() !== constant('MedBrief\\MSR\\Entity\\MatterRequest\\Details\\ServiceSelection::REVIEW_CHOICE_MEDBRIEF') or value !== constant('MedBrief\\MSR\\Entity\\MatterRequest\\Details\\ServiceSelection::CHRONOLOGY_CHOICE_YES_SUMMARY')",
  111. * message="Cannot select 'Clinical Summary (Sorted)' as default if MedBrief will already provide a clinical summary prior to sorting.",
  112. * groups={"account-matter-request-defaults"}
  113. * )
  114. */
  115. protected $chronologyChoice;
  116. /**
  117. * @var string
  118. *
  119. * @Groups({"account:read", "matter_request:read"})
  120. *
  121. * @ORM\Column(name="radiologyChoice", type="string", nullable=true)
  122. */
  123. protected $radiologyChoice;
  124. /**
  125. * @var string
  126. *
  127. * @Groups({"account:read", "matter_request:read"})
  128. *
  129. * @ORM\Column(name="extraService", type="string", nullable=true)
  130. */
  131. protected $extraService;
  132. /**
  133. * @var bool
  134. *
  135. * @Groups({"account:read", "matter_request:read"})
  136. *
  137. * @ORM\Column(name="destroyAll", type="boolean")
  138. */
  139. protected $destroyAll;
  140. /**
  141. * @var array
  142. *
  143. * @Groups({"account:read", "matter_request:read"})
  144. *
  145. * @ORM\Column(name="destroyOptions", type="array")
  146. */
  147. protected $destroyOptions = [];
  148. /**
  149. * @var array
  150. *
  151. * @Groups({"account:read", "matter_request:read"})
  152. *
  153. * @ORM\Column(name="returnOptions", type="array")
  154. */
  155. protected $returnOptions = [];
  156. /**
  157. * @var string
  158. *
  159. * @Groups({"account:read", "matter_request:read"})
  160. *
  161. * @ORM\Column(name="sortType", type="string")
  162. */
  163. protected $sortType;
  164. /**
  165. * @var string
  166. *
  167. * @Groups({"account:read", "matter_request:read"})
  168. *
  169. * @ORM\Column(name="centrePrefix", type="string")
  170. */
  171. protected $centrePrefix;
  172. /**
  173. * @var string
  174. *
  175. * @Groups({"account:read", "matter_request:read"})
  176. *
  177. * @ORM\Column(name="pagePrefix", type="string")
  178. */
  179. protected $pagePrefix;
  180. /**
  181. * @var string
  182. *
  183. * @Groups({"account:read", "matter_request:read"})
  184. *
  185. * @ORM\Column(name="paginationRun", type="string")
  186. */
  187. protected $paginationRun;
  188. /**
  189. * @var string
  190. *
  191. * @Groups({"account:read", "matter_request:read"})
  192. *
  193. * @ORM\Column(name="pageNumberPadding", type="string")
  194. */
  195. protected $pageNumberPadding;
  196. /**
  197. * @var \DateTimeImmutable
  198. *
  199. * @ORM\Column(name="created", type="datetime_immutable")
  200. *
  201. * @Gedmo\Timestampable(on="create")
  202. */
  203. protected $created;
  204. /**
  205. * @var \DateTime
  206. *
  207. * @ORM\Column(name="updated", type="datetime")
  208. *
  209. * @Gedmo\Timestampable(on="update")
  210. */
  211. protected $updated;
  212. /**
  213. * @var Account
  214. *
  215. * @ORM\OneToOne(targetEntity="MedBrief\MSR\Entity\Account", inversedBy="matterRequestDefaults")
  216. *
  217. * @ORM\JoinColumns({
  218. *
  219. * @ORM\JoinColumn(name="account_id", referencedColumnName="id", unique=true)
  220. * })
  221. */
  222. protected $account;
  223. /**
  224. * @var array
  225. *
  226. * @Groups({"account:read", "matter_request:read"})
  227. *
  228. * @ORM\Column(name="forceOptionalFields", type="array")
  229. */
  230. protected $forceOptionalFields = [];
  231. /**
  232. * @var array
  233. *
  234. * @Groups({"account:read", "matter_request:read"})
  235. *
  236. * @ORM\Column(name="forceCompulsoryFields", type="array")
  237. */
  238. protected $forceCompulsoryFields = [];
  239. /**
  240. * @var bool
  241. *
  242. * @Groups({"account:read", "matter_request:read"})
  243. *
  244. * @ORM\Column(name="matterActiveOnCreation", type="boolean", options={"default"=false})
  245. */
  246. protected $matterActiveOnCreation = false;
  247. /**
  248. * @var int
  249. *
  250. * @Groups({"account:read", "matter_request:read"})
  251. *
  252. * @ORM\Column(name="pageNumberPositionHorizontal", type="integer", options={"default"="3"})
  253. */
  254. protected $pageNumberPositionHorizontal = Sort::PAGE_NUMBER_POSITION_HORIZONTAL_RIGHT;
  255. /**
  256. * @var int
  257. *
  258. * @Groups({"account:read", "matter_request:read"})
  259. *
  260. * @ORM\Column(name="pageNumberPositionVertical", type="integer", options={"default"="2"})
  261. */
  262. protected $pageNumberPositionVertical = Sort::PAGE_NUMBER_POSITION_VERTICAL_BOTTOM;
  263. /**
  264. * @var int
  265. *
  266. * @Groups({"account:read", "matter_request:read"})
  267. *
  268. * @ORM\Column(name="pageNumberSize", type="integer", options={"default"="20"})
  269. */
  270. protected $pageNumberSize = Sort::PAGE_NUMBER_SIZE_20;
  271. /**
  272. * @var bool
  273. *
  274. * @Groups({"account:read", "matter_request:read"})
  275. *
  276. * @ORM\Column(name="pageNumberBackground", type="boolean", options={"default"=false})
  277. */
  278. protected $pageNumberBackground = Sort::PAGE_NUMBER_BACKGROUND_NO;
  279. /**
  280. * Constructor
  281. */
  282. public function __construct()
  283. {
  284. $this->destroyAll = true;
  285. $this->destroyOptions = [];
  286. $this->returnOptions = [];
  287. $this->sortType = Sort::SORT_TYPE_ADMISSION;
  288. $this->centrePrefix = Sort::CENTRE_PREFIX_ALPHA;
  289. $this->pagePrefix = Sort::PAGE_PREFIX_LETTER;
  290. $this->paginationRun = Sort::PAGINATION_CENTRE;
  291. $this->pageNumberPadding = Sort::PADDING_3;
  292. $this->pageNumberPositionHorizontal = Sort::PAGE_NUMBER_POSITION_HORIZONTAL_RIGHT;
  293. $this->pageNumberPositionVertical = Sort::PAGE_NUMBER_POSITION_VERTICAL_BOTTOM;
  294. $this->pageNumberSize = Sort::PAGE_NUMBER_SIZE_20;
  295. $this->pageNumberBackground = Sort::PAGE_NUMBER_BACKGROUND_NO;
  296. $this->forceOptionalFields = [];
  297. $this->forceCompulsoryFields = [];
  298. }
  299. /**
  300. * __toString
  301. *
  302. * @return string
  303. */
  304. public function __toString(): string
  305. {
  306. return (string) ($this->getId() ?? '');
  307. }
  308. /**
  309. * Get id.
  310. *
  311. * @return int
  312. */
  313. public function getId()
  314. {
  315. return $this->id;
  316. }
  317. /**
  318. * Set created.
  319. *
  320. * @param \DateTimeImmutable $created
  321. *
  322. * @return MatterRequestDefaults
  323. */
  324. public function setCreated($created)
  325. {
  326. $this->created = $created;
  327. return $this;
  328. }
  329. /**
  330. * Get created.
  331. *
  332. * @return \DateTimeImmutable
  333. */
  334. public function getCreated()
  335. {
  336. return $this->created;
  337. }
  338. /**
  339. * Set updated.
  340. *
  341. * @param \DateTime $updated
  342. *
  343. * @return MatterRequestDefaults
  344. */
  345. public function setUpdated($updated)
  346. {
  347. $this->updated = $updated;
  348. return $this;
  349. }
  350. /**
  351. * Get updated.
  352. *
  353. * @return \DateTime
  354. */
  355. public function getUpdated()
  356. {
  357. return $this->updated;
  358. }
  359. /**
  360. * Set selectedServiceGroup.
  361. *
  362. * @param string|null $selectedServiceGroup
  363. *
  364. * @return MatterRequestDefaults
  365. */
  366. public function setSelectedServiceGroup($selectedServiceGroup = null)
  367. {
  368. $this->selectedServiceGroup = $selectedServiceGroup;
  369. return $this;
  370. }
  371. /**
  372. * Get selectedServiceGroup.
  373. *
  374. * @return string|null
  375. */
  376. public function getSelectedServiceGroup()
  377. {
  378. return $this->selectedServiceGroup;
  379. }
  380. /**
  381. * Set requestingChoice.
  382. *
  383. * @param string|null $requestingChoice
  384. *
  385. * @return MatterRequestDefaults
  386. */
  387. public function setRequestingChoice($requestingChoice = null)
  388. {
  389. $this->requestingChoice = $requestingChoice;
  390. return $this;
  391. }
  392. /**
  393. * Get requestingChoice.
  394. *
  395. * @return string|null
  396. */
  397. public function getRequestingChoice()
  398. {
  399. return $this->requestingChoice;
  400. }
  401. /**
  402. * Set reviewChoice.
  403. *
  404. * @param string|null $reviewChoice
  405. *
  406. * @return MatterRequestDefaults
  407. */
  408. public function setReviewChoice($reviewChoice = null)
  409. {
  410. $this->reviewChoice = $reviewChoice;
  411. return $this;
  412. }
  413. /**
  414. * Get reviewChoice.
  415. *
  416. * @return string|null
  417. */
  418. public function getReviewChoice()
  419. {
  420. return $this->reviewChoice;
  421. }
  422. /**
  423. * Set sortChoice.
  424. *
  425. * @param string|null $sortChoice
  426. *
  427. * @return MatterRequestDefaults
  428. */
  429. public function setSortChoice($sortChoice = null)
  430. {
  431. $this->sortChoice = $sortChoice;
  432. return $this;
  433. }
  434. /**
  435. * Get sortChoice.
  436. *
  437. * @return string|null
  438. */
  439. public function getSortChoice()
  440. {
  441. return $this->sortChoice;
  442. }
  443. /**
  444. * Set chronologyChoice.
  445. *
  446. * @param string|null $chronologyChoice
  447. *
  448. * @return MatterRequestDefaults
  449. */
  450. public function setChronologyChoice($chronologyChoice = null)
  451. {
  452. $this->chronologyChoice = $chronologyChoice;
  453. return $this;
  454. }
  455. /**
  456. * Get chronologyChoice.
  457. *
  458. * @return string|null
  459. */
  460. public function getChronologyChoice()
  461. {
  462. return $this->chronologyChoice;
  463. }
  464. /**
  465. * Set extraService.
  466. *
  467. * @param string|null $extraService
  468. *
  469. * @return MatterRequestDefaults
  470. */
  471. public function setExtraService($extraService = null)
  472. {
  473. $this->extraService = $extraService;
  474. return $this;
  475. }
  476. /**
  477. * Get extraService.
  478. *
  479. * @return string|null
  480. */
  481. public function getExtraService()
  482. {
  483. return $this->extraService;
  484. }
  485. /**
  486. * Set destroyAll.
  487. *
  488. * @param bool $destroyAll
  489. *
  490. * @return MatterRequestDefaults
  491. */
  492. public function setDestroyAll($destroyAll)
  493. {
  494. $this->destroyAll = $destroyAll;
  495. return $this;
  496. }
  497. /**
  498. * Get destroyAll.
  499. *
  500. * @return bool
  501. */
  502. public function getDestroyAll()
  503. {
  504. return $this->destroyAll;
  505. }
  506. /**
  507. * Set destroyOptions.
  508. *
  509. * @param array $destroyOptions
  510. *
  511. * @return MatterRequestDefaults
  512. */
  513. public function setDestroyOptions($destroyOptions)
  514. {
  515. $this->destroyOptions = $destroyOptions;
  516. return $this;
  517. }
  518. /**
  519. * Get destroyOptions.
  520. *
  521. * @return array
  522. */
  523. public function getDestroyOptions()
  524. {
  525. return $this->destroyOptions;
  526. }
  527. /**
  528. * Set returnOptions.
  529. *
  530. * @param array $returnOptions
  531. *
  532. * @return MatterRequestDefaults
  533. */
  534. public function setReturnOptions($returnOptions)
  535. {
  536. $this->returnOptions = $returnOptions;
  537. return $this;
  538. }
  539. /**
  540. * Get returnOptions.
  541. *
  542. * @return array
  543. */
  544. public function getReturnOptions()
  545. {
  546. return $this->returnOptions;
  547. }
  548. /**
  549. * Set sortType.
  550. *
  551. * @param string $sortType
  552. *
  553. * @return MatterRequestDefaults
  554. */
  555. public function setSortType($sortType)
  556. {
  557. $this->sortType = $sortType;
  558. return $this;
  559. }
  560. /**
  561. * Get sortType.
  562. *
  563. * @return string
  564. */
  565. public function getSortType()
  566. {
  567. return $this->sortType;
  568. }
  569. /**
  570. * Set centrePrefix.
  571. *
  572. * @param string $centrePrefix
  573. *
  574. * @return MatterRequestDefaults
  575. */
  576. public function setCentrePrefix($centrePrefix)
  577. {
  578. $this->centrePrefix = $centrePrefix;
  579. return $this;
  580. }
  581. /**
  582. * Get centrePrefix.
  583. *
  584. * @return string
  585. */
  586. public function getCentrePrefix()
  587. {
  588. return $this->centrePrefix;
  589. }
  590. /**
  591. * Set pagePrefix.
  592. *
  593. * @param string $pagePrefix
  594. *
  595. * @return MatterRequestDefaults
  596. */
  597. public function setPagePrefix($pagePrefix)
  598. {
  599. $this->pagePrefix = $pagePrefix;
  600. return $this;
  601. }
  602. /**
  603. * Get pagePrefix.
  604. *
  605. * @return string
  606. */
  607. public function getPagePrefix()
  608. {
  609. return $this->pagePrefix;
  610. }
  611. /**
  612. * Set paginationRun.
  613. *
  614. * @param string $paginationRun
  615. *
  616. * @return MatterRequestDefaults
  617. */
  618. public function setPaginationRun($paginationRun)
  619. {
  620. $this->paginationRun = $paginationRun;
  621. return $this;
  622. }
  623. /**
  624. * Get paginationRun.
  625. *
  626. * @return string
  627. */
  628. public function getPaginationRun()
  629. {
  630. return $this->paginationRun;
  631. }
  632. /**
  633. * Set pageNumberPadding.
  634. *
  635. * @param string $pageNumberPadding
  636. *
  637. * @return MatterRequestDefaults
  638. */
  639. public function setPageNumberPadding($pageNumberPadding)
  640. {
  641. $this->pageNumberPadding = $pageNumberPadding;
  642. return $this;
  643. }
  644. /**
  645. * Get pageNumberPadding.
  646. *
  647. * @return string
  648. */
  649. public function getPageNumberPadding()
  650. {
  651. return $this->pageNumberPadding;
  652. }
  653. /**
  654. * Set account.
  655. *
  656. * @param Account|null $account
  657. *
  658. * @return MatterRequestDefaults
  659. */
  660. public function setAccount(?Account $account = null)
  661. {
  662. $this->account = $account;
  663. return $this;
  664. }
  665. /**
  666. * Get account.
  667. *
  668. * @return Account|null
  669. */
  670. public function getAccount()
  671. {
  672. return $this->account;
  673. }
  674. /**
  675. * Set forceOptionalFields.
  676. *
  677. * @param array $forceOptionalFields
  678. *
  679. * @return MatterRequestDefaults
  680. */
  681. public function setForceOptionalFields($forceOptionalFields)
  682. {
  683. $this->forceOptionalFields = $forceOptionalFields;
  684. return $this;
  685. }
  686. /**
  687. * Get forceOptionalFields.
  688. *
  689. * @return array
  690. */
  691. public function getForceOptionalFields()
  692. {
  693. if (!$this->forceOptionalFields) {
  694. return [];
  695. }
  696. return $this->forceOptionalFields;
  697. }
  698. /**
  699. * Returns matter creations options as an array, usable as the choices for a form.
  700. *
  701. * @return array
  702. */
  703. public static function getForceOptionalFieldsOptions(): array
  704. {
  705. $forceOptionalFieldsOptions = self::getConstantsWithLabelsAsChoices('FORCE_OPTIONAL_FIELDS');
  706. return array_flip($forceOptionalFieldsOptions);
  707. }
  708. /**
  709. * Returns true if the field has been forced to be optional.
  710. *
  711. * @param string $fieldName
  712. *
  713. * @return bool
  714. */
  715. public function isFieldForceOptional(string $fieldName): bool
  716. {
  717. $forceOptionalFieldsValues = self::getConstants('FORCE_OPTIONAL_FIELDS');
  718. if (!in_array($fieldName, $forceOptionalFieldsValues)) {
  719. throw new \InvalidArgumentException(sprintf('Invalid fieldName: %1$s', $fieldName));
  720. }
  721. return in_array($fieldName, $this->getForceOptionalFields());
  722. }
  723. /**
  724. * Set matterActiveOnCreation.
  725. *
  726. * @param bool $matterActiveOnCreation
  727. *
  728. * @return MatterRequestDefaults
  729. */
  730. public function setMatterActiveOnCreation(bool $matterActiveOnCreation): MatterRequestDefaults
  731. {
  732. $this->matterActiveOnCreation = $matterActiveOnCreation;
  733. return $this;
  734. }
  735. /**
  736. * Get matterActiveOnCreation.
  737. *
  738. * @return bool
  739. */
  740. public function getMatterActiveOnCreation(): bool
  741. {
  742. return $this->matterActiveOnCreation;
  743. }
  744. /**
  745. * Set radiologyChoice.
  746. *
  747. * @param string|null $radiologyChoice
  748. *
  749. * @return MatterRequestDefaults
  750. */
  751. public function setRadiologyChoice(?string $radiologyChoice = null): MatterRequestDefaults
  752. {
  753. $this->radiologyChoice = $radiologyChoice;
  754. return $this;
  755. }
  756. /**
  757. * Get radiologyChoice.
  758. *
  759. * @return string|null
  760. */
  761. public function getRadiologyChoice(): ?string
  762. {
  763. return $this->radiologyChoice;
  764. }
  765. /**
  766. * Get the value of pageNumberPositionHorizontal
  767. *
  768. * @return int
  769. */
  770. public function getPageNumberPositionHorizontal()
  771. {
  772. return $this->pageNumberPositionHorizontal;
  773. }
  774. /**
  775. * Set the value of pageNumberPositionHorizontal
  776. *
  777. * @param int $pageNumberPositionHorizontal
  778. *
  779. * @return self
  780. */
  781. public function setPageNumberPositionHorizontal(int $pageNumberPositionHorizontal)
  782. {
  783. $this->pageNumberPositionHorizontal = $pageNumberPositionHorizontal;
  784. return $this;
  785. }
  786. /**
  787. * Get the value of pageNumberPositionVertical
  788. *
  789. * @return int
  790. */
  791. public function getPageNumberPositionVertical()
  792. {
  793. return $this->pageNumberPositionVertical;
  794. }
  795. /**
  796. * Set the value of pageNumberPositionVertical
  797. *
  798. * @param int $pageNumberPositionVertical
  799. *
  800. * @return self
  801. */
  802. public function setPageNumberPositionVertical(int $pageNumberPositionVertical)
  803. {
  804. $this->pageNumberPositionVertical = $pageNumberPositionVertical;
  805. return $this;
  806. }
  807. /**
  808. * Get the value of pageNumberSize
  809. *
  810. * @return int
  811. */
  812. public function getPageNumberSize()
  813. {
  814. return $this->pageNumberSize;
  815. }
  816. /**
  817. * Set the value of pageNumberSize
  818. *
  819. * @param int $pageNumberSize
  820. *
  821. * @return self
  822. */
  823. public function setPageNumberSize(int $pageNumberSize)
  824. {
  825. $this->pageNumberSize = $pageNumberSize;
  826. return $this;
  827. }
  828. /**
  829. * Get the value of pageNumberBackground
  830. */
  831. public function getPageNumberBackground()
  832. {
  833. return $this->pageNumberBackground;
  834. }
  835. /**
  836. * Set the value of pageNumberBackground
  837. *
  838. * @param mixed $pageNumberBackground
  839. *
  840. * @return self
  841. */
  842. public function setPageNumberBackground($pageNumberBackground)
  843. {
  844. $this->pageNumberBackground = $pageNumberBackground;
  845. return $this;
  846. }
  847. /**
  848. * @return string|null
  849. */
  850. public function getFirmReviewChoice(): ?string
  851. {
  852. return $this->firmReviewChoice;
  853. }
  854. /**
  855. * @param string|null $firmReviewChoice
  856. *
  857. * @return self
  858. */
  859. public function setFirmReviewChoice(?string $firmReviewChoice = null): self
  860. {
  861. $this->firmReviewChoice = $firmReviewChoice;
  862. return $this;
  863. }
  864. /**
  865. * Set forceCompulsoryFields.
  866. *
  867. * @param array $forceCompulsoryFields
  868. *
  869. * @return MatterRequestDefaults
  870. */
  871. public function setForceCompulsoryFields(array $forceCompulsoryFields): MatterRequestDefaults
  872. {
  873. $this->forceCompulsoryFields = $forceCompulsoryFields;
  874. return $this;
  875. }
  876. /**
  877. * Get forceCompulsoryFields.
  878. *
  879. * @return array
  880. */
  881. public function getForceCompulsoryFields(): array
  882. {
  883. if (!$this->forceCompulsoryFields) {
  884. return [];
  885. }
  886. return $this->forceCompulsoryFields;
  887. }
  888. /**
  889. * Returns matter creation options as an array, usable as the choices for a form.
  890. *
  891. * @return array
  892. */
  893. public static function getForceCompulsoryFieldsOptions(): array
  894. {
  895. $forceCompulsoryFieldsOptions = self::getConstantsWithLabelsAsChoices('FORCE_COMPULSORY_FIELDS');
  896. return array_flip($forceCompulsoryFieldsOptions);
  897. }
  898. /**
  899. * Returns true if the field has been forced to be compulsory.
  900. *
  901. * @param string $fieldName
  902. *
  903. * @return bool
  904. */
  905. public function isFieldForceCompulsory(string $fieldName): bool
  906. {
  907. $forceCompulsoryFieldsValues = self::getConstants('FORCE_COMPULSORY_FIELDS');
  908. if (!in_array($fieldName, $forceCompulsoryFieldsValues)) {
  909. throw new \InvalidArgumentException(sprintf('Invalid fieldName: %1$s', $fieldName));
  910. }
  911. return in_array($fieldName, $this->getForceCompulsoryFields());
  912. }
  913. }