Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Commit e7451a9

Browse files
authored
Merge pull request #20 from Kdyby/php71+
drop PHP <=7.0 support, only PHP 7.1 and 7.2 are now supported + support for nette 2.4 only
2 parents 78e07b2 + 55904aa commit e7451a9

File tree

4 files changed

+40
-186
lines changed

4 files changed

+40
-186
lines changed

.travis.yml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,24 @@ cache:
77
- $HOME/.composer/cache
88

99
php:
10-
- 5.4
11-
- 5.5
12-
- 5.6
13-
- 7.0
10+
- 7.1
11+
- 7.2
1412

1513
env:
1614
matrix:
17-
- NETTE=nette-2.4-dev
1815
- NETTE=nette-2.4
19-
- NETTE=nette-2.3
2016

2117
matrix:
2218
include:
23-
- php: 5.6
24-
env: NETTE=nette-2.3 COMPOSER_EXTRA_ARGS="--prefer-lowest --prefer-stable"
25-
- php: 7.0
19+
- php: 7.1
20+
env: NETTE=nette-2.4 COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
21+
- php: 7.2
2622
env: NETTE=nette-2.4 COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
27-
exclude:
28-
- php: 5.4
29-
env: NETTE=nette-2.4-dev
30-
- php: 5.4
31-
env: NETTE=nette-2.4
32-
- php: 5.5
33-
env: NETTE=nette-2.4-dev
34-
- php: 5.5
35-
env: NETTE=nette-2.4
3623
allow_failures:
37-
- php: 7.0
24+
- php: 7.1
25+
env: NETTE=nette-2.4 COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
26+
- php: 7.2
3827
env: NETTE=nette-2.4 COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
39-
4028
before_install:
4129
- travis_retry composer self-update
4230
- wget -O /tmp/composer-nette https://raw.githubusercontent.com/Kdyby/TesterExtras/master/bin/composer-nette.php
@@ -45,13 +33,11 @@ before_install:
4533
install:
4634
- travis_retry composer update --no-interaction --prefer-dist $COMPOSER_EXTRA_ARGS
4735
- travis_retry composer create-project --no-interaction jakub-onderka/php-parallel-lint /tmp/php-parallel-lint
48-
- travis_retry composer create-project --no-interaction kdyby/code-checker /tmp/code-checker
4936
- travis_retry wget -O /tmp/coveralls.phar https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
5037

5138
script:
5239
- vendor/bin/tester $COVERAGE -s -p ${TESTER_RUNTIME:-php} -c ./tests/php.ini-unix ./tests/KdybyTests/
5340
- php /tmp/php-parallel-lint/parallel-lint.php -e php,phpt --exclude vendor .
54-
- php /tmp/code-checker/src/code-checker.php --short-arrays
5541

5642
after_script:
5743
- if [ "$COVERAGE" != "" ]; then php /tmp/coveralls.phar --verbose --config tests/.coveralls.yml || true; fi

composer.json

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,30 @@
1717
"issues": "https://github.com/Kdyby/ElasticSearch/issues"
1818
},
1919
"require": {
20-
"nette/di": "~2.3@dev",
21-
"tracy/tracy": "~2.3@dev",
22-
"nette/utils": "~2.3@dev",
20+
"nette/di": "~2.4",
21+
"tracy/tracy": "~2.4",
22+
"nette/utils": "~2.4",
2323

24-
"ruflin/elastica": "~2.1|~3.0"
24+
"ruflin/elastica": "~5.0|~6.0"
2525
},
2626
"require-dev": {
27-
"nette/application": "~2.3@dev",
28-
"nette/bootstrap": "~2.3@dev",
29-
"nette/caching": "~2.3@dev",
30-
"nette/component-model": "~2.2@dev",
31-
"nette/database": "~2.3@dev",
32-
"nette/deprecated": "~2.3@dev",
33-
"nette/di": "~2.3@dev",
34-
"nette/finder": "~2.3@dev",
35-
"nette/forms": "~2.3@dev",
36-
"nette/http": "~2.3@dev",
37-
"nette/mail": "~2.3@dev",
38-
"nette/neon": "~2.3@dev",
39-
"nette/php-generator": "~2.3@dev",
40-
"nette/reflection": "~2.3@dev",
41-
"nette/robot-loader": "~2.3@dev",
42-
"nette/safe-stream": "~2.3@dev",
43-
"nette/security": "~2.3@dev",
44-
"nette/tokenizer": "~2.2@dev",
45-
"latte/latte": "~2.3@dev",
46-
"tracy/tracy": "~2.3@dev",
47-
"nette/utils": "~2.3@dev",
27+
"nette/application": "~2.4",
28+
"nette/bootstrap": "~2.4",
29+
"nette/caching": "~2.4",
30+
"nette/component-model": "~2.4",
31+
"nette/database": "~2.4",
32+
"nette/finder": "~2.4",
33+
"nette/forms": "~2.4",
34+
"nette/http": "~2.4",
35+
"nette/mail": "~2.4",
36+
"nette/neon": "~2.4",
37+
"nette/php-generator": "~2.6",
38+
"nette/reflection": "~2.4",
39+
"nette/robot-loader": "~2.4",
40+
"nette/safe-stream": "~2.3",
41+
"nette/security": "~2.4",
42+
"nette/tokenizer": "~2.3",
43+
"latte/latte": "~2.4",
4844

4945
"nette/tester": "~1.7"
5046
},

src/Kdyby/ElasticSearch/Client.php

Lines changed: 6 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,27 @@
2424
class Client extends Elastica\Client
2525
{
2626

27+
use Nette\SmartObject;
28+
2729
public $onSuccess = [];
2830
public $onError = [];
2931

3032

31-
3233
/**
3334
* @param string $path
3435
* @param string $method
3536
* @param array $data
3637
* @param array $query
37-
* @throws \Exception
38+
* @param string $contentType
3839
* @return Elastica\Response
40+
* @throws \Exception
3941
*/
40-
public function request($path, $method = Request::GET, $data = [], array $query = [])
42+
public function request($path, $method = Request::GET, $data = [], array $query = [], $contentType = Request::DEFAULT_CONTENT_TYPE)
4143
{
4244
$begin = microtime(TRUE);
4345

4446
try {
45-
$response = parent::request($path, $method, $data, $query);
47+
$response = parent::request($path, $method, $data, $query, $contentType);
4648
$this->onSuccess($this, $this->_lastRequest, $response, microtime(TRUE) - $begin);
4749

4850
return $response;
@@ -63,136 +65,4 @@ protected function _log($context)
6365

6466
parent::_log($context);
6567
}
66-
67-
/*************************** Nette\Object ***************************/
68-
69-
70-
71-
/**
72-
* Access to reflection.
73-
*
74-
* @return \Nette\Reflection\ClassType
75-
*/
76-
public static function getReflection()
77-
{
78-
return new Nette\Reflection\ClassType(get_called_class());
79-
}
80-
81-
82-
83-
/**
84-
* Call to undefined method.
85-
*
86-
* @param string $name
87-
* @param array $args
88-
*
89-
* @throws \Nette\MemberAccessException
90-
* @return mixed
91-
*/
92-
public function __call($name, $args)
93-
{
94-
return ObjectMixin::call($this, $name, $args);
95-
}
96-
97-
98-
99-
/**
100-
* Call to undefined static method.
101-
*
102-
* @param string $name
103-
* @param array $args
104-
*
105-
* @throws \Nette\MemberAccessException
106-
* @return mixed
107-
*/
108-
public static function __callStatic($name, $args)
109-
{
110-
return ObjectMixin::callStatic(get_called_class(), $name, $args);
111-
}
112-
113-
114-
115-
/**
116-
* Adding method to class.
117-
*
118-
* @param $name
119-
* @param null $callback
120-
*
121-
* @throws \Nette\MemberAccessException
122-
* @return callable|null
123-
*/
124-
public static function extensionMethod($name, $callback = NULL)
125-
{
126-
if (strpos($name, '::') === FALSE) {
127-
$class = get_called_class();
128-
} else {
129-
list($class, $name) = explode('::', $name);
130-
}
131-
if ($callback === NULL) {
132-
return ObjectMixin::getExtensionMethod($class, $name);
133-
} else {
134-
ObjectMixin::setExtensionMethod($class, $name, $callback);
135-
}
136-
}
137-
138-
139-
140-
/**
141-
* Returns property value. Do not call directly.
142-
*
143-
* @param string $name
144-
*
145-
* @throws \Nette\MemberAccessException
146-
* @return mixed
147-
*/
148-
public function &__get($name)
149-
{
150-
return ObjectMixin::get($this, $name);
151-
}
152-
153-
154-
155-
/**
156-
* Sets value of a property. Do not call directly.
157-
*
158-
* @param string $name
159-
* @param mixed $value
160-
*
161-
* @throws \Nette\MemberAccessException
162-
* @return void
163-
*/
164-
public function __set($name, $value)
165-
{
166-
ObjectMixin::set($this, $name, $value);
167-
}
168-
169-
170-
171-
/**
172-
* Is property defined?
173-
*
174-
* @param string $name
175-
*
176-
* @return bool
177-
*/
178-
public function __isset($name)
179-
{
180-
return ObjectMixin::has($this, $name);
181-
}
182-
183-
184-
185-
/**
186-
* Access to undeclared property.
187-
*
188-
* @param string $name
189-
*
190-
* @throws \Nette\MemberAccessException
191-
* @return void
192-
*/
193-
public function __unset($name)
194-
{
195-
ObjectMixin::remove($this, $name);
196-
}
197-
19868
}

src/Kdyby/ElasticSearch/Diagnostics/Panel.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525
/**
2626
* @author Filip Procházka <filip@prochazka.su>
2727
*/
28-
class Panel extends Nette\Object implements IBarPanel
28+
class Panel implements IBarPanel
2929
{
3030

31+
use Nette\SmartObject;
32+
3133
/**
3234
* @var float
3335
*/
@@ -243,8 +245,8 @@ public static function renderException($e = NULL)
243245
public function register(Kdyby\ElasticSearch\Client $client)
244246
{
245247
$this->client = $client;
246-
$client->onSuccess[] = $this->success;
247-
$client->onError[] = $this->failure;
248+
$client->onSuccess[] = [$this, 'success'];
249+
$client->onError[] = [$this, 'failure'];
248250

249251
Debugger::getBar()->addPanel($this);
250252
}

0 commit comments

Comments
 (0)