Skip to content

Commit 1274949

Browse files
author
Martin Brecht-Precht
committed
Implemented the basic request architecture.
1 parent 00ae8ab commit 1274949

File tree

13 files changed

+951
-170
lines changed

13 files changed

+951
-170
lines changed

src/Base/HttpRequestHeader.php

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/Base/HttpResponseHeader.php

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/HttpClient.php renamed to src/BasicHttpClient.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22

33
namespace BasicHttpClient;
44

5-
class HttpClient
5+
use BasicHttpClient\Request\Request;
6+
7+
class BasicHttpClient
68
{
79

10+
/**
11+
* @var Request
12+
*/
13+
private $request;
14+
815
/**
916
* Request methods
1017
*/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace BasicHttpClient\Request\Authentication\Base;
4+
5+
/**
6+
* Interface AuthenticationInterface
7+
*
8+
* @package BasicHttpClient\Request\Authentication\Base
9+
*/
10+
interface AuthenticationInterface
11+
{
12+
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace BasicHttpClient\Request\Message\Body\Base;
4+
5+
/**
6+
* Interface BodyInterface
7+
*
8+
* @package BasicHttpClient\Request\Message\Body\Base
9+
*/
10+
interface BodyInterface
11+
{
12+
13+
}

src/Request/Message/Body/Body.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace BasicHttpClient\Request\Message\Body;
4+
5+
/**
6+
* Class Body
7+
*
8+
* @package BasicHttpClient\Request\Message\Body
9+
*/
10+
class Body implements Base\BodyInterface
11+
{
12+
13+
}
Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,27 @@
11
<?php
22

3-
namespace Propeller\Lib\HttpClient\Base;
3+
namespace BasicHttpClient\Request\Message\Cookie;
44

55
/**
6-
* HTTP request cookie class
6+
* Class Cookie
77
*
8-
* Exception code range: `25000`
9-
*
10-
* @package Propeller
11-
* @author Martin Brecht-Precht (mb@markenwerk.net)
12-
* @date 2014-06-12 16:16:41 +0000
8+
* @package BasicHttpClient\Request\Message\Cookie
139
*/
14-
class HttpRequestCookie
10+
class Cookie
1511
{
1612

1713
/**
18-
* The request header name
19-
*
2014
* @var string
2115
*/
2216
private $name;
2317

2418
/**
25-
* The request header value
26-
*
2719
* @var string
2820
*/
2921
private $value;
3022

3123
/**
32-
* The constructor
24+
* Header constructor.
3325
*
3426
* @param string $name
3527
* @param string $value
@@ -41,8 +33,14 @@ public function __construct($name, $value)
4133
}
4234

4335
/**
44-
* Setter for the request header name
45-
*
36+
* @return string
37+
*/
38+
public function getName()
39+
{
40+
return $this->name;
41+
}
42+
43+
/**
4644
* @param string $name
4745
* @return $this
4846
*/
@@ -53,18 +51,14 @@ public function setName($name)
5351
}
5452

5553
/**
56-
* Getter for the request header name
57-
*
5854
* @return string
5955
*/
60-
public function getName()
56+
public function getValue()
6157
{
62-
return $this->name;
58+
return $this->value;
6359
}
6460

6561
/**
66-
* Setter for the request header value
67-
*
6862
* @param string $value
6963
* @return $this
7064
*/
@@ -74,14 +68,4 @@ public function setValue($value)
7468
return $this;
7569
}
7670

77-
/**
78-
* Getter for the request header value
79-
*
80-
* @return string
81-
*/
82-
public function getValue()
83-
{
84-
return $this->value;
85-
}
86-
8771
}

src/Request/Message/Header/Header.php

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?php
2+
3+
namespace BasicHttpClient\Request\Message\Header;
4+
5+
use BasicHttpClient\Util\HeaderNameNormalizer;
6+
7+
/**
8+
* Class Header
9+
*
10+
* @package BasicHttpClient\Request\Message\Header
11+
*/
12+
class Header
13+
{
14+
15+
/**
16+
* @var string
17+
*/
18+
private $name;
19+
20+
/**
21+
* @var string[]
22+
*/
23+
private $values;
24+
25+
/**
26+
* Header constructor.
27+
*
28+
* @param string $name
29+
* @param string[] $values
30+
*/
31+
public function __construct($name, array $values)
32+
{
33+
$this->name = $name;
34+
$this->values = $values;
35+
}
36+
37+
/**
38+
* @return string
39+
*/
40+
public function getName()
41+
{
42+
return $this->name;
43+
}
44+
45+
/**
46+
* @return string
47+
*/
48+
public function getNormalizedName()
49+
{
50+
$normalizer = new HeaderNameNormalizer();
51+
return $normalizer->normalizeHeaderName($this->name);
52+
}
53+
54+
/**
55+
* @param string $name
56+
* @return $this
57+
*/
58+
public function setName($name)
59+
{
60+
$this->name = $name;
61+
return $this;
62+
}
63+
64+
/**
65+
* @return \string[]
66+
*/
67+
public function getValues()
68+
{
69+
return $this->values;
70+
}
71+
72+
/**
73+
* @param \string[] $values
74+
* @return $this
75+
*/
76+
public function setValues($values)
77+
{
78+
$this->values = $values;
79+
return $this;
80+
}
81+
82+
}

0 commit comments

Comments
 (0)