/**
  * Constructor. Randomly generates new CSRF token every time this method is called.
  */
 public function __construct()
 {
     $this->csrfToken = StringUtils::generate(50);
 }
 /**
  * Adds an auth token to a given Student instance.
  *
  * Warning: This method wil overwrite the existing auth token.
  *
  * @param Student $student Student entity with an auth token.
  */
 public function createAuthToken(Student $student)
 {
     return $student->setToken(StringUtils::generate(65));
 }
Example #3
0
 /**
  * Constructor.
  *
  * @param HeadersCollectionInterface $headers HTTP Request headers.
  * @param StreamInterface $body Request body.
  * @param string $method Request method.
  * @param UriInterface $uri Request URI.
  * @param array $serverParams Server parameters.
  * @param array $cookies Cookies.
  */
 public function __construct(HeadersCollectionInterface $headers, StreamInterface $body, $method, UriInterface $uri, array $serverParams, array $cookies)
 {
     $this->headers = $headers;
     $this->body = $body;
     $this->method = $method;
     $this->uri = $uri;
     $this->serverParams = new Collection($serverParams);
     $this->queryParams = StringUtils::parseQueryString($uri->getQuery());
     $this->cookies = new Collection($cookies);
     $this->attributes = new Collection([]);
 }