/** * {@inheritdoc} */ public function collect(Request $request, Response $response, \Exception $exception = null) { if (!$this->ldap) { return; } $this->data['domains'] = $this->ldap->getDomains(); $this->data['operations_by_domain'] = []; foreach ($this->data['domains'] as $domain) { $this->data['operations_by_domain'][$domain] = $this->addOperationToData(...$this->logger->getOperations($domain)); } $this->data['operations'] = $this->addOperationToData(...$this->logger->getOperations()); $this->data['errors'] = $this->addOperationToData(...$this->logger->getErrors()); }
function let(LdapManager $ldap) { $logger = new LdapProfilerLogger(); // Add some log data... $addOperation = (new AddOperation())->setAttributes(['username' => 'foo', 'unicodePwd' => 'bar']); $deleteOperation = new DeleteOperation('foo'); $addLog = new LogOperation($addOperation); $addLog->setDomain('foo.bar'); $addLog->setError('fail'); $deleteLog = new LogOperation($deleteOperation); $deleteLog->setDomain('example.local'); /** @var LogOperation $log */ foreach ([$addLog, $deleteLog] as $log) { $logger->start($log->start()); $logger->end($log->stop()); } $ldap->getDomains()->willReturn(['foo.bar', 'example.local']); $this->beConstructedWith($logger, $ldap); }