Skip to content

Commit

Permalink
- Better nette 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Nov 15, 2019
1 parent 6386e92 commit b7088ac
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/IPub/MQTTClient/Client/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ public function __construct(
public function getUri() : string
{
if ($this->httpHost !== NULL) {
return $this->httpHost .':'. $this->port;
return $this->httpHost . ':' . $this->port;

} elseif ($this->address !== NULL) {
return $this->address .':'. $this->port;
return $this->address . ':' . $this->port;
}

throw new Exceptions\InvalidStateException('Broker http host or address is not specified');
Expand Down
24 changes: 12 additions & 12 deletions src/IPub/MQTTClient/DI/MQTTClientExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ public function loadConfiguration()
{
// Get container builder
$builder = $this->getContainerBuilder();

// Merge extension default config
$this->setConfig(DI\Config\Helpers::merge($this->config, DI\Helpers::expand($this->defaults, $builder->parameters)));

// Get extension configuration
$configuration = $this->getConfig();
/** @var array $configuration */
if (method_exists($this, 'validateConfig')) {
$configuration = $this->validateConfig($this->defaults);
} else {
$configuration = $this->getConfig($this->defaults);
}

if ($configuration['loop'] === NULL) {
if ($builder->getByType(React\EventLoop\LoopInterface::class) === NULL) {
Expand Down Expand Up @@ -161,12 +161,12 @@ public function beforeCompile()

// Get container builder
$builder = $this->getContainerBuilder();

// Merge extension default config
$this->setConfig(DI\Config\Helpers::merge($this->config, DI\Helpers::expand($this->defaults, $builder->parameters)));

// Get extension configuration
$configuration = $this->getConfig();
/** @var array $configuration */
if (method_exists($this, 'validateConfig')) {
$configuration = $this->validateConfig($this->defaults);
} else {
$configuration = $this->getConfig($this->defaults);
}

// Get container builder
$builder = $this->getContainerBuilder();
Expand Down
1 change: 1 addition & 0 deletions src/IPub/MQTTClient/Logger/Formatter/IFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function error(string $message);
* @return void
*/
function warning(string $message);

/**
* @param string $message
*
Expand Down
1 change: 1 addition & 0 deletions tests/IPubTests/MQTTClient/ExtensionTest.phpt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
/**
* Test: IPub\MQTTClient\Extension
*
* @testCase
*
* @copyright More in license.md
Expand Down
6 changes: 3 additions & 3 deletions tests/IPubTests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
Tester\Helpers::purge(TEMP_DIR);
\Tracy\Debugger::$logDirectory = TEMP_DIR;

$_SERVER = array_intersect_key($_SERVER, array_flip(array(
'PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS', 'argc', 'argv')));
$_SERVER = array_intersect_key($_SERVER, array_flip([
'PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS', 'argc', 'argv']));
$_SERVER['REQUEST_TIME'] = 1234567890;
$_ENV = $_GET = $_POST = array();
$_ENV = $_GET = $_POST = [];

function id($val)
{
Expand Down

0 comments on commit b7088ac

Please sign in to comment.