__construct() public method

Build the Client with the Airbrake Configuration.
public __construct ( Configuration $configuration )
$configuration Configuration
 /**
  * @param string $apiKey
  * @param Symfony\Component\DependencyInjection\ContainerInterface $container
  * @param string|null $queue
  * @param string|null $apiEndPoint
  * @param bool|null $enabled
  */
 public function __construct($apiKey, $envName, ContainerInterface $container, $queue = null, $apiEndPoint = null, $enabled = true)
 {
     if (!$apiKey) {
         return;
     }
     $env = getenv('SYMFONY_ENV');
     $sha1 = getenv('MUSICGLUE_COMMIT_SHA1');
     $sha1 = substr($sha1, 0, 6);
     if ($env && $sha1) {
         $envName = $env . '-' . $sha1;
     }
     $this->enabled = $enabled;
     $options = $this->getOptions($envName, $queue, $container);
     // Filter POST
     if (isset($options['postData'])) {
         $postData = array();
         foreach ($options['postData'] as $key => $value) {
             if (!in_array($key, $container->getParameter('php_airbrake.blacklist'))) {
                 $postData[$key] = $value;
             }
         }
         $options['postData'] = $postData;
     }
     // Filter SERVER
     if (isset($options['serverData']) && $container->getParameter('php_airbrake.env_whitelist')) {
         $envWhitelist = array_merge(['SCRIPT_NAME', 'X_SITE_NAME'], $container->getParameter('php_airbrake.env_whitelist'));
         $options['serverData'] = array_intersect_key(array_change_key_case($options['serverData'], CASE_UPPER), array_change_key_case(array_flip($envWhitelist), CASE_UPPER));
     }
     if (!empty($apiEndPoint)) {
         $options['apiEndPoint'] = $apiEndPoint;
     }
     parent::__construct(new AirbrakeConfiguration($apiKey, $options));
 }
Example #2
0
 /**
  * @param string $apiKey
  * @param string $envName
  * @param ContainerInterface $container
  * @param bool|null $enabled
  * @param string|null $queue
  */
 public function __construct($apiKey, $envName, ContainerInterface $container, $enabled = true, $queue = null, $apiEndPoint = null)
 {
     if (!$apiKey) {
         return;
     }
     $this->enabled = $enabled;
     $projectRoot = realpath($container->getParameter('kernel.root_dir') . '/..');
     if (!$this->hasValidRequest($container)) {
         $serverData = "";
         $getData = "";
         $postData = "";
         $sessionData = null;
         $action = 'None';
         $component = 'None';
     } else {
         $request = $container->get('request');
         $controller = 'None';
         $action = 'None';
         if ($sa = $request->attributes->get('_controller')) {
             $controllerArray = explode('::', $sa);
             if (sizeof($controllerArray) > 1) {
                 list($controller, $action) = $controllerArray;
             }
         }
         $serverData = $request->server->all();
         $getData = $request->query->all();
         $postData = $request->request->all();
         $sessionData = $request->getSession() ? $request->getSession()->all() : null;
         $component = $controller;
     }
     $options = array('environmentName' => $envName, 'queue' => $queue, 'serverData' => $serverData, 'getData' => $getData, 'postData' => $postData, 'sessionData' => $sessionData, 'component' => $component, 'action' => $action, 'projectRoot' => $projectRoot);
     if (!empty($apiEndPoint)) {
         $options['apiEndPoint'] = $apiEndPoint;
     }
     parent::__construct(new AirbrakeConfiguration($apiKey, $options));
 }
Example #3
0
 /**
  * Class constructor
  * 
  * @param Eo\AirbrakeBundle\Bridge\Configuration $configuration
  */
 public function __construct(Configuration $configuration)
 {
     parent::__construct($configuration);
 }