Skip to content

Commit

Permalink
Оптимизирована автозагрузка с автолоадером композера, проблема повтор…
Browse files Browse the repository at this point in the history
…ного подключения
  • Loading branch information
Sergey Surkov committed Aug 30, 2021
1 parent c6d0dd7 commit 2b5372e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 128 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "symbiotic/full-single",
"description": "Full Symbiotic framework in single file.",
"license": "BSD-3-Clause",
"version": "1.2.0",
"version": "1.2.1",
"authors": [{
"name": "Surkov Sergey",
"role": "creator"
Expand All @@ -27,7 +27,7 @@
},
"autoload": {
"files": [
"src/symbiotic.php"
"src/autoload.php"
]
},
"suggest": {
Expand Down
3 changes: 3 additions & 0 deletions src/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
include_once __DIR__ .'/vendors.php';
include_once __DIR__.'/symbiotic.php';
154 changes: 28 additions & 126 deletions src/vendors.php
Original file line number Diff line number Diff line change
@@ -1,169 +1,96 @@
<?php
/**
* Все свое ношу с собой, для работы без композера
* Методы очищены чтобы не было конфликтов
*/
namespace Psr\Container {
if (!interface_exists(ContainerExceptionInterface::class)) {
interface ContainerExceptionInterface
{
}
interface ContainerExceptionInterface {}
}

if (!interface_exists(ContainerInterface::class)) {
interface ContainerInterface
{
}
interface ContainerInterface {}
}

if (!interface_exists(NotFoundExceptionInterface::class)) {
interface NotFoundExceptionInterface extends ContainerExceptionInterface
{
}
interface NotFoundExceptionInterface extends ContainerExceptionInterface {}
}

}

namespace Psr\EventDispatcher {

if (!interface_exists(EventDispatcherInterface::class)) {
interface EventDispatcherInterface
{
}
interface EventDispatcherInterface {}
}
if (!interface_exists(ListenerProviderInterface::class)) {
interface ListenerProviderInterface
{
}
interface ListenerProviderInterface {}
}
if (!interface_exists(StoppableEventInterface::class)) {
interface StoppableEventInterface
{
}
interface StoppableEventInterface {}
}

}

namespace Psr\Http\Message {

if (!interface_exists(RequestFactoryInterface::class)) {
interface RequestFactoryInterface
{
}
interface RequestFactoryInterface {}
}

if (!interface_exists(ResponseFactoryInterface::class)) {
interface ResponseFactoryInterface
{
}
interface ResponseFactoryInterface {}
}

if (!interface_exists(ServerRequestFactoryInterface::class)) {
interface ServerRequestFactoryInterface
{
}
interface ServerRequestFactoryInterface {}
}

if (!interface_exists(StreamFactoryInterface::class)) {
interface StreamFactoryInterface
{
}
interface StreamFactoryInterface {}
}

if (!interface_exists(UploadedFileFactoryInterface::class)) {
interface UploadedFileFactoryInterface
{
}
interface UploadedFileFactoryInterface {}
}

if (!interface_exists(UriFactoryInterface::class)) {
interface UriFactoryInterface
{
}
interface UriFactoryInterface {}
}

if (!interface_exists(MessageInterface::class)) {
interface MessageInterface
{
}
interface MessageInterface {}
}

if (!interface_exists(RequestInterface::class)) {
interface RequestInterface extends MessageInterface
{
}
interface RequestInterface extends MessageInterface {}
}

if (!interface_exists(ResponseInterface::class)) {
interface ResponseInterface extends MessageInterface
{
}
interface ResponseInterface extends MessageInterface {}
}

if (!interface_exists(ServerRequestInterface::class)) {
interface ServerRequestInterface extends RequestInterface
{
}
interface ServerRequestInterface extends RequestInterface {}
}

if (!interface_exists(StreamInterface::class)) {
interface StreamInterface
{
}
interface StreamInterface {}
}

if (!interface_exists(UploadedFileInterface::class)) {
interface UploadedFileInterface
{
}
interface UploadedFileInterface {}
}

if (!interface_exists(UriInterface::class)) {
interface UriInterface
{
}
interface UriInterface {}
}
}

namespace Psr\Http\Server {

if (!interface_exists(RequestHandlerInterface::class)) {
interface RequestHandlerInterface
{
}
interface RequestHandlerInterface {}
}
if (!interface_exists(MiddlewareInterface::class)) {
interface MiddlewareInterface
{
}
interface MiddlewareInterface {}
}

}

namespace Psr\SimpleCache {

if (!interface_exists(CacheException::class)) {
interface CacheException
{
}
interface CacheException {}
}
if (!interface_exists(CacheInterface::class)) {
interface CacheInterface
{
}
interface CacheInterface {}
}
if (!interface_exists(InvalidArgumentException::class)) {
interface InvalidArgumentException extends CacheException
{
}
interface InvalidArgumentException extends CacheException {}
}

}

/**
* Nyholm
* Nyholm v1.3.2
* @todo Может быть конфликт в теории, хотя либа стабильная!
*/


namespace Nyholm\Psr7 {

use Psr\Http\Message\StreamInterface;
Expand Down Expand Up @@ -319,7 +246,6 @@ private function validateAndTrimHeader($header, $values): array
}
}
}

if (!trait_exists(RequestTrait::class)) {
trait RequestTrait
{
Expand Down Expand Up @@ -425,10 +351,6 @@ public function __construct(string $method, $uri, array $headers = [], $body = n
}
}
}




if (!class_exists(Response::class)) {
class Response implements ResponseInterface
{
Expand Down Expand Up @@ -482,7 +404,6 @@ public function withStatus($code, $reasonPhrase = ''): self
}
}
}

if (!class_exists(ServerRequest::class)) {
class ServerRequest implements ServerRequestInterface
{
Expand Down Expand Up @@ -601,7 +522,6 @@ public function withoutAttribute($attribute): self
}
}
}

if (!class_exists(Stream::class)) {
class Stream implements StreamInterface
{
Expand All @@ -613,9 +533,7 @@ class Stream implements StreamInterface
private $size;
private const READ_WRITE_HASH = ['read' => ['r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true, 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, 'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true, 'x+t' => true, 'c+t' => true, 'a+' => true], 'write' => ['w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true, 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true]];

private function __construct()
{
}
private function __construct() {}

public static function create($body = ''): StreamInterface
{
Expand Down Expand Up @@ -805,7 +723,6 @@ public function getMetadata($key = null)
}
}
}

if (!class_exists(UploadedFile::class)) {
class UploadedFile implements UploadedFileInterface
{
Expand Down Expand Up @@ -923,7 +840,6 @@ public function getClientMediaType(): ?string
}
}
}

if (!class_exists(Uri::class)) {
class Uri implements UriInterface
{
Expand Down Expand Up @@ -1162,18 +1078,4 @@ private static function rawurlencodeMatchZero(array $match): string
}
}
}














}

0 comments on commit 2b5372e

Please sign in to comment.