1 | <?php |
||
11 | trait ProviderTrait |
||
12 | { |
||
13 | /** |
||
14 | * @var ProviderCallbackInterface |
||
15 | */ |
||
16 | protected $callback; |
||
17 | |||
18 | public function setCallback(ProviderCallbackInterface $callback = null) |
||
22 | |||
23 | public function processCallback(array $data) |
||
24 | { |
||
25 | if ($this->callback) { |
||
26 | $this->callback->process($data); |
||
27 | } |
||
28 | } |
||
29 | |||
30 | public function getCallbackResults() |
||
31 | { |
||
32 | if ($this->callback) { |
||
33 | return $this->callback->getResults(); |
||
34 | } |
||
35 | |||
36 | return array(); |
||
37 | } |
||
38 | |||
39 | public function accept(RecordProvider $visitor) |
||
40 | { |
||
41 | /* @var ProviderInterface $this */ |
||
42 | $visitor->visit($this); |
||
43 | } |
||
44 | |||
45 | public function applyOptions(array $options = array()) |
||
46 | { |
||
47 | $accessor = PropertyAccess::createPropertyAccessor(); |
||
48 | $this->validateOptions($options); |
||
49 | |||
50 | foreach ($options as $key => $value) { |
||
51 | $accessor->setValue($this, $key, $value); |
||
52 | } |
||
53 | } |
||
54 | |||
55 | public function validateOptions(array $options) |
||
56 | { |
||
57 | $resolver = new OptionsResolver(); |
||
58 | $this->configureOptions($resolver); |
||
59 | $resolver->resolve($options); |
||
60 | } |
||
61 | |||
62 | public function configureOptions(OptionsResolver $resolver) |
||
65 | } |
||
66 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.