Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FactoryDecorator.php
Go to the documentation of this file.
1 <?php
8 
10 {
14  const GENERATOR_NAME = \Magento\Framework\ObjectManager\Profiler\Code\Generator\Logger::class;
15 
19  protected $subject;
20 
24  protected $log;
25 
31  {
32  $this->subject = $subject;
33  $this->log = $log;
34  }
35 
42  {
43  $this->subject->setObjectManager($objectManager);
44  }
45 
49  public function create($requestedType, array $arguments = [])
50  {
51  $this->log->startCreating($requestedType);
52  $result = $this->subject->create($requestedType, $arguments);
53  if ($requestedType !== self::GENERATOR_NAME) {
54  $loggerClassName = get_class($result) . "\\Logger";
55  $wrappedResult = new $loggerClassName($result, $this->log);
56  $this->log->stopCreating($result);
57  $result = $wrappedResult;
58  }
59  return $result;
60  }
61 }
setObjectManager(\Magento\Framework\ObjectManagerInterface $objectManager)
$objectManager
Definition: bootstrap.php:17
__construct(\Magento\Framework\ObjectManager\FactoryInterface $subject, Log $log)
$arguments