Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factory aware interfaces & traits #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
composer.lock
vendor/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# PSR-17 HTTP Factory Utilities
40 changes: 40 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "psr/http-factory-util",
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"psr",
"psr-7",
"psr-17",
"http",
"factory",
"message",
"request",
"response"
],
"license": "MIT",
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"require": {
"php": ">=7.0.0"
},
"require-dev": {
"psr/http-factory": "^1.0"
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"config": {
"lock": false
}
}
9 changes: 9 additions & 0 deletions src/RequestFactoryAwareInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Psr\Http\Message;

interface RequestFactoryAwareInterface{

public function setRequestFactory(RequestFactoryInterface $requestFactory): RequestFactoryAwareInterface;

}
16 changes: 16 additions & 0 deletions src/RequestFactoryAwareTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Psr\Http\Message;

trait RequestFactoryAwareTrait{

/** @var \Psr\Http\Message\RequestFactoryInterface */
protected $requestFactory;

public function setRequestFactory(RequestFactoryInterface $requestFactory): RequestFactoryAwareInterface{
$this->requestFactory = $requestFactory;

return $this;
}

}
9 changes: 9 additions & 0 deletions src/ResponseFactoryAwareInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Psr\Http\Message;

interface ResponseFactoryAwareInterface{

public function setResponseFactory(ResponseFactoryInterface $responseFactory): ResponseFactoryAwareInterface;

}
16 changes: 16 additions & 0 deletions src/ResponseFactoryAwareTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Psr\Http\Message;

trait ResponseFactoryAwareTrait{

/** @var \Psr\Http\Message\ResponseFactoryInterface */
protected $responseFactory;

public function setResponseFactory(ResponseFactoryInterface $responseFactory): ResponseFactoryAwareInterface{
$this->responseFactory = $responseFactory;

return $this;
}

}
9 changes: 9 additions & 0 deletions src/ServerRequestFactoryAwareInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Psr\Http\Message;

interface ServerRequestFactoryAwareInterface{

public function setServerRequestFactory(ServerRequestFactoryInterface $serverRequestFactory): ServerRequestFactoryAwareInterface;

}
16 changes: 16 additions & 0 deletions src/ServerRequestFactoryAwareTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Psr\Http\Message;

trait ServerRequestFactoryAwareTrait{

/** @var \Psr\Http\Message\ServerRequestFactoryInterface */
protected $serverRequestFactory;

public function setServerRequestFactory(ServerRequestFactoryInterface $serverRequestFactory): ServerRequestFactoryAwareInterface{
$this->serverRequestFactory = $serverRequestFactory;

return $this;
}

}
9 changes: 9 additions & 0 deletions src/StreamFactoryAwareInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Psr\Http\Message;

interface StreamFactoryAwareInterface{

public function setStreamFactory(StreamFactoryInterface $streamFactory): StreamFactoryAwareInterface;

}
16 changes: 16 additions & 0 deletions src/StreamFactoryAwareTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Psr\Http\Message;

trait StreamFactoryAwareTrait{

/** @var \Psr\Http\Message\StreamFactoryInterface */
protected $streamFactory;

public function setStreamFactory(StreamFactoryInterface $streamFactory): StreamFactoryAwareInterface{
$this->streamFactory = $streamFactory;

return $this;
}

}
9 changes: 9 additions & 0 deletions src/UploadedFileFactoryAwareInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Psr\Http\Message;

interface UploadedFileFactoryAwareInterface{

public function setUploadedFileFactory(UploadedFileFactoryInterface $uploadedFileFactory): UploadedFileFactoryAwareInterface;

}
16 changes: 16 additions & 0 deletions src/UploadedFileFactoryAwareTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Psr\Http\Message;

trait UploadedFileFactoryAwareTrait{

/** @var \Psr\Http\Message\UploadedFileFactoryInterface */
protected $uploadedFileFactory;

public function setUploadedFileFactory(UploadedFileFactoryInterface $uploadedFileFactory): UploadedFileFactoryAwareInterface{
$this->uploadedFileFactory = $uploadedFileFactory;

return $this;
}

}
9 changes: 9 additions & 0 deletions src/UriFactoryAwareInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Psr\Http\Message;

interface UriFactoryAwareInterface{

public function setUriFactory(UriFactoryInterface $uriFactory): UriFactoryAwareInterface;

}
16 changes: 16 additions & 0 deletions src/UriFactoryAwareTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Psr\Http\Message;

trait UriFactoryAwareTrait{

/** @var \Psr\Http\Message\UriFactoryInterface */
protected $uriFactory;

public function setUriFactory(UriFactoryInterface $uriFactory): UriFactoryAwareInterface{
$this->uriFactory = $uriFactory;

return $this;
}

}