Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
xboston committed Jul 9, 2019
1 parent 672006a commit a813b33
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MetaHash PHP
# MetaHash API PHP library

PHP library for [#MetaHash](https://metahash.org ) blockchain.
An unofficial PHP library for [#MetaHash](https://metahash.org ) blockchain.

### Requirements

Expand Down
75 changes: 64 additions & 11 deletions src/MetaHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,24 @@
class MetaHash
{
public const HISTORY_LIMIT = 9999;

private const CONNECT_TIMEOUT = 2;
private const TIMEOUT = 150;
private const DEBUG = false;

public const NODE_PROXY = 'PROXY';
public const NODE_TORRENT = 'TORRENT';

public const NETWORK_MAIN = 'main';
public const NETWORK_TEST = 'test';
public const NETWORK_DEV = 'dev';

/**
* @var int
*/
private $connectTimeout = 2;
/**
* @var int
*/
private $timeout = 150;
/**
* @var bool
*/
private $debug = false;
/**
* @var string
*/
Expand All @@ -57,20 +63,67 @@ class MetaHash
private $client;

/**
* Crypto constructor.
*
* MetaHash constructor.
*/
public function __construct()
{
$guzzleOptions = [
'timeout' => self::TIMEOUT,
'connect_timeout' => self::CONNECT_TIMEOUT,
'debug' => self::DEBUG,
'timeout' => $this->getTimeout(),
'connect_timeout' => $this->getConnectTimeout(),
'debug' => $this->getDebug(),
];
$this->setClient(new GuzzleClient($guzzleOptions));
$this->setNetwork(self::NETWORK_MAIN);
}

/**
* @return int
*/
public function getTimeout(): int
{
return $this->timeout;
}

/**
* @param int $timeout
*/
public function setTimeout(int $timeout): void
{
$this->timeout = $timeout;
}

/**
* @return int
*/
public function getConnectTimeout(): int
{
return $this->connectTimeout;
}

/**
* @param int $connectTimeout
*/
public function setConnectTimeout(int $connectTimeout): void
{
$this->connectTimeout = $connectTimeout;
}

/**
* @return bool
*/
public function getDebug(): bool
{
return $this->debug;
}

/**
* @param bool $debug
*/
public function setDebug(bool $debug): void
{
$this->debug = $debug;
}

/**
* Metahash key generate
*
Expand Down

0 comments on commit a813b33

Please sign in to comment.