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

Commit

Permalink
Merge pull request #20 from Kdyby/php71+
Browse files Browse the repository at this point in the history
drop PHP <=7.0 support, only PHP 7.1 and 7.2 are now supported + support for nette 2.4 only
  • Loading branch information
dakorpar authored Apr 14, 2018
2 parents 78e07b2 + 55904aa commit e7451a9
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 186 deletions.
30 changes: 8 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,24 @@ cache:
- $HOME/.composer/cache

php:
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2

env:
matrix:
- NETTE=nette-2.4-dev
- NETTE=nette-2.4
- NETTE=nette-2.3

matrix:
include:
- php: 5.6
env: NETTE=nette-2.3 COMPOSER_EXTRA_ARGS="--prefer-lowest --prefer-stable"
- php: 7.0
- php: 7.1
env: NETTE=nette-2.4 COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
- php: 7.2
env: NETTE=nette-2.4 COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
exclude:
- php: 5.4
env: NETTE=nette-2.4-dev
- php: 5.4
env: NETTE=nette-2.4
- php: 5.5
env: NETTE=nette-2.4-dev
- php: 5.5
env: NETTE=nette-2.4
allow_failures:
- php: 7.0
- php: 7.1
env: NETTE=nette-2.4 COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
- php: 7.2
env: NETTE=nette-2.4 COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"

before_install:
- travis_retry composer self-update
- wget -O /tmp/composer-nette https://raw.githubusercontent.com/Kdyby/TesterExtras/master/bin/composer-nette.php
Expand All @@ -45,13 +33,11 @@ before_install:
install:
- travis_retry composer update --no-interaction --prefer-dist $COMPOSER_EXTRA_ARGS
- travis_retry composer create-project --no-interaction jakub-onderka/php-parallel-lint /tmp/php-parallel-lint
- travis_retry composer create-project --no-interaction kdyby/code-checker /tmp/code-checker
- travis_retry wget -O /tmp/coveralls.phar https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar

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

after_script:
- if [ "$COVERAGE" != "" ]; then php /tmp/coveralls.phar --verbose --config tests/.coveralls.yml || true; fi
Expand Down
46 changes: 21 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,30 @@
"issues": "https://github.com/Kdyby/ElasticSearch/issues"
},
"require": {
"nette/di": "~2.3@dev",
"tracy/tracy": "~2.3@dev",
"nette/utils": "~2.3@dev",
"nette/di": "~2.4",
"tracy/tracy": "~2.4",
"nette/utils": "~2.4",

"ruflin/elastica": "~2.1|~3.0"
"ruflin/elastica": "~5.0|~6.0"
},
"require-dev": {
"nette/application": "~2.3@dev",
"nette/bootstrap": "~2.3@dev",
"nette/caching": "~2.3@dev",
"nette/component-model": "~2.2@dev",
"nette/database": "~2.3@dev",
"nette/deprecated": "~2.3@dev",
"nette/di": "~2.3@dev",
"nette/finder": "~2.3@dev",
"nette/forms": "~2.3@dev",
"nette/http": "~2.3@dev",
"nette/mail": "~2.3@dev",
"nette/neon": "~2.3@dev",
"nette/php-generator": "~2.3@dev",
"nette/reflection": "~2.3@dev",
"nette/robot-loader": "~2.3@dev",
"nette/safe-stream": "~2.3@dev",
"nette/security": "~2.3@dev",
"nette/tokenizer": "~2.2@dev",
"latte/latte": "~2.3@dev",
"tracy/tracy": "~2.3@dev",
"nette/utils": "~2.3@dev",
"nette/application": "~2.4",
"nette/bootstrap": "~2.4",
"nette/caching": "~2.4",
"nette/component-model": "~2.4",
"nette/database": "~2.4",
"nette/finder": "~2.4",
"nette/forms": "~2.4",
"nette/http": "~2.4",
"nette/mail": "~2.4",
"nette/neon": "~2.4",
"nette/php-generator": "~2.6",
"nette/reflection": "~2.4",
"nette/robot-loader": "~2.4",
"nette/safe-stream": "~2.3",
"nette/security": "~2.4",
"nette/tokenizer": "~2.3",
"latte/latte": "~2.4",

"nette/tester": "~1.7"
},
Expand Down
142 changes: 6 additions & 136 deletions src/Kdyby/ElasticSearch/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,27 @@
class Client extends Elastica\Client
{

use Nette\SmartObject;

public $onSuccess = [];
public $onError = [];



/**
* @param string $path
* @param string $method
* @param array $data
* @param array $query
* @throws \Exception
* @param string $contentType
* @return Elastica\Response
* @throws \Exception
*/
public function request($path, $method = Request::GET, $data = [], array $query = [])
public function request($path, $method = Request::GET, $data = [], array $query = [], $contentType = Request::DEFAULT_CONTENT_TYPE)
{
$begin = microtime(TRUE);

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

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

parent::_log($context);
}

/*************************** Nette\Object ***************************/



/**
* Access to reflection.
*
* @return \Nette\Reflection\ClassType
*/
public static function getReflection()
{
return new Nette\Reflection\ClassType(get_called_class());
}



/**
* Call to undefined method.
*
* @param string $name
* @param array $args
*
* @throws \Nette\MemberAccessException
* @return mixed
*/
public function __call($name, $args)
{
return ObjectMixin::call($this, $name, $args);
}



/**
* Call to undefined static method.
*
* @param string $name
* @param array $args
*
* @throws \Nette\MemberAccessException
* @return mixed
*/
public static function __callStatic($name, $args)
{
return ObjectMixin::callStatic(get_called_class(), $name, $args);
}



/**
* Adding method to class.
*
* @param $name
* @param null $callback
*
* @throws \Nette\MemberAccessException
* @return callable|null
*/
public static function extensionMethod($name, $callback = NULL)
{
if (strpos($name, '::') === FALSE) {
$class = get_called_class();
} else {
list($class, $name) = explode('::', $name);
}
if ($callback === NULL) {
return ObjectMixin::getExtensionMethod($class, $name);
} else {
ObjectMixin::setExtensionMethod($class, $name, $callback);
}
}



/**
* Returns property value. Do not call directly.
*
* @param string $name
*
* @throws \Nette\MemberAccessException
* @return mixed
*/
public function &__get($name)
{
return ObjectMixin::get($this, $name);
}



/**
* Sets value of a property. Do not call directly.
*
* @param string $name
* @param mixed $value
*
* @throws \Nette\MemberAccessException
* @return void
*/
public function __set($name, $value)
{
ObjectMixin::set($this, $name, $value);
}



/**
* Is property defined?
*
* @param string $name
*
* @return bool
*/
public function __isset($name)
{
return ObjectMixin::has($this, $name);
}



/**
* Access to undeclared property.
*
* @param string $name
*
* @throws \Nette\MemberAccessException
* @return void
*/
public function __unset($name)
{
ObjectMixin::remove($this, $name);
}

}
8 changes: 5 additions & 3 deletions src/Kdyby/ElasticSearch/Diagnostics/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
/**
* @author Filip Procházka <filip@prochazka.su>
*/
class Panel extends Nette\Object implements IBarPanel
class Panel implements IBarPanel
{

use Nette\SmartObject;

/**
* @var float
*/
Expand Down Expand Up @@ -243,8 +245,8 @@ public static function renderException($e = NULL)
public function register(Kdyby\ElasticSearch\Client $client)
{
$this->client = $client;
$client->onSuccess[] = $this->success;
$client->onError[] = $this->failure;
$client->onSuccess[] = [$this, 'success'];
$client->onError[] = [$this, 'failure'];

Debugger::getBar()->addPanel($this);
}
Expand Down

0 comments on commit e7451a9

Please sign in to comment.