|
...
|
...
|
@@ -39,11 +39,9 @@ abstract class Request implements RequestInterface |
|
|
|
|
|
|
|
protected function initialize() { }
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param string $name
|
|
|
|
* @param $value
|
|
|
|
*
|
|
|
|
* @return false
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function append(string $name, $value): bool
|
|
|
|
{
|
|
...
|
...
|
@@ -61,7 +59,7 @@ abstract class Request implements RequestInterface |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function getMethod(): string
|
|
|
|
{
|
|
...
|
...
|
@@ -69,7 +67,7 @@ abstract class Request implements RequestInterface |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function getPath(): string
|
|
|
|
{
|
|
...
|
...
|
@@ -77,7 +75,7 @@ abstract class Request implements RequestInterface |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function getContentType(): string
|
|
|
|
{
|
|
...
|
...
|
@@ -85,7 +83,7 @@ abstract class Request implements RequestInterface |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function getVersion(): string
|
|
|
|
{
|
|
...
|
...
|
@@ -93,7 +91,7 @@ abstract class Request implements RequestInterface |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function toArray(): array
|
|
|
|
{
|
|
...
|
...
|
@@ -101,13 +99,25 @@ abstract class Request implements RequestInterface |
|
|
|
$properties = $reflection->getProperties(ReflectionProperty::IS_PUBLIC);
|
|
|
|
$array = [];
|
|
|
|
foreach (Arr::pluck($properties, 'name') as $property) {
|
|
|
|
if ($this->propertyIsNotNull($property)) {
|
|
|
|
$array[$this->getPropertyAlias($property, $property)] = $this->{$property};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $array;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $property
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
protected function propertyIsNotNull($property): bool
|
|
|
|
{
|
|
|
|
return !is_null($this->{$property});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $key
|
|
|
|
*
|
|
|
|
* @return bool
|
|
...
|
...
|
@@ -133,7 +143,7 @@ abstract class Request implements RequestInterface |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function toString(): string
|
|
|
|
{
|
|
...
|
...
|
@@ -141,7 +151,7 @@ abstract class Request implements RequestInterface |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return $this
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function __invoke(): RequestInterface
|
|
|
|
{
|
...
|
...
|
|