getOperation() public method

Get the LDAP operation represented for this log.
public getOperation ( ) : LdapTools\Operation\LdapOperationInterface
return LdapTools\Operation\LdapOperationInterface
 function it_should_call_the_stopwatch_and_logger_on_start($stopwatch, $logger)
 {
     $log = new LogOperation((new DeleteOperation('foo'))->setServer('foo'));
     $log->setDomain('foo');
     $stopwatch->start('ldaptools', strtolower($log->getOperation()->getName()))->shouldBeCalled();
     $logger->debug("(foo on foo) Start Delete Operation - DN: foo, Controls: array (\n)")->shouldBeCalled();
     $this->start($log);
 }
 /**
  * @param LogOperation $log
  * @return string
  */
 protected function getLogMessage(LogOperation $log)
 {
     $startOrStop = is_null($log->getStopTime()) ? 'Start' : 'End';
     $message = "(" . $log->getDomain() . " on " . $log->getOperation()->getServer() . ") {$startOrStop} " . $log->getOperation()->getName() . " Operation - ";
     $params = [];
     if (is_null($log->getStopTime())) {
         foreach ($log->getOperation()->getLogArray() as $key => $value) {
             if ($key != "Server") {
                 $params[] = "{$key}: {$value}";
             }
         }
     } else {
         if (!is_null($log->getError())) {
             $params[] = "Error: " . $log->getError();
         }
         $params[] = "Completed in " . round(($log->getStopTime() - $log->getStartTime()) * 1000) . " ms.";
     }
     $message .= implode(', ', $params);
     return $message;
 }
Example #3
0
 /**
  * @param LogOperation $operation
  */
 public function end(LogOperation $operation)
 {
     throw new \InvalidArgumentException("End=" . $operation->getOperation()->getDn());
 }