Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit 4c2d04d

Browse files
committed
Merge branch 'release/0.8.2'
2 parents e0141ff + 4e1893c commit 4c2d04d

21 files changed

Lines changed: 337 additions & 184 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ vendor
44
cover
55
*.phar
66
/composer.phar
7+
/phpDocumentor.phar
78
/composer.lock
9+
/docs/api
810
build
911
.idea

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ before_script:
1717
- make deps
1818
script:
1919
- mkdir -p build/logs
20+
- make lint
2021
- make test
2122
after_script:
2223
- php vendor/bin/coveralls

Makefile

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
1-
lint:
1+
lint: lint-php lint-psr2 lint-squiz
2+
3+
.PHONY: lint-php
4+
lint-php:
25
find src -name *.php -exec php -l {} \;
36
find test -name *.php -exec php -l {} \;
47
find spec -name *.php -exec php -l {} \;
58
find examples -name *.php -exec php -l {} \;
69

7-
cs: lint
8-
./vendor/bin/phpcbf --standard=PSR2 src test examples
9-
./vendor/bin/phpcs --standard=PSR2 --warning-severity=0 src test examples
10-
./vendor/bin/phpcs --standard=Squiz --sniffs=Squiz.Commenting.FunctionComment,Squiz.Commenting.FunctionCommentThrowTag,Squiz.Commenting.ClassComment,Squiz.Commenting.VariableComment src test examples
10+
.PHONY: lint-psr2
11+
lint-psr2:
12+
#./vendor/bin/phpcbf --standard=PSR2 src test examples
13+
./vendor/bin/phpcs --standard=PSR2 --colors -w -s --warning-severity=0 src test examples
14+
15+
.PHONY: lint-squiz
16+
lint-squiz:
17+
# ./vendor/bin/phpcbf --standard=Squiz,./ruleset.xml src test examples
18+
./vendor/bin/phpcs --standard=Squiz,./ruleset.xml --colors -w -s --warning-severity=0 src test examples
19+
1120

12-
test: tdd bdd
21+
test: test-tdd test-bdd
1322

14-
tdd:
23+
.PHONY: test-tdd
24+
test-tdd:
1525
./vendor/bin/phpunit test
1626

17-
bdd:
27+
.PHONY: test-bdd
28+
test-bdd:
1829
./vendor/bin/phpspec run --format=pretty -v
1930

2031
cover:
2132
./vendor/bin/phpunit --coverage-html ./cover test
33+
2234
deps:
2335
wget -q https://getcomposer.org/composer.phar -O ./composer.phar
2436
chmod +x composer.phar
@@ -29,8 +41,16 @@ dist-clean:
2941
rm -rf vendor
3042
rm -f composer.phar
3143
rm -f composer.lock
44+
rm -f phpDocumentor.phar
45+
rm -rf docs/api
3246

3347
docker-nats:
3448
docker run --rm -p 8222:8222 -p 4222:4222 -d --name nats-main nats
3549

36-
.PHONY: lint test cs cover deps dist-clean
50+
phpdoc:
51+
wget -q https://github.com/phpDocumentor/phpDocumentor2/releases/download/v2.9.0/phpDocumentor.phar -O ./phpDocumentor.phar
52+
chmod +x phpDocumentor.phar
53+
./phpDocumentor.phar -d ./src/ -t ./docs/api --template=checkstyle --template=responsive-twig
54+
55+
serve-phpdoc:
56+
cd docs/api && php -S localhost:8000 && cd ../..

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ phpnats
33

44
**Travis**
55

6-
* Master: [![Build Status](https://travis-ci.org/repejota/phpnats.png?branch=master)](https://travis-ci.org/repejota/phpnats)
7-
* Develop: [![Build Status](https://travis-ci.org/repejota/phpnats.png?branch=develop)](https://travis-ci.org/repejota/phpnats)
6+
| Master | Develop |
7+
| ------------- | ------------- |
8+
| [![Build Status](https://travis-ci.org/repejota/phpnats.png?branch=master)](https://travis-ci.org/repejota/phpnats) | [![Build Status](https://travis-ci.org/repejota/phpnats.png?branch=develop)](https://travis-ci.org/repejota/phpnats) |
89

910
**Coverage**
1011

11-
* Master: [![Coverage Status](https://coveralls.io/repos/repejota/phpnats/badge.svg?branch=master)](https://coveralls.io/r/repejota/phpnats?branch=master)
12-
* Develop: [![Coverage Status](https://coveralls.io/repos/repejota/phpnats/badge.svg?branch=develop)](https://coveralls.io/r/repejota/phpnats?branch=develop)
12+
| Master | Develop |
13+
| ------------- | ------------- |
14+
| [![Coverage Status](https://coveralls.io/repos/repejota/phpnats/badge.svg?branch=master)](https://coveralls.io/r/repejota/phpnats?branch=master) | [![Coverage Status](https://coveralls.io/repos/repejota/phpnats/badge.svg?branch=develop)](https://coveralls.io/r/repejota/phpnats?branch=develop) |
1315

1416
Introduction
1517
------------
@@ -88,23 +90,33 @@ Developer's Information
8890

8991
### Releases
9092

91-
[Latest stable](https://github.com/repejota/phpnats/tree/master)
92-
[Latest dev](https://github.com/repejota/phpnats/tree/develop)
93+
* [Latest stable](https://github.com/repejota/phpnats/tree/master)
94+
* [Latest dev](https://github.com/repejota/phpnats/tree/develop)
95+
96+
* [PHPNats on Packagist](https://packagist.org/packages/repejota/nats)
9397

9498
### Tests
9599

96100
Tests are in the `tests` folder.
97-
To run them, you need `PHPUnit` and execute `make test`.
101+
To run them, you need `PHPUnit` and execute `make test-tdd`.
98102

99103
We also have a BDD test suite under the `spec` folder.
100-
To run the suite, you need `PHPSpec` and execute `make bdd`.
104+
To run the suite, you need `PHPSpec` and execute `make test-bdd`.
105+
106+
You can also execute the all suites ( TDD + BDD ) with `make test`.
101107

102108
### Code Quality
103109

104110
We are using [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer/docs)
105111
to ensure our code follow an high quality standard.
106112

107-
To perform an analysis of the code execute `make cs`.
113+
To perform an analysis of the code execute `make lint`.
114+
115+
There is currently three steps when we lint our code:
116+
117+
* First we lint with php itself `php -l`
118+
* Then we lint with PSR2 standard
119+
* And finally we lint with a custom [ruleset.xml](https://github.com/repejota/phpnats/blob/feature/lint-squiz/ruleset.xml) that checks dockblocks and different performance tips.
108120

109121

110122
Creators

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.8.1
1+
0.8.2

examples/connect.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<?php
2-
require_once __DIR__ . "/../vendor/autoload.php";
2+
require_once __DIR__.'/../vendor/autoload.php';
33

44
$connectionOptions = new \Nats\ConnectionOptions();
5-
$connectionOptions
6-
->setHost('localhost')
7-
->setPort(4222);
5+
$connectionOptions->setHost('localhost')->setPort(4222);
86
$c = new Nats\Connection($connectionOptions);
97
$c->connect();
108
$c->close();

examples/connectauth.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
<?php
2-
require_once __DIR__ . "/../vendor/autoload.php";
2+
require_once __DIR__.'/../vendor/autoload.php';
33

44
$connectionOptions = new \Nats\ConnectionOptions();
5-
$connectionOptions
6-
->setHost('localhost')
7-
->setPort(4222)
8-
->setUser("foo")
9-
->setPass("bar");
5+
$connectionOptions->setHost('localhost')->setPort(4222)->setUser('foo')->setPass('bar');
106
$c = new Nats\Connection($connectionOptions);
117
$c->connect();
128
$c->close();

examples/ping.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
<?php
2-
require_once __DIR__ . "/../vendor/autoload.php";
2+
require_once __DIR__.'/../vendor/autoload.php';
33

44
$connectionOptions = new \Nats\ConnectionOptions();
5-
$connectionOptions
6-
->setHost('localhost')
7-
->setPort(4222);
5+
$connectionOptions->setHost('localhost')->setPort(4222);
86

9-
echo "Server: nats://" . $connectionOptions->getHost() . ":" . $connectionOptions->getPort() . PHP_EOL;
7+
echo 'Server: nats://'.$connectionOptions->getHost().':'.$connectionOptions->getPort().PHP_EOL;
108

119
$c = new Nats\Connection($connectionOptions);
1210
$c->connect();

examples/pubsub/pub.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
<?php
2-
require_once __DIR__ . "/../../vendor/autoload.php";
2+
require_once __DIR__.'/../../vendor/autoload.php';
33

44
$connectionOptions = new \Nats\ConnectionOptions();
5-
$connectionOptions
6-
->setHost('localhost')
7-
->setPort(4222);
5+
$connectionOptions->setHost('localhost')->setPort(4222);
86
$c = new Nats\Connection($connectionOptions);
97
$c->connect();
108

119
$c->reconnect();
1210

13-
$c->publish("foo", "bar");
14-
$c->publish("foo", "bar");
15-
$c->publish("foo", "bar");
16-
$c->publish("foo", "bar");
17-
$c->publish("foo", "bar");
11+
$c->publish('foo', 'bar');
12+
$c->publish('foo', 'bar');
13+
$c->publish('foo', 'bar');
14+
$c->publish('foo', 'bar');
15+
$c->publish('foo', 'bar');

examples/pubsub/sub.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
<?php
2-
require_once __DIR__ . "/../../vendor/autoload.php";
2+
require_once __DIR__.'/../../vendor/autoload.php';
33

44
$connectionOptions = new \Nats\ConnectionOptions();
5-
$connectionOptions
6-
->setHost('localhost')
7-
->setPort(4222);
5+
$connectionOptions->setHost('localhost')->setPort(4222);
86
$c = new Nats\Connection($connectionOptions);
97
$c->connect();
108

119
$callback = function ($payload) {
1210
printf("Data: %s\r\n", $payload);
1311
};
1412

15-
$sid = $c->subscribe("foo", $callback);
13+
$sid = $c->subscribe('foo', $callback);
1614

1715
$c->wait(2);
1816

0 commit comments

Comments
 (0)