Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AbstractBuilder.php
Go to the documentation of this file.
1 <?php
7 
11 
15 abstract class AbstractBuilder implements BuilderInterface
16 {
23 
29  protected $reportWriter;
30 
34  protected $options = [];
35 
43  {
44  $this->dependenciesParser = $dependenciesParser;
45  $this->reportWriter = $reportWriter;
46  }
47 
53  public function build(array $options)
54  {
55  $this->checkOptions($options);
56  $this->options = $options;
57 
58  $config = $this->buildData($this->dependenciesParser->parse($options['parse']));
59  $this->reportWriter->write($options['write'], $config);
60  }
61 
69  protected function checkOptions($options)
70  {
71  if (!isset($options['parse']) || empty($options['parse'])) {
72  throw new \InvalidArgumentException('Passed option section "parse" is wrong.');
73  }
74 
75  if (!isset($options['write']) || empty($options['write'])) {
76  throw new \InvalidArgumentException('Passed option section "write" is wrong.');
77  }
78  }
79 
86  abstract protected function buildData($modulesData);
87 }
__construct(ParserInterface $dependenciesParser, WriterInterface $reportWriter)
$config
Definition: fraud_order.php:17