-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
85 changed files
with
1,807 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,5 @@ class BugsnagBundle extends Bundle | |
* | ||
* @return string | ||
*/ | ||
const VERSION = '1.13.0'; | ||
const VERSION = '1.14.0'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
<?php | ||
|
||
namespace Bugsnag\BugsnagBundle\DependencyInjection; | ||
|
||
use Bugsnag\BugsnagBundle\EventListener\BugsnagListener; | ||
use Bugsnag\BugsnagBundle\EventListener\BugsnagShutdown; | ||
use Bugsnag\BugsnagBundle\Request\SymfonyResolver; | ||
use Bugsnag\Client; | ||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
|
||
abstract class BaseConfiguration | ||
{ | ||
/** | ||
* The name of the root of the configuration. | ||
* | ||
* @var string | ||
*/ | ||
const ROOT_NAME = 'bugsnag'; | ||
|
||
/** | ||
* Get the configuration tree builder. | ||
* | ||
* @return TreeBuilder | ||
*/ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder(self::ROOT_NAME); | ||
$rootNode = $this->getRootNode($treeBuilder); | ||
|
||
$rootNode | ||
->children() | ||
->scalarNode('api_key') | ||
->defaultValue(getenv('BUGSNAG_API_KEY') ?: null) | ||
->end() | ||
->scalarNode('endpoint') | ||
->defaultValue(getenv('BUGSNAG_ENDPOINT') ?: null) | ||
->end() | ||
->booleanNode('callbacks') | ||
->defaultValue(true) | ||
->end() | ||
->booleanNode('user') | ||
->defaultValue(true) | ||
->end() | ||
->scalarNode('app_type') | ||
->defaultNull() | ||
->end() | ||
->scalarNode('app_version') | ||
->defaultNull() | ||
->end() | ||
->booleanNode('batch_sending') | ||
->defaultValue(true) | ||
->end() | ||
->scalarNode('hostname') | ||
->defaultNull() | ||
->end() | ||
->booleanNode('send_code') | ||
->defaultValue(true) | ||
->end() | ||
->scalarNode('release_stage') | ||
->defaultNull() | ||
->end() | ||
->scalarNode('strip_path') | ||
->defaultNull() | ||
->end() | ||
->scalarNode('project_root') | ||
->defaultNull() | ||
->end() | ||
->booleanNode('auto_notify') | ||
->defaultValue(true) | ||
->end() | ||
->scalarNode('resolver') | ||
->defaultValue(SymfonyResolver::class) | ||
->end() | ||
->scalarNode('factory') | ||
->defaultValue(ClientFactory::class) | ||
->end() | ||
->scalarNode('client') | ||
->defaultValue(Client::class) | ||
->end() | ||
->scalarNode('listener') | ||
->defaultValue(BugsnagListener::class) | ||
->end() | ||
->arrayNode('notify_release_stages') | ||
->prototype('scalar')->end() | ||
->treatNullLike([]) | ||
->defaultValue([]) | ||
->end() | ||
->arrayNode('filters') | ||
->prototype('scalar')->end() | ||
->treatNullLike([]) | ||
->defaultValue([]) | ||
->end() | ||
->scalarNode('shutdown') | ||
->defaultValue(BugsnagShutdown::class) | ||
->end() | ||
->scalarNode('strip_path_regex') | ||
->defaultNull() | ||
->end() | ||
->scalarNode('project_root_regex') | ||
->defaultNull() | ||
->end() | ||
->scalarNode('guzzle') | ||
->defaultNull() | ||
->end() | ||
->scalarNode('memory_limit_increase') | ||
->defaultFalse() | ||
->end() | ||
->arrayNode('discard_classes') | ||
->prototype('scalar')->end() | ||
->treatNullLike([]) | ||
->defaultValue([]) | ||
->end() | ||
->arrayNode('redacted_keys') | ||
->prototype('scalar')->end() | ||
->treatNullLike([]) | ||
->defaultValue([]) | ||
->end() | ||
->arrayNode('feature_flags') | ||
->prototype('array') | ||
->children() | ||
->scalarNode('name') | ||
->isRequired() | ||
->validate() | ||
->ifTrue(function ($value) { | ||
return !is_string($value); | ||
}) | ||
->thenInvalid('Feature flag name should be a string, got %s') | ||
->end() | ||
->end() | ||
->scalarNode('variant')->end() | ||
->end() | ||
->end() | ||
->treatNullLike([]) | ||
->defaultValue([]) | ||
->end() | ||
->scalarNode('max_breadcrumbs') | ||
->defaultNull() | ||
->end(); | ||
|
||
return $treeBuilder; | ||
} | ||
|
||
/** | ||
* Returns the root node of TreeBuilder with backwards compatibility | ||
* for pre-Symfony 4.1. | ||
* | ||
* @param TreeBuilder $treeBuilder a TreeBuilder to extract/create the root node | ||
* from | ||
* | ||
* @return NodeDefinition the root node of the config | ||
*/ | ||
protected function getRootNode(TreeBuilder $treeBuilder) | ||
{ | ||
if (\method_exists($treeBuilder, 'getRootNode')) { | ||
return $treeBuilder->getRootNode(); | ||
} | ||
|
||
return $treeBuilder->root(self::ROOT_NAME); | ||
} | ||
} |
Oops, something went wrong.