Skip to content

Commit

Permalink
Added copyrights to every files, fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
noglitchyo committed Jul 19, 2019
1 parent fd3291d commit 2f4da23
Show file tree
Hide file tree
Showing 21 changed files with 461 additions and 15 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
}
},
"scripts": {
"phpstan": "phpstan analyse -l max ./",
"phpcs": "phpcs --standard=PSR2 ./",
"phpstan": "phpstan analyse -l max src",
"phpcs": "phpcs --standard=PSR2 ./src",
"test": "phpunit -c phpunit.xml.dist"
},
"require-dev": {
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
parameters:
excludes_analyse:
- %rootDir%/../../../src/DependencyInjection/Configuration.php
26 changes: 25 additions & 1 deletion src/DependencyInjection/Compiler/AddCollectionPass.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php declare(strict_types=1);
/**
* MIT License
*
* Copyright (c) 2019 Maxime Elomari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace NoGlitchYo\MiddlewareBundle\DependencyInjection\Compiler;

Expand Down Expand Up @@ -83,7 +106,8 @@ private function getTaggedCollections(ContainerBuilder $container): array
$collections = $this->findAndSortTaggedServices(static::COLLECTION_TAG, $container);
if (!$collections) {
throw new RuntimeException(
'No middleware collections found. At least one collection is required to be tag with "middlewares.collection".'
'No middleware collections found. At least one collection is required '.
'to be tag with "middlewares.collection".'
);
}

Expand Down
23 changes: 23 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php declare(strict_types=1);
/**
* MIT License
*
* Copyright (c) 2019 Maxime Elomari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace NoGlitchYo\MiddlewareBundle\DependencyInjection;

Expand Down
32 changes: 31 additions & 1 deletion src/DependencyInjection/NoGlitchYoMiddlewareExtension.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php declare(strict_types=1);
/**
* MIT License
*
* Copyright (c) 2019 Maxime Elomari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace NoGlitchYo\MiddlewareBundle\DependencyInjection;

Expand All @@ -14,6 +37,10 @@ public function load(array $configs, ContainerBuilder $container): void
{
$mainConfig = $this->getConfiguration($configs, $container);

if ($mainConfig === null) {
return;
}

$configuration = $this->processConfiguration($mainConfig, $configs);

$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
Expand All @@ -26,7 +53,10 @@ public function load(array $configs, ContainerBuilder $container): void
if (!isset($handlerConfiguration['collection'])) {
throw new InvalidArgumentException('Please provide a collection for handler');
}
$container->setParameter(sprintf('middlewares.handlers.%s', $handlerName), $handlerConfiguration);
$container->setParameter(
sprintf('middlewares.handlers.%s', $handlerName),
$handlerConfiguration
);
}

$container->setParameter('middlewares.handlers', $config);
Expand Down
23 changes: 23 additions & 0 deletions src/Entity/HandlerCondition.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php declare(strict_types=1);
/**
* MIT License
*
* Copyright (c) 2019 Maxime Elomari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace NoGlitchYo\MiddlewareBundle\Entity;

Expand Down
23 changes: 23 additions & 0 deletions src/Entity/HandlerConfiguration.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php declare(strict_types=1);
/**
* MIT License
*
* Copyright (c) 2019 Maxime Elomari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace NoGlitchYo\MiddlewareBundle\Entity;

Expand Down
23 changes: 23 additions & 0 deletions src/Entity/HandlerConfigurationInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php declare(strict_types=1);
/**
* MIT License
*
* Copyright (c) 2019 Maxime Elomari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace NoGlitchYo\MiddlewareBundle\Entity;

Expand Down
23 changes: 23 additions & 0 deletions src/Entity/MiddlewareStackEntry.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php declare(strict_types=1);
/**
* MIT License
*
* Copyright (c) 2019 Maxime Elomari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace NoGlitchYo\MiddlewareBundle\Entity;

Expand Down
24 changes: 24 additions & 0 deletions src/EventListener/MiddlewareStackInjectorListener.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php declare(strict_types=1);
/**
* MIT License
*
* Copyright (c) 2019 Maxime Elomari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace NoGlitchYo\MiddlewareBundle\EventListener;

Expand Down Expand Up @@ -27,6 +50,7 @@ public function __construct(MiddlewareStackInterface $middlewareStackHandler)
*/
public function onKernelController(ControllerEvent $event): void
{
/** @var callable $controller */
$controller = $this->middlewareStackHandler
->withDefaultHandler($event->getController())
->compile($event->getRequest());
Expand Down
23 changes: 23 additions & 0 deletions src/Exception/NotImplementedException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php declare(strict_types=1);
/**
* MIT License
*
* Copyright (c) 2019 Maxime Elomari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace NoGlitchYo\MiddlewareBundle\Exception;

Expand Down
23 changes: 23 additions & 0 deletions src/Exception/UndefinedMiddlewareCollectionException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php declare(strict_types=1);
/**
* MIT License
*
* Copyright (c) 2019 Maxime Elomari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace NoGlitchYo\MiddlewareBundle\Exception;

Expand Down
23 changes: 23 additions & 0 deletions src/Factory/MiddlewareCollectionFactory.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php declare(strict_types=1);
/**
* MIT License
*
* Copyright (c) 2019 Maxime Elomari
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

namespace NoGlitchYo\MiddlewareBundle\Factory;

Expand Down
Loading

0 comments on commit 2f4da23

Please sign in to comment.