@@ -67,16 +67,16 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function __construct(string $hostname, string $client_id, string $client_secret, string $username, string $password, $handler = null) |
| 69 | 69 | { |
| 70 | - if(! session_id()) { |
|
| 70 | + if (!session_id()) { |
|
| 71 | 71 | session_start(); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - $sessionKey = 'sharefile-session' . '_' . $hostname . '_' . $client_id . '_' . $client_secret . '_' . $username . '_' . $password; |
|
| 74 | + $sessionKey = 'sharefile-session'.'_'.$hostname.'_'.$client_id.'_'.$client_secret.'_'.$username.'_'.$password; |
|
| 75 | 75 | |
| 76 | - if (! $this->isAuthenticated($sessionKey)) { |
|
| 76 | + if (!$this->isAuthenticated($sessionKey)) { |
|
| 77 | 77 | $response = $this->authenticate($hostname, $client_id, $client_secret, $username, $password, $handler); |
| 78 | 78 | |
| 79 | - if (! isset($response['access_token']) || ! isset($response['subdomain'])) { |
|
| 79 | + if (!isset($response['access_token']) || !isset($response['subdomain'])) { |
|
| 80 | 80 | throw new Exception("Incorrect response from Authentication: 'access_token' or 'subdomain' is missing."); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | |
| 451 | 451 | // First Chunk |
| 452 | 452 | $data = $this->readChunk($stream, $chunkSize); |
| 453 | - while (! ((strlen($data) < $chunkSize) || feof($stream))) { |
|
| 453 | + while (!((strlen($data) < $chunkSize) || feof($stream))) { |
|
| 454 | 454 | $parameters = $this->buildHttpQuery( |
| 455 | 455 | [ |
| 456 | 456 | 'index' => $index, |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | */ |
| 547 | 547 | public function getItemAccessControls(string $itemId, string $userId = ''):array |
| 548 | 548 | { |
| 549 | - if (! empty($userId)) { |
|
| 549 | + if (!empty($userId)) { |
|
| 550 | 550 | return $this->get("AccessControls(principalid={$userId},itemid={$itemId})"); |
| 551 | 551 | } else { |
| 552 | 552 | return $this->get("Items({$itemId})/AccessControls"); |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | protected function readChunk($stream, int $chunkSize) |
| 682 | 682 | { |
| 683 | 683 | $chunk = ''; |
| 684 | - while (! feof($stream) && $chunkSize > 0) { |
|
| 684 | + while (!feof($stream) && $chunkSize > 0) { |
|
| 685 | 685 | $part = fread($stream, $chunkSize); |
| 686 | 686 | if ($part === false) { |
| 687 | 687 | throw new Exception('Error reading from $stream.'); |
@@ -720,8 +720,8 @@ discard block |
||
| 720 | 720 | { |
| 721 | 721 | return http_build_query( |
| 722 | 722 | array_map( |
| 723 | - function ($parameter) { |
|
| 724 | - if (! is_bool($parameter)) { |
|
| 723 | + function($parameter) { |
|
| 724 | + if (!is_bool($parameter)) { |
|
| 725 | 725 | return $parameter; |
| 726 | 726 | } |
| 727 | 727 | |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | */ |
| 742 | 742 | protected function jsonValidator($data = null):bool |
| 743 | 743 | { |
| 744 | - if (! empty($data)) { |
|
| 744 | + if (!empty($data)) { |
|
| 745 | 745 | @json_decode($data); |
| 746 | 746 | |
| 747 | 747 | return json_last_error() === JSON_ERROR_NONE; |