Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CaseRescore.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
18  private $caseRepository;
19 
25  public function __construct(CaseRepositoryInterface $caseRepository)
26  {
27  $this->caseRepository = $caseRepository;
28  }
29 
33  public function generate(array $data)
34  {
35  if (empty($data['caseId'])) {
36  throw new GeneratorException(__('The "%1" should not be empty.', 'caseId'));
37  }
38 
39  $caseEntity = $this->caseRepository->getByCaseId($data['caseId']);
40 
41  if ($caseEntity === null) {
42  throw new GeneratorException(__('Case entity not found.'));
43  }
44 
45  return __(
46  'Case Update: New score for the order is %1. Previous score was %2.',
47  !empty($data['score']) ? $data['score'] : 0,
48  $caseEntity->getScore()
49  );
50  }
51 }
__()
Definition: __.php:13
$caseRepository
__construct(CaseRepositoryInterface $caseRepository)
Definition: CaseRescore.php:25