ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Monolog\Processor\UidProcessor Class Reference

Adds a unique identifier into records. More...

+ Inheritance diagram for Monolog\Processor\UidProcessor:
+ Collaboration diagram for Monolog\Processor\UidProcessor:

Public Member Functions

 __construct ($length=7)
 
 __invoke (array $record)
 
 getUid ()
 
 reset ()
 

Private Member Functions

 generateUid ($length)
 

Private Attributes

 $uid
 

Detailed Description

Adds a unique identifier into records.

Author
Simon Mönch sm@we.nosp@m.bfac.nosp@m.tory..nosp@m.de

Definition at line 21 of file UidProcessor.php.

Constructor & Destructor Documentation

◆ __construct()

Monolog\Processor\UidProcessor::__construct (   $length = 7)

Definition at line 25 of file UidProcessor.php.

References Monolog\Processor\UidProcessor\generateUid().

26  {
27  if (!is_int($length) || $length > 32 || $length < 1) {
28  throw new \InvalidArgumentException('The uid length must be an integer between 1 and 32');
29  }
30 
31 
32  $this->uid = $this->generateUid($length);
33  }
+ Here is the call graph for this function:

Member Function Documentation

◆ __invoke()

Monolog\Processor\UidProcessor::__invoke ( array  $records)
Returns
array The processed records

Implements Monolog\Processor\ProcessorInterface.

Definition at line 35 of file UidProcessor.php.

References Monolog\Processor\UidProcessor\$uid.

36  {
37  $record['extra']['uid'] = $this->uid;
38 
39  return $record;
40  }

◆ generateUid()

Monolog\Processor\UidProcessor::generateUid (   $length)
private

Definition at line 55 of file UidProcessor.php.

References GuzzleHttp\Psr7\hash().

Referenced by Monolog\Processor\UidProcessor\__construct(), and Monolog\Processor\UidProcessor\reset().

56  {
57  return substr(hash('md5', uniqid('', true)), 0, $length);
58  }
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.
Definition: functions.php:406
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUid()

Monolog\Processor\UidProcessor::getUid ( )
Returns
string

Definition at line 45 of file UidProcessor.php.

References Monolog\Processor\UidProcessor\$uid.

46  {
47  return $this->uid;
48  }

◆ reset()

Monolog\Processor\UidProcessor::reset ( )

Implements Monolog\ResettableInterface.

Definition at line 50 of file UidProcessor.php.

References Monolog\Processor\UidProcessor\generateUid().

51  {
52  $this->uid = $this->generateUid(strlen($this->uid));
53  }
+ Here is the call graph for this function:

Field Documentation

◆ $uid

Monolog\Processor\UidProcessor::$uid
private

The documentation for this class was generated from the following file: