Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
controllerbinder.php
1<?php
2
4
7
8final class ControllerBinder extends Binder
9{
11 private $controller;
12
13 public function getController(): Controller
14 {
15 return $this->controller;
16 }
17
18 public function setController(Controller $controller): ControllerBinder
19 {
20 $this->controller = $controller;
21
22 return $this;
23 }
24
25 protected function constructValue(\ReflectionParameter $parameter, Parameter $autoWireParameter, Result $captureResult): Result
26 {
27 $result = new Result();
28
29 $controller = $this->getController();
30
31 $errorsBefore = $controller->getErrors();
32 $constructedValue = $autoWireParameter->constructValue($parameter, $captureResult, $controller);
33 $errorsAfter = $controller->getErrors();
34
35 $newErrors = array_diff($errorsAfter, $errorsBefore);
36
37 $result->setData([
38 'value' => $constructedValue,
39 ]);
40
41 if ($newErrors)
42 {
43 $result->addErrors($newErrors);
44 }
45
46 return $result;
47 }
48}
constructValue(\ReflectionParameter $parameter, Parameter $autoWireParameter, Result $captureResult)
constructValue(\ReflectionParameter $parameter, Result $captureResult, $newThis=null)
Definition parameter.php:47