Skip to content

Latest commit

 

History

History
78 lines (66 loc) · 1.22 KB

configuration-example.md

File metadata and controls

78 lines (66 loc) · 1.22 KB
<?php

namespace Kickin\ExceptionHandlerBundle\Configuration;

use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

class ExampleConfiguration implements SwiftMailerConfigurationInterface
{
  /**
   * @var string
   */
  private $cacheDir;

  /**
   * ExampleConfiguration constructor.
   *
   * @param string $cacheDir
   */
  public function __construct($cacheDir)
  {
    $this->cacheDir = $cacheDir;
  }

  /**
   * @inheritdoc
   */
  public function isProductionEnvironment(): bool
  {
    return false;
  }

  /**
   * @inheritdoc
   */
  public function getBacktraceFolder(): bool
  {
    return $this->cacheDir . '/exception-handler';
  }

  /**
   * @inheritdoc
   */
  public function getSender()
  {
    return array('Exception Handler' => '[email protected]');
  }

  /**
   * @inheritdoc
   */
  public function getReceiver()
  {
    return array('receiver' => '[email protected]');
  }

  /**
   * @inheritdoc
   */
  public function getUserInformation(TokenInterface $token = null): string
  {
    if ($token !== NULL) {
      return $token->getUsername();
    }

    return 'No user';
  }

  /**
   * @inheritdoc
   */
  public function getSystemVersion(): string
  {
    return 'git-hash';
  }
}