Skip to content

Commit 1c786fd

Browse files
author
Wazabii
committed
Minor structure changes
1 parent 513b1e6 commit 1c786fd

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

Interfaces/MessageInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,11 @@ public function withBody(StreamInterface $body);
161161
* But is used by the framework
162162
*
163163
*/
164+
165+
/**
166+
* Get header value data items
167+
* @param string $name name/key (case insensitive)
168+
* @return array
169+
*/
170+
public function getHeaderLineData(string $name): array;
164171
}

Interfaces/RequestInterface.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,10 @@ public function withUri(UriInterface $uri, $preserveHost = false);
139139
* @return array
140140
*/
141141
public function getCliArgs(): array;
142+
143+
/**
144+
* Chech if is request is SSL
145+
* @return bool
146+
*/
147+
public function isSSL(): bool;
142148
}

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,29 @@ $stream = new Http\Stream(
6161
(string) permission
6262
);
6363
```
64-
#### Basic stream example
64+
### Basic stream examples
65+
66+
#### Write to stream
6567
```php
6668
$stream = new Http\Stream(Http\Stream:TEMP);
6769
$stream->write("Hello world");
6870
$stream->seek(0);
6971
echo $stream->read(); // Hello world
72+
```
7073

74+
#### Get file content with stream
75+
```php
76+
$stream = new Http\Stream("/var/www/html/YourApp/dir/dir/data.json");
77+
echo $stream->getContents();
78+
```
79+
80+
#### Upload a stream to the server
81+
```php
7182
$upload = new Http\UploadedFile($stream);
7283
$upload->moveTo("/var/www/html/upload/log.txt"); // Place Hello world in txt file
7384
```
7485

75-
#### Create a request (The PSR way)
86+
### Create a request
7687
The client will be using curl, so it's essential to ensure that it is enabled in case it has been disabled for any reason.
7788
```php
7889
// Init request client
@@ -92,4 +103,3 @@ $response = $client->sendRequest($request);
92103
// Get Stream data
93104
var_dump($response->getBody()->getContents());
94105
```
95-

Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function withUri(UriInterface $uri, $preserveHost = false): RequestInterf
104104

105105
/**
106106
* Chech if is request is SSL
107-
* @return boolean [description]
107+
* @return bool
108108
*/
109109
public function isSSL(): bool
110110
{

Url.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,10 @@ public function getUrl(string $addToPath = ""): string
281281
{
282282
$url = $this->getRoot("", true);
283283
if ($path = $this->getRealPath()) {
284+
$path = ltrim($path, "/");
284285
$url .= "{$path}";
286+
} else {
287+
$addToPath = ltrim($addToPath, "/");
285288
}
286289
return $url . $addToPath;
287290
}

0 commit comments

Comments
 (0)