Skip to content

Commit 696cd8a

Browse files
author
desperado
committed
initial commit
1 parent 7c84534 commit 696cd8a

22 files changed

+4324
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/vendor
2+
/bin
3+
/coverage

.php_cs.dist

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
$config = new ServiceBus\CodeStyle\Config();
4+
$config->getFinder()
5+
->in(__DIR__ . '/src')
6+
->in(__DIR__ . '/tests');
7+
8+
$cacheDir = '' !== (string) \getenv('TRAVIS') ? (string) \getenv('HOME') . '/.php-cs-fixer' : __DIR__;
9+
$config->setCacheFile($cacheDir . '/.php_cs.cache');
10+
11+
return $config;

.scrutinizer.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
filter:
2+
paths: [src/*]
3+
excluded_paths: [tests/*]
4+
tools:
5+
php_analyzer: true
6+
php_sim: true
7+
php_pdepend: true
8+
sensiolabs_security_checker: true
9+
php_changetracking: true
10+
php_mess_detector:
11+
enabled: true
12+
config:
13+
ruleset: ~
14+
code_size_rules:
15+
cyclomatic_complexity: true
16+
npath_complexity: true
17+
excessive_method_length: true
18+
excessive_class_length: true
19+
excessive_parameter_list: true
20+
excessive_public_count: true
21+
too_many_fields: true
22+
too_many_methods: true
23+
excessive_class_complexity: true
24+
design_rules:
25+
exit_expression: true
26+
eval_expression: true
27+
goto_statement: true
28+
number_of_class_children: true
29+
depth_of_inheritance: true
30+
coupling_between_objects: true
31+
unused_code_rules:
32+
unused_private_field: true
33+
unused_local_variable: true
34+
unused_private_method: true
35+
unused_formal_parameter: true
36+
naming_rules:
37+
short_variable:
38+
minimum: 3
39+
long_variable:
40+
maximum: 20
41+
short_method:
42+
minimum: 3
43+
constructor_conflict: true
44+
constant_naming: true
45+
boolean_method_name: true
46+
controversial_rules:
47+
superglobals: true
48+
camel_case_class_name: true
49+
camel_case_property_name: true
50+
camel_case_method_name: true
51+
camel_case_parameter_name: true
52+
camel_case_variable_name: true
53+
external_code_coverage:
54+
timeout: 600
55+
checks:
56+
php:
57+
code_rating: true
58+
59+
build:
60+
nodes:
61+
analysis:
62+
project_setup:
63+
override: true
64+
tests:
65+
override:
66+
- php-scrutinizer-run --enable-security-analysis

.travis.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
language: php
2+
3+
php:
4+
- 7.2
5+
- 7.3
6+
- 7.4snapshot
7+
8+
matrix:
9+
allow_failures:
10+
- php: 7.4snapshot
11+
12+
cache:
13+
directories:
14+
- $HOME/.cache/composer
15+
- $HOME/.php-cs-fixer
16+
17+
before_script:
18+
- mkdir -p build/logs
19+
20+
install:
21+
- travis_retry composer install --no-interaction --no-suggest
22+
- travis_retry wget -c -nc --retry-connrefused --tries=0 https://scrutinizer-ci.com/ocular.phar
23+
- chmod +x ocular.phar
24+
- composer show
25+
26+
script:
27+
- ./vendor/bin/phpunit --configuration ./phpunit.xml --coverage-clover=coverage.clover
28+
- if [ "$TRAVIS_PHP_VERSION" == "7.2" ]; then ./vendor/bin/psalm --config=psalm.xml; fi
29+
- if [ "$TRAVIS_PHP_VERSION" == "7.2" ]; then ./vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run; fi
30+
31+
after_script:
32+
- if [ "$TRAVIS_PHP_VERSION" == "7.2" ]; then wget -c -nc --retry-connrefused --tries=0 https://scrutinizer-ci.com/ocular.phar; fi
33+
- if [ "$TRAVIS_PHP_VERSION" == "7.2" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi

CONTRIBUTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
## Contributing
2+
Contributions are welcome. We accept pull requests on [GitHub](https://github.com/php-service-bus/service-bus/issues).
3+
4+
## Workflow
5+
If you have an idea for a new feature, it's a good idea to check out our [issues](https://github.com/php-service-bus/service-bus/issues) or active [pull requests](https://github.com/php-service-bus/service-bus/pulls) first to see if the feature is already being worked on. If not, feel free to submit an issue first, asking whether the feature is beneficial to the project. This will save you from doing a lot of development work only to have your feature rejected. We don't enjoy rejecting your hard work, but some features just don't fit with the goals of the project.
6+
7+
When you do begin working on your feature, here are some guidelines to consider:
8+
* Your pull request description should clearly detail the changes you have made.
9+
* Please write tests for any new features you add.
10+
* Please ensure that tests pass before submitting your pull request.
11+
* Use topic/feature branches. Please do not ask us to pull from your master branch.
12+
* Submit one feature per pull request. If you have multiple features you wish to submit, please break them up into separate pull requests.
13+
* Send coherent history. Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.
14+
15+
## Coding Guidelines
16+
This project comes with a configuration file and an executable for php-cs-fixer (.php_cs.dist) that you can use to (re)format your source code for compliance with this project's coding guidelines:
17+
```bash
18+
composer cs-fix
19+
```
20+
For a simple check of the code standard, there is a command:
21+
```bash
22+
composer cs-check
23+
```
24+
## Static analysis
25+
To improve the quality of the code used static analysis (via `psalm`). You can start it with the command:
26+
```bash
27+
composer psalm
28+
```
29+
## Running the tests
30+
The following tests must pass before we will accept a pull request. If any of these do not pass, it will result in a complete build failure.
31+
```bash
32+
composer tests
33+
```
34+
## Communication Channels
35+
You can find help and discussion in the following places:
36+
* [Telegram chat (RU)](https://t.me/php_service_bus)
37+
* Create issue [https://github.com/php-service-bus/service-bus/issues](https://github.com/php-service-bus/service-bus/issues)
38+
39+
## Security
40+
If you discover any security related issues, please email [`dev@async-php.com`](mailto:dev@async-php.com) instead of using the issue tracker.
41+
42+
## Reporting issues
43+
* [General problems](https://github.com/php-service-bus/service-bus/issues)
44+
* [Documentation](https://github.com/php-service-bus/documentation/issues)

LICENSE renamed to LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 PHP Service Bus
3+
Copyright (c) 2019 Masiukevich Maksim
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## What is it?
2+
3+
This component is part of the [PHP Service Bus](https://github.com/php-service-bus/service-bus):
4+
5+
## Contributing
6+
Contributions are welcome! Please read [CONTRIBUTING](CONTRIBUTING.md) for details.
7+
8+
## Communication Channels
9+
You can find help and discussion in the following places:
10+
* [Telegram chat (RU)](https://t.me/php_service_bus)
11+
* Create issue [https://github.com/php-service-bus/service-bus/issues](https://github.com/php-service-bus/service-bus/issues)
12+
13+
## License
14+
15+
The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.

composer.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "php-service-bus/mutex",
3+
"description": "PHP Mutex implementation",
4+
"type": "library",
5+
"keywords": [
6+
"async-php",
7+
"command-bus",
8+
"messaging"
9+
],
10+
"authors": [
11+
{
12+
"name": "Masiukevich Maksim",
13+
"email": "dev@async-php.com",
14+
"homepage": "https://github.com/mmasiukevich",
15+
"role": "Developer"
16+
}
17+
],
18+
"license": "MIT",
19+
"autoload": {
20+
"psr-4": {
21+
"ServiceBus\\Mutex\\": "src/"
22+
}
23+
},
24+
"autoload-dev": {
25+
"psr-4": {
26+
"ServiceBus\\Mutex\\Tests\\": "tests/"
27+
}
28+
},
29+
"require": {
30+
"php": ">=7.2",
31+
"amphp/amp": "^2",
32+
"amphp/file": "^0.3"
33+
},
34+
"require-dev": {
35+
"php-service-bus/code-style-config": "^v0.1",
36+
"phpunit/phpunit": "^8",
37+
"vimeo/psalm": "^v3"
38+
},
39+
"prefer-stable": true,
40+
"minimum-stability": "dev",
41+
"scripts": {
42+
"psalm": "./vendor/bin/psalm --config=psalm.xml",
43+
"tests": "./vendor/bin/phpunit --configuration phpunit.xml --verbose",
44+
"coverage": "./vendor/bin/phpunit --configuration phpunit.xml --coverage-html ./coverage --verbose",
45+
"cs-check": "./vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run",
46+
"cs-fix": "./vendor/bin/php-cs-fixer fix --allow-risky=yes",
47+
"pre-commit": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes && ./vendor/bin/psalm --config=psalm.xml && ./vendor/bin/phpunit --configuration phpunit.xml --verbose"
48+
},
49+
"config": {
50+
"optimize-autoloader": true
51+
}
52+
}

0 commit comments

Comments
 (0)