Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement initial public API #33

Merged
merged 19 commits into from
Feb 26, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 262 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true

# C source
[{*.c,*.h}]
# C-style doc comments
block_comment_start = /*
block_comment = *
block_comment_end = */

# PHP source
[{*.php,*.ctp,*.hphp,*.phtml,*.module,*.php5,*.php4,*.inc}]
# C-style doc comments
block_comment_start = /*
block_comment = *
block_comment_end = */
ij_continuation_indent_size = 4
ij_visual_guides = 120
ij_php_align_assignments = false
ij_php_align_class_constants = false
ij_php_align_group_field_declarations = false
ij_php_align_inline_comments = false
ij_php_align_key_value_pairs = true
ij_php_align_multiline_array_initializer_expression = true
ij_php_align_multiline_binary_operation = true
ij_php_align_multiline_chained_methods = true
ij_php_align_multiline_extends_list = true
ij_php_align_multiline_for = true
ij_php_align_multiline_parameters = true
ij_php_align_multiline_parameters_in_calls = true
ij_php_align_multiline_ternary_operation = true
ij_php_align_phpdoc_comments = true
ij_php_align_phpdoc_param_names = true
ij_php_anonymous_brace_style = end_of_line
ij_php_api_weight = 28
ij_php_array_initializer_new_line_after_left_brace = true
ij_php_array_initializer_right_brace_on_new_line = true
ij_php_array_initializer_wrap = normal
ij_php_assignment_wrap = normal
ij_php_author_weight = 28
ij_php_binary_operation_sign_on_next_line = true
ij_php_binary_operation_wrap = normal
ij_php_blank_lines_after_class_header = 0
ij_php_blank_lines_after_function = 1
ij_php_blank_lines_after_imports = 1
ij_php_blank_lines_after_opening_tag = 0
ij_php_blank_lines_after_package = 0
ij_php_blank_lines_around_class = 1
ij_php_blank_lines_around_constants = 0
ij_php_blank_lines_around_field = 0
ij_php_blank_lines_around_method = 1
ij_php_blank_lines_before_class_end = 0
ij_php_blank_lines_before_imports = 1
ij_php_blank_lines_before_method_body = 0
ij_php_blank_lines_before_package = 1
ij_php_blank_lines_before_return_statement = 0
ij_php_blank_lines_between_imports = 0
ij_php_block_brace_style = end_of_line
ij_php_call_parameters_new_line_after_left_paren = true
ij_php_call_parameters_right_paren_on_new_line = true
ij_php_call_parameters_wrap = normal
ij_php_catch_on_new_line = false
ij_php_category_weight = 28
ij_php_class_brace_style = next_line
ij_php_comma_after_last_array_element = true
ij_php_concat_spaces = true
ij_php_copyright_weight = 28
ij_php_deprecated_weight = 28
ij_php_do_while_brace_force = always
ij_php_else_if_style = combine
ij_php_else_on_new_line = false
ij_php_example_weight = 28
ij_php_extends_keyword_wrap = normal
ij_php_extends_list_wrap = normal
ij_php_fields_default_visibility = private
ij_php_filesource_weight = 28
ij_php_finally_on_new_line = false
ij_php_for_brace_force = always
ij_php_for_statement_new_line_after_left_paren = true
ij_php_for_statement_right_paren_on_new_line = true
ij_php_for_statement_wrap = normal
ij_php_force_short_declaration_array_style = true
ij_php_global_weight = 28
ij_php_group_use_wrap = on_every_item
ij_php_if_brace_force = always
ij_php_if_lparen_on_next_line = false
ij_php_if_rparen_on_next_line = false
ij_php_ignore_weight = 28
ij_php_import_sorting = alphabetic
ij_php_indent_break_from_case = true
ij_php_indent_case_from_switch = true
ij_php_indent_code_in_php_tags = false
ij_php_internal_weight = 28
ij_php_keep_blank_lines_after_lbrace = 2
ij_php_keep_blank_lines_before_right_brace = 2
ij_php_keep_blank_lines_in_code = 2
ij_php_keep_blank_lines_in_declarations = 2
ij_php_keep_control_statement_in_one_line = false
ij_php_keep_first_column_comment = false
ij_php_keep_indents_on_empty_lines = false
ij_php_keep_line_breaks = true
ij_php_keep_rparen_and_lbrace_on_one_line = true
ij_php_keep_simple_methods_in_one_line = false
ij_php_lambda_brace_style = end_of_line
ij_php_license_weight = 28
ij_php_line_comment_add_space = true
ij_php_line_comment_at_first_column = false
ij_php_link_weight = 28
ij_php_lower_case_boolean_const = true
ij_php_lower_case_null_const = true
ij_php_method_brace_style = next_line
ij_php_method_call_chain_wrap = normal
ij_php_method_parameters_new_line_after_left_paren = true
ij_php_method_parameters_right_paren_on_new_line = true
ij_php_method_parameters_wrap = on_every_item
ij_php_method_weight = 28
ij_php_modifier_list_wrap = false
ij_php_multiline_chained_calls_semicolon_on_new_line = false
ij_php_namespace_brace_style = 2
ij_php_null_type_position = in_the_end
ij_php_package_weight = 28
ij_php_param_weight = 0
ij_php_parentheses_expression_new_line_after_left_paren = false
ij_php_parentheses_expression_right_paren_on_new_line = false
ij_php_phpdoc_blank_line_before_tags = true
ij_php_phpdoc_blank_lines_around_parameters = true
ij_php_phpdoc_keep_blank_lines = true
ij_php_phpdoc_param_spaces_between_name_and_description = 1
ij_php_phpdoc_param_spaces_between_tag_and_type = 1
ij_php_phpdoc_param_spaces_between_type_and_name = 1
ij_php_phpdoc_use_fqcn = false
ij_php_phpdoc_wrap_long_lines = true
ij_php_place_assignment_sign_on_next_line = true
ij_php_place_parens_for_constructor = 1
ij_php_property_read_weight = 28
ij_php_property_weight = 28
ij_php_property_write_weight = 28
ij_php_return_type_on_new_line = false
ij_php_return_weight = 1
ij_php_see_weight = 28
ij_php_since_weight = 28
ij_php_sort_phpdoc_elements = true
ij_php_space_after_colon = true
ij_php_space_after_colon_in_return_type = true
ij_php_space_after_comma = true
ij_php_space_after_for_semicolon = true
ij_php_space_after_quest = true
ij_php_space_after_type_cast = false
ij_php_space_after_unary_not = false
ij_php_space_before_array_initializer_left_brace = false
ij_php_space_before_catch_keyword = true
ij_php_space_before_catch_left_brace = true
ij_php_space_before_catch_parentheses = true
ij_php_space_before_class_left_brace = true
ij_php_space_before_closure_left_parenthesis = true
ij_php_space_before_colon = true
ij_php_space_before_colon_in_return_type = false
ij_php_space_before_comma = false
ij_php_space_before_do_left_brace = true
ij_php_space_before_else_keyword = true
ij_php_space_before_else_left_brace = true
ij_php_space_before_finally_keyword = true
ij_php_space_before_finally_left_brace = true
ij_php_space_before_for_left_brace = true
ij_php_space_before_for_parentheses = true
ij_php_space_before_for_semicolon = false
ij_php_space_before_if_left_brace = true
ij_php_space_before_if_parentheses = true
ij_php_space_before_method_call_parentheses = false
ij_php_space_before_method_left_brace = true
ij_php_space_before_method_parentheses = false
ij_php_space_before_quest = true
ij_php_space_before_switch_left_brace = true
ij_php_space_before_switch_parentheses = true
ij_php_space_before_try_left_brace = true
ij_php_space_before_unary_not = false
ij_php_space_before_while_keyword = true
ij_php_space_before_while_left_brace = true
ij_php_space_before_while_parentheses = true
ij_php_space_between_ternary_quest_and_colon = false
ij_php_spaces_around_additive_operators = true
ij_php_spaces_around_arrow = false
ij_php_spaces_around_assignment_in_declare = false
ij_php_spaces_around_assignment_operators = true
ij_php_spaces_around_bitwise_operators = true
ij_php_spaces_around_equality_operators = true
ij_php_spaces_around_logical_operators = true
ij_php_spaces_around_multiplicative_operators = true
ij_php_spaces_around_null_coalesce_operator = true
ij_php_spaces_around_relational_operators = true
ij_php_spaces_around_shift_operators = true
ij_php_spaces_around_unary_operator = false
ij_php_spaces_around_var_within_brackets = false
ij_php_spaces_within_array_initializer_braces = false
ij_php_spaces_within_brackets = false
ij_php_spaces_within_catch_parentheses = false
ij_php_spaces_within_for_parentheses = false
ij_php_spaces_within_if_parentheses = false
ij_php_spaces_within_method_call_parentheses = false
ij_php_spaces_within_method_parentheses = false
ij_php_spaces_within_parentheses = false
ij_php_spaces_within_short_echo_tags = true
ij_php_spaces_within_switch_parentheses = false
ij_php_spaces_within_while_parentheses = false
ij_php_special_else_if_treatment = true
ij_php_subpackage_weight = 28
ij_php_ternary_operation_signs_on_next_line = true
ij_php_ternary_operation_wrap = normal
ij_php_throws_weight = 2
ij_php_todo_weight = 28
ij_php_unknown_tag_weight = 28
ij_php_upper_case_boolean_const = false
ij_php_upper_case_null_const = false
ij_php_uses_weight = 28
ij_php_var_weight = 28
ij_php_variable_naming_style = camel_case
ij_php_version_weight = 28
ij_php_while_brace_force = always
ij_php_while_on_new_line = false

[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true

# Bash shell
[{*.bash,*.zsh,*.sh}]
ij_shell_binary_ops_start_line = false
ij_shell_keep_column_alignment_padding = false
ij_shell_minify_program = false
ij_shell_redirect_followed_by_space = false
ij_shell_switch_cases_indented = false

# JSON
[{.eslintrc,composer.lock,.stylelintrc,jest.config,.babelrc,bowerrc,*.json,*.jsb3,*.jsb2}]
ij_json_keep_blank_lines_in_code = 0
ij_json_keep_indents_on_empty_lines = false
ij_json_keep_line_breaks = true
ij_json_space_after_colon = true
ij_json_space_after_comma = true
ij_json_space_before_colon = true
ij_json_space_before_comma = false
ij_json_spaces_within_braces = false
ij_json_spaces_within_brackets = false
ij_json_wrap_long_lines = false

# Markdown
[*.md]
trim_trailing_whitespace = false

# Makefile
[*Makefile]
indent_style = tab
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
# Docker
docker/wordpress/ephemeral/
docker/wordpress/data/ext

# Mac
.DS_Store

# JUnit
junit.xml

# JetBrains PhpStorm
.idea/

# Visual Studio Code
.vscode/

# Composer
composer.lock
composer.phar
vendor/

# PHP_CodeSniffer
.php_cs.cache

# PHPUnit
# phpunit.xml.dist is checked into version control and phpunit.xml is ignored by version control.
# This allows a developer to use a custom configuration without running the risk of accidentally checking it into version control.
phpunit.xml
.phpunit.result.cache

70 changes: 70 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"name": "elastic/apm-agent",
"description": "Elastic APM PHP Agent",
"keywords": [ "elastic", "apm", "tracing", "apm-agent" ],
"type": "library",
"license": "Apache-2.0",
"authors": [
{ "name": "Enrico Zimuel" },
{ "name": "Philip Krauss" },
{ "name": "Sergey Kleyman" }
],
"require": {
"php": "^7.2",
"ext-json": "*",
"psr/log": "^1.0"
},
"require-dev": {
"jchook/phpunit-assert-throws": "^1.0",
"monolog/monolog": "^2.0",
"phpstan/phpstan": "^0.12.9",
"phpunit/phpunit": "^8.0",
"squizlabs/php_codesniffer": "^3.5.4"
},
"suggest": {
"ext-curl": "*",
"monolog/monolog": "Allows for client-level logging and tracing"
},
"autoload": {
"psr-4": {
"ElasticApm\\": "./src/ElasticApm/"
SergeyKleyman marked this conversation as resolved.
Show resolved Hide resolved
}
},
"autoload-dev": {
"psr-4": {
"ElasticApmTests\\": "./tests/ElasticApmTests/",
"ElasticApmExamples\\": "./examples/ElasticApmExamples/"
}
},
"config": {
"sort-packages": true
},
"scripts": {
"php_codesniffer_check": [
"./vendor/bin/phpcs -s ./src/ElasticApm/",
"./vendor/bin/phpcs -s ./tests/",
"./vendor/bin/phpcs -s ./examples/"
],
"php_codesniffer_fix": [
"./vendor/bin/phpcbf ./src/ElasticApm",
"./vendor/bin/phpcbf ./tests",
"./vendor/bin/phpcbf ./examples/"
],
"phpstan": [
"./vendor/bin/phpstan analyse -c ./phpstan.neon ./src/ElasticApm/ --level max --memory-limit=100M",
"./vendor/bin/phpstan analyse -c ./phpstan.neon ./tests/ --level max --memory-limit=100M",
"./vendor/bin/phpstan analyse -c ./phpstan.neon ./examples/ --level max --memory-limit=100M"
],
"static_check": [
"composer run-script php_codesniffer_check",
"composer run-script phpstan"
],
"test": [
"./vendor/bin/phpunit"
],
"static_check_and_test": [
"composer run-script static_check",
"composer run-script test"
]
}
}
3 changes: 2 additions & 1 deletion docker/wordpress/data/wordpress/php/info.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<?php
phpinfo();

phpinfo();
6 changes: 4 additions & 2 deletions docker/wordpress/data/wordpress/php/wp-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@
// Simple "Chaos monkey" to introduce random errors
//
if(rand(1, 5) == rand(1, 5)) {
throw new Exception("Random Error by Chaos Monkey.");
/** @noinspection PhpUnhandledExceptionInspection */
throw new Exception("Random Error by Chaos Monkey.");
}

//
Expand All @@ -108,4 +109,5 @@
}

/** Sets up WordPress vars and included files. */
require_once( ABSPATH . 'wp-settings.php' );
/** @noinspection PhpIncludeInspection */
require_once(ABSPATH . 'wp-settings.php' );
Loading