├── README.md ├── composer.json ├── composer.lock ├── public ├── .htaccess └── index.php ├── src ├── config │ └── db.php └── rutas │ └── clientes.php └── vendor ├── autoload.php ├── composer ├── ClassLoader.php ├── LICENSE ├── autoload_classmap.php ├── autoload_files.php ├── autoload_namespaces.php ├── autoload_psr4.php ├── autoload_real.php ├── autoload_static.php └── installed.json ├── container-interop └── container-interop │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── composer.json │ ├── docs │ ├── ContainerInterface-meta.md │ ├── ContainerInterface.md │ ├── Delegate-lookup-meta.md │ ├── Delegate-lookup.md │ └── images │ │ ├── interoperating_containers.png │ │ ├── priority.png │ │ └── side_by_side_containers.png │ └── src │ └── Interop │ └── Container │ ├── ContainerInterface.php │ └── Exception │ ├── ContainerException.php │ └── NotFoundException.php ├── nikic └── fast-route │ ├── .gitignore │ ├── .hhconfig │ ├── .travis.yml │ ├── FastRoute.hhi │ ├── LICENSE │ ├── README.md │ ├── composer.json │ ├── phpunit.xml │ ├── psalm.xml │ ├── src │ ├── BadRouteException.php │ ├── DataGenerator.php │ ├── DataGenerator │ │ ├── CharCountBased.php │ │ ├── GroupCountBased.php │ │ ├── GroupPosBased.php │ │ ├── MarkBased.php │ │ └── RegexBasedAbstract.php │ ├── Dispatcher.php │ ├── Dispatcher │ │ ├── CharCountBased.php │ │ ├── GroupCountBased.php │ │ ├── GroupPosBased.php │ │ ├── MarkBased.php │ │ └── RegexBasedAbstract.php │ ├── Route.php │ ├── RouteCollector.php │ ├── RouteParser.php │ ├── RouteParser │ │ └── Std.php │ ├── bootstrap.php │ └── functions.php │ └── test │ ├── Dispatcher │ ├── CharCountBasedTest.php │ ├── DispatcherTest.php │ ├── GroupCountBasedTest.php │ ├── GroupPosBasedTest.php │ └── MarkBasedTest.php │ ├── HackTypechecker │ ├── HackTypecheckerTest.php │ └── fixtures │ │ ├── all_options.php │ │ ├── empty_options.php │ │ └── no_options.php │ ├── RouteCollectorTest.php │ ├── RouteParser │ └── StdTest.php │ └── bootstrap.php ├── pimple └── pimple │ ├── .gitignore │ ├── .travis.yml │ ├── CHANGELOG │ ├── LICENSE │ ├── README.rst │ ├── composer.json │ ├── ext │ └── pimple │ │ ├── .gitignore │ │ ├── README.md │ │ ├── config.m4 │ │ ├── config.w32 │ │ ├── php_pimple.h │ │ ├── pimple.c │ │ ├── pimple_compat.h │ │ └── tests │ │ ├── 001.phpt │ │ ├── 002.phpt │ │ ├── 003.phpt │ │ ├── 004.phpt │ │ ├── 005.phpt │ │ ├── 006.phpt │ │ ├── 007.phpt │ │ ├── 008.phpt │ │ ├── 009.phpt │ │ ├── 010.phpt │ │ ├── 011.phpt │ │ ├── 012.phpt │ │ ├── 013.phpt │ │ ├── 014.phpt │ │ ├── 015.phpt │ │ ├── 016.phpt │ │ ├── 017.phpt │ │ ├── 017_1.phpt │ │ ├── 018.phpt │ │ ├── 019.phpt │ │ ├── bench.phpb │ │ └── bench_shared.phpb │ ├── phpunit.xml.dist │ └── src │ └── Pimple │ ├── Container.php │ ├── Exception │ ├── ExpectedInvokableException.php │ ├── FrozenServiceException.php │ ├── InvalidServiceIdentifierException.php │ └── UnknownIdentifierException.php │ ├── Psr11 │ ├── Container.php │ └── ServiceLocator.php │ ├── ServiceIterator.php │ ├── ServiceProviderInterface.php │ └── Tests │ ├── Fixtures │ ├── Invokable.php │ ├── NonInvokable.php │ ├── PimpleServiceProvider.php │ └── Service.php │ ├── PimpleServiceProviderInterfaceTest.php │ ├── PimpleTest.php │ ├── Psr11 │ ├── ContainerTest.php │ └── ServiceLocatorTest.php │ └── ServiceIteratorTest.php ├── psr ├── container │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── composer.json │ └── src │ │ ├── ContainerExceptionInterface.php │ │ ├── ContainerInterface.php │ │ └── NotFoundExceptionInterface.php └── http-message │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── composer.json │ └── src │ ├── MessageInterface.php │ ├── RequestInterface.php │ ├── ResponseInterface.php │ ├── ServerRequestInterface.php │ ├── StreamInterface.php │ ├── UploadedFileInterface.php │ └── UriInterface.php └── slim └── slim ├── CODE_OF_CONDUCT.md ├── LICENSE.md ├── Slim ├── App.php ├── CallableResolver.php ├── CallableResolverAwareTrait.php ├── Collection.php ├── Container.php ├── DefaultServicesProvider.php ├── DeferredCallable.php ├── Exception │ ├── ContainerException.php │ ├── ContainerValueNotFoundException.php │ ├── InvalidMethodException.php │ ├── MethodNotAllowedException.php │ ├── NotFoundException.php │ └── SlimException.php ├── Handlers │ ├── AbstractError.php │ ├── AbstractHandler.php │ ├── Error.php │ ├── NotAllowed.php │ ├── NotFound.php │ ├── PhpError.php │ └── Strategies │ │ ├── RequestResponse.php │ │ └── RequestResponseArgs.php ├── Http │ ├── Body.php │ ├── Cookies.php │ ├── Environment.php │ ├── Headers.php │ ├── Message.php │ ├── Request.php │ ├── RequestBody.php │ ├── Response.php │ ├── Stream.php │ ├── UploadedFile.php │ └── Uri.php ├── Interfaces │ ├── CallableResolverInterface.php │ ├── CollectionInterface.php │ ├── Http │ │ ├── CookiesInterface.php │ │ ├── EnvironmentInterface.php │ │ └── HeadersInterface.php │ ├── InvocationStrategyInterface.php │ ├── RouteGroupInterface.php │ ├── RouteInterface.php │ └── RouterInterface.php ├── MiddlewareAwareTrait.php ├── Routable.php ├── Route.php ├── RouteGroup.php └── Router.php └── composer.json /README.md: -------------------------------------------------------------------------------- 1 | # Creación de una RESTFUL API o API REST con slim framework (PHP, MySql, PDO) 2 | 3 | Creación de una RESTFUL API o API REST con slim framework (PHP, MySql, PDO) 4 | 5 | Slim es un micro-framework PHP, que te ayuda a crear API de manera rápida pero rubusta. 6 | 7 | En esencia, Slim es un despachador que recibe una solicitud HTTP, invoca una rutina de devolución de la llamada apropiada y devuelve una respuesta HTTP. 8 | 9 | Si, quieres ver como lo hice aquí lo puedes ver 10 | https://www.youtube.com/watch?v=iLRjbGC6jIs 11 | 12 | ¿Que es es REST? 13 | 14 | REST son las siglas de Representational State Transfer. Fue definido hace una década por Roy Fielding en su tesis doctoral, y proporciona una forma sencilla de interacción entre sistemas, la mayor parte de las veces a través de un navegador web y HTTP. Esta cohesión con HTTP viene también de que Roy es uno de los principales autores de HTTP. 15 | 16 | REST es un estilo arquitectónico, un conjunto de convenciones para aplicaciones web y servicios web, que se centra principalmente en la manipulación de recursos a través de especificaciones HTTP. Podemos decir que REST es una interfaz web estándar y simple que nos permite interactuar con servicios web de una manera muy cómoda. 17 | 18 | 19 | 20 | Facebook: https://www.facebook.com/dominicodee/ 21 | 22 | Twitter : https://twitter.com/domini_code 23 | 24 | Suscribete al canal: https://www.youtube.com/c/DominiCode?sub_confirmation=1 25 | 26 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": { 3 | "slim/slim": "^3.0" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | RewriteEngine On 2 | RewriteCond %{REQUEST_FILENAME} !-f 3 | RewriteRule ^ index.php [QSA,L] -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | run(); -------------------------------------------------------------------------------- /src/config/db.php: -------------------------------------------------------------------------------- 1 | dbHost;dbname=$this->dbName"; 10 | $dbConnecion = new PDO($mysqlConnect, $this->dbUser, $this->dbPass); 11 | $dbConnecion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 12 | return $dbConnecion; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/rutas/clientes.php: -------------------------------------------------------------------------------- 1 | get('/api/clientes', function(Request $request, Response $response){ 9 | $sql = "SELECT * FROM clientes"; 10 | try{ 11 | $db = new db(); 12 | $db = $db->conectDB(); 13 | $resultado = $db->query($sql); 14 | 15 | if ($resultado->rowCount() > 0){ 16 | $clientes = $resultado->fetchAll(PDO::FETCH_OBJ); 17 | echo json_encode($clientes); 18 | }else { 19 | echo json_encode("No existen clientes en la BBDD."); 20 | } 21 | $resultado = null; 22 | $db = null; 23 | }catch(PDOException $e){ 24 | echo '{"error" : {"text":'.$e->getMessage().'}'; 25 | } 26 | }); 27 | 28 | // GET Recueperar cliente por ID 29 | $app->get('/api/clientes/{id}', function(Request $request, Response $response){ 30 | $id_cliente = $request->getAttribute('id'); 31 | $sql = "SELECT * FROM clientes WHERE id = $id_cliente"; 32 | try{ 33 | $db = new db(); 34 | $db = $db->conectDB(); 35 | $resultado = $db->query($sql); 36 | 37 | if ($resultado->rowCount() > 0){ 38 | $cliente = $resultado->fetchAll(PDO::FETCH_OBJ); 39 | echo json_encode($cliente); 40 | }else { 41 | echo json_encode("No existen cliente en la BBDD con este ID."); 42 | } 43 | $resultado = null; 44 | $db = null; 45 | }catch(PDOException $e){ 46 | echo '{"error" : {"text":'.$e->getMessage().'}'; 47 | } 48 | }); 49 | 50 | 51 | // POST Crear nuevo cliente 52 | $app->post('/api/clientes/nuevo', function(Request $request, Response $response){ 53 | $nombre = $request->getParam('nombre'); 54 | $apellidos = $request->getParam('apellidos'); 55 | $telefono = $request->getParam('telefono'); 56 | $email = $request->getParam('email'); 57 | $direccion = $request->getParam('direccion'); 58 | $ciudad = $request->getParam('ciudad'); 59 | 60 | $sql = "INSERT INTO clientes (nombre, apellidos, telefono, email, direccion, ciudad) VALUES 61 | (:nombre, :apellidos, :telefono, :email, :direccion, :ciudad)"; 62 | try{ 63 | $db = new db(); 64 | $db = $db->conectDB(); 65 | $resultado = $db->prepare($sql); 66 | 67 | $resultado->bindParam(':nombre', $nombre); 68 | $resultado->bindParam(':apellidos', $apellidos); 69 | $resultado->bindParam(':telefono', $telefono); 70 | $resultado->bindParam(':email', $email); 71 | $resultado->bindParam(':direccion', $direccion); 72 | $resultado->bindParam(':ciudad', $ciudad); 73 | 74 | $resultado->execute(); 75 | echo json_encode("Nuevo cliente guardado."); 76 | 77 | $resultado = null; 78 | $db = null; 79 | }catch(PDOException $e){ 80 | echo '{"error" : {"text":'.$e->getMessage().'}'; 81 | } 82 | }); 83 | 84 | 85 | 86 | // PUT Modificar cliente 87 | $app->put('/api/clientes/modificar/{id}', function(Request $request, Response $response){ 88 | $id_cliente = $request->getAttribute('id'); 89 | $nombre = $request->getParam('nombre'); 90 | $apellidos = $request->getParam('apellidos'); 91 | $telefono = $request->getParam('telefono'); 92 | $email = $request->getParam('email'); 93 | $direccion = $request->getParam('direccion'); 94 | $ciudad = $request->getParam('ciudad'); 95 | 96 | $sql = "UPDATE clientes SET 97 | nombre = :nombre, 98 | apellidos = :apellidos, 99 | telefono = :telefono, 100 | email = :email, 101 | direccion = :direccion, 102 | ciudad = :ciudad 103 | WHERE id = $id_cliente"; 104 | 105 | try{ 106 | $db = new db(); 107 | $db = $db->conectDB(); 108 | $resultado = $db->prepare($sql); 109 | 110 | $resultado->bindParam(':nombre', $nombre); 111 | $resultado->bindParam(':apellidos', $apellidos); 112 | $resultado->bindParam(':telefono', $telefono); 113 | $resultado->bindParam(':email', $email); 114 | $resultado->bindParam(':direccion', $direccion); 115 | $resultado->bindParam(':ciudad', $ciudad); 116 | 117 | $resultado->execute(); 118 | echo json_encode("Cliente modificado."); 119 | 120 | $resultado = null; 121 | $db = null; 122 | }catch(PDOException $e){ 123 | echo '{"error" : {"text":'.$e->getMessage().'}'; 124 | } 125 | }); 126 | 127 | 128 | // DELETE borar cliente 129 | $app->delete('/api/clientes/delete/{id}', function(Request $request, Response $response){ 130 | $id_cliente = $request->getAttribute('id'); 131 | $sql = "DELETE FROM clientes WHERE id = $id_cliente"; 132 | 133 | try{ 134 | $db = new db(); 135 | $db = $db->conectDB(); 136 | $resultado = $db->prepare($sql); 137 | $resultado->execute(); 138 | 139 | if ($resultado->rowCount() > 0) { 140 | echo json_encode("Cliente eliminado."); 141 | }else { 142 | echo json_encode("No existe cliente con este ID."); 143 | } 144 | 145 | $resultado = null; 146 | $db = null; 147 | }catch(PDOException $e){ 148 | echo '{"error" : {"text":'.$e->getMessage().'}'; 149 | } 150 | }); 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /vendor/autoload.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/nikic/fast-route/src/functions.php', 10 | ); 11 | -------------------------------------------------------------------------------- /vendor/composer/autoload_namespaces.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/pimple/pimple/src'), 10 | ); 11 | -------------------------------------------------------------------------------- /vendor/composer/autoload_psr4.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/slim/slim/Slim'), 10 | 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), 11 | 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 12 | 'Interop\\Container\\' => array($vendorDir . '/container-interop/container-interop/src/Interop/Container'), 13 | 'FastRoute\\' => array($vendorDir . '/nikic/fast-route/src'), 14 | ); 15 | -------------------------------------------------------------------------------- /vendor/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); 27 | if ($useStaticLoader) { 28 | require_once __DIR__ . '/autoload_static.php'; 29 | 30 | call_user_func(\Composer\Autoload\ComposerStaticInit453e6e926e53a75ef62ecda52c7f9d0b::getInitializer($loader)); 31 | } else { 32 | $map = require __DIR__ . '/autoload_namespaces.php'; 33 | foreach ($map as $namespace => $path) { 34 | $loader->set($namespace, $path); 35 | } 36 | 37 | $map = require __DIR__ . '/autoload_psr4.php'; 38 | foreach ($map as $namespace => $path) { 39 | $loader->setPsr4($namespace, $path); 40 | } 41 | 42 | $classMap = require __DIR__ . '/autoload_classmap.php'; 43 | if ($classMap) { 44 | $loader->addClassMap($classMap); 45 | } 46 | } 47 | 48 | $loader->register(true); 49 | 50 | if ($useStaticLoader) { 51 | $includeFiles = Composer\Autoload\ComposerStaticInit453e6e926e53a75ef62ecda52c7f9d0b::$files; 52 | } else { 53 | $includeFiles = require __DIR__ . '/autoload_files.php'; 54 | } 55 | foreach ($includeFiles as $fileIdentifier => $file) { 56 | composerRequire453e6e926e53a75ef62ecda52c7f9d0b($fileIdentifier, $file); 57 | } 58 | 59 | return $loader; 60 | } 61 | } 62 | 63 | function composerRequire453e6e926e53a75ef62ecda52c7f9d0b($fileIdentifier, $file) 64 | { 65 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 66 | require $file; 67 | 68 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /vendor/composer/autoload_static.php: -------------------------------------------------------------------------------- 1 | __DIR__ . '/..' . '/nikic/fast-route/src/functions.php', 11 | ); 12 | 13 | public static $prefixLengthsPsr4 = array ( 14 | 'S' => 15 | array ( 16 | 'Slim\\' => 5, 17 | ), 18 | 'P' => 19 | array ( 20 | 'Psr\\Http\\Message\\' => 17, 21 | 'Psr\\Container\\' => 14, 22 | ), 23 | 'I' => 24 | array ( 25 | 'Interop\\Container\\' => 18, 26 | ), 27 | 'F' => 28 | array ( 29 | 'FastRoute\\' => 10, 30 | ), 31 | ); 32 | 33 | public static $prefixDirsPsr4 = array ( 34 | 'Slim\\' => 35 | array ( 36 | 0 => __DIR__ . '/..' . '/slim/slim/Slim', 37 | ), 38 | 'Psr\\Http\\Message\\' => 39 | array ( 40 | 0 => __DIR__ . '/..' . '/psr/http-message/src', 41 | ), 42 | 'Psr\\Container\\' => 43 | array ( 44 | 0 => __DIR__ . '/..' . '/psr/container/src', 45 | ), 46 | 'Interop\\Container\\' => 47 | array ( 48 | 0 => __DIR__ . '/..' . '/container-interop/container-interop/src/Interop/Container', 49 | ), 50 | 'FastRoute\\' => 51 | array ( 52 | 0 => __DIR__ . '/..' . '/nikic/fast-route/src', 53 | ), 54 | ); 55 | 56 | public static $prefixesPsr0 = array ( 57 | 'P' => 58 | array ( 59 | 'Pimple' => 60 | array ( 61 | 0 => __DIR__ . '/..' . '/pimple/pimple/src', 62 | ), 63 | ), 64 | ); 65 | 66 | public static function getInitializer(ClassLoader $loader) 67 | { 68 | return \Closure::bind(function () use ($loader) { 69 | $loader->prefixLengthsPsr4 = ComposerStaticInit453e6e926e53a75ef62ecda52c7f9d0b::$prefixLengthsPsr4; 70 | $loader->prefixDirsPsr4 = ComposerStaticInit453e6e926e53a75ef62ecda52c7f9d0b::$prefixDirsPsr4; 71 | $loader->prefixesPsr0 = ComposerStaticInit453e6e926e53a75ef62ecda52c7f9d0b::$prefixesPsr0; 72 | 73 | }, null, ClassLoader::class); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /vendor/container-interop/container-interop/.gitignore: -------------------------------------------------------------------------------- 1 | composer.lock 2 | composer.phar 3 | /vendor/ 4 | -------------------------------------------------------------------------------- /vendor/container-interop/container-interop/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 container-interop 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /vendor/container-interop/container-interop/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "container-interop/container-interop", 3 | "type": "library", 4 | "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", 5 | "homepage": "https://github.com/container-interop/container-interop", 6 | "license": "MIT", 7 | "autoload": { 8 | "psr-4": { 9 | "Interop\\Container\\": "src/Interop/Container/" 10 | } 11 | }, 12 | "require": { 13 | "psr/container": "^1.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /vendor/container-interop/container-interop/docs/Delegate-lookup.md: -------------------------------------------------------------------------------- 1 | Delegate lookup feature 2 | ======================= 3 | 4 | This document describes a standard for dependency injection containers. 5 | 6 | The goal set by the *delegate lookup* feature is to allow several containers to share entries. 7 | Containers implementing this feature can perform dependency lookups in other containers. 8 | 9 | Containers implementing this feature will offer a greater lever of interoperability 10 | with other containers. Implementation of this feature is therefore RECOMMENDED. 11 | 12 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", 13 | "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be 14 | interpreted as described in [RFC 2119][]. 15 | 16 | The word `implementor` in this document is to be interpreted as someone 17 | implementing the delegate lookup feature in a dependency injection-related library or framework. 18 | Users of dependency injections containers (DIC) are referred to as `user`. 19 | 20 | [RFC 2119]: http://tools.ietf.org/html/rfc2119 21 | 22 | 1. Vocabulary 23 | ------------- 24 | 25 | In a dependency injection container, the container is used to fetch entries. 26 | Entries can have dependencies on other entries. Usually, these other entries are fetched by the container. 27 | 28 | The *delegate lookup* feature is the ability for a container to fetch dependencies in 29 | another container. In the rest of the document, the word "container" will reference the container 30 | implemented by the implementor. The word "delegate container" will reference the container we are 31 | fetching the dependencies from. 32 | 33 | 2. Specification 34 | ---------------- 35 | 36 | A container implementing the *delegate lookup* feature: 37 | 38 | - MUST implement the [`ContainerInterface`](ContainerInterface.md) 39 | - MUST provide a way to register a delegate container (using a constructor parameter, or a setter, 40 | or any possible way). The delegate container MUST implement the [`ContainerInterface`](ContainerInterface.md). 41 | 42 | When a container is configured to use a delegate container for dependencies: 43 | 44 | - Calls to the `get` method should only return an entry if the entry is part of the container. 45 | If the entry is not part of the container, an exception should be thrown 46 | (as requested by the [`ContainerInterface`](ContainerInterface.md)). 47 | - Calls to the `has` method should only return `true` if the entry is part of the container. 48 | If the entry is not part of the container, `false` should be returned. 49 | - If the fetched entry has dependencies, **instead** of performing 50 | the dependency lookup in the container, the lookup is performed on the *delegate container*. 51 | 52 | Important: By default, the dependency lookups SHOULD be performed on the delegate container **only**, not on the container itself. 53 | 54 | It is however allowed for containers to provide exception cases for special entries, and a way to lookup 55 | into the same container (or another container) instead of the delegate container. 56 | 57 | 3. Package / Interface 58 | ---------------------- 59 | 60 | This feature is not tied to any code, interface or package. 61 | -------------------------------------------------------------------------------- /vendor/container-interop/container-interop/docs/images/interoperating_containers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domini-code/api_rest_slim_framework/73edaf362fca3db24b9e20ecc85d6b7363042ea0/vendor/container-interop/container-interop/docs/images/interoperating_containers.png -------------------------------------------------------------------------------- /vendor/container-interop/container-interop/docs/images/priority.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domini-code/api_rest_slim_framework/73edaf362fca3db24b9e20ecc85d6b7363042ea0/vendor/container-interop/container-interop/docs/images/priority.png -------------------------------------------------------------------------------- /vendor/container-interop/container-interop/docs/images/side_by_side_containers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/domini-code/api_rest_slim_framework/73edaf362fca3db24b9e20ecc85d6b7363042ea0/vendor/container-interop/container-interop/docs/images/side_by_side_containers.png -------------------------------------------------------------------------------- /vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php: -------------------------------------------------------------------------------- 1 | ; 9 | } 10 | 11 | class RouteCollector { 12 | public function __construct(RouteParser $routeParser, DataGenerator $dataGenerator); 13 | public function addRoute(mixed $httpMethod, string $route, mixed $handler): void; 14 | public function getData(): array; 15 | } 16 | 17 | class Route { 18 | public function __construct(string $httpMethod, mixed $handler, string $regex, array $variables); 19 | public function matches(string $str): bool; 20 | } 21 | 22 | interface DataGenerator { 23 | public function addRoute(string $httpMethod, array $routeData, mixed $handler); 24 | public function getData(): array; 25 | } 26 | 27 | interface Dispatcher { 28 | const int NOT_FOUND = 0; 29 | const int FOUND = 1; 30 | const int METHOD_NOT_ALLOWED = 2; 31 | public function dispatch(string $httpMethod, string $uri): array; 32 | } 33 | 34 | function simpleDispatcher( 35 | (function(RouteCollector): void) $routeDefinitionCallback, 36 | shape( 37 | ?'routeParser' => classname, 38 | ?'dataGenerator' => classname, 39 | ?'dispatcher' => classname, 40 | ?'routeCollector' => classname, 41 | ) $options = shape()): Dispatcher; 42 | 43 | function cachedDispatcher( 44 | (function(RouteCollector): void) $routeDefinitionCallback, 45 | shape( 46 | ?'routeParser' => classname, 47 | ?'dataGenerator' => classname, 48 | ?'dispatcher' => classname, 49 | ?'routeCollector' => classname, 50 | ?'cacheDisabled' => bool, 51 | ?'cacheFile' => string, 52 | ) $options = shape()): Dispatcher; 53 | } 54 | 55 | namespace FastRoute\DataGenerator { 56 | abstract class RegexBasedAbstract implements \FastRoute\DataGenerator { 57 | protected abstract function getApproxChunkSize(); 58 | protected abstract function processChunk($regexToRoutesMap); 59 | 60 | public function addRoute(string $httpMethod, array $routeData, mixed $handler): void; 61 | public function getData(): array; 62 | } 63 | 64 | class CharCountBased extends RegexBasedAbstract { 65 | protected function getApproxChunkSize(): int; 66 | protected function processChunk(array $regexToRoutesMap): array; 67 | } 68 | 69 | class GroupCountBased extends RegexBasedAbstract { 70 | protected function getApproxChunkSize(): int; 71 | protected function processChunk(array $regexToRoutesMap): array; 72 | } 73 | 74 | class GroupPosBased extends RegexBasedAbstract { 75 | protected function getApproxChunkSize(): int; 76 | protected function processChunk(array $regexToRoutesMap): array; 77 | } 78 | 79 | class MarkBased extends RegexBasedAbstract { 80 | protected function getApproxChunkSize(): int; 81 | protected function processChunk(array $regexToRoutesMap): array; 82 | } 83 | } 84 | 85 | namespace FastRoute\Dispatcher { 86 | abstract class RegexBasedAbstract implements \FastRoute\Dispatcher { 87 | protected abstract function dispatchVariableRoute(array $routeData, string $uri): array; 88 | 89 | public function dispatch(string $httpMethod, string $uri): array; 90 | } 91 | 92 | class GroupPosBased extends RegexBasedAbstract { 93 | public function __construct(array $data); 94 | protected function dispatchVariableRoute(array $routeData, string $uri): array; 95 | } 96 | 97 | class GroupCountBased extends RegexBasedAbstract { 98 | public function __construct(array $data); 99 | protected function dispatchVariableRoute(array $routeData, string $uri): array; 100 | } 101 | 102 | class CharCountBased extends RegexBasedAbstract { 103 | public function __construct(array $data); 104 | protected function dispatchVariableRoute(array $routeData, string $uri): array; 105 | } 106 | 107 | class MarkBased extends RegexBasedAbstract { 108 | public function __construct(array $data); 109 | protected function dispatchVariableRoute(array $routeData, string $uri): array; 110 | } 111 | } 112 | 113 | namespace FastRoute\RouteParser { 114 | class Std implements \FastRoute\RouteParser { 115 | const string VARIABLE_REGEX = <<<'REGEX' 116 | \{ 117 | \s* ([a-zA-Z][a-zA-Z0-9_]*) \s* 118 | (?: 119 | : \s* ([^{}]*(?:\{(?-1)\}[^{}]*)*) 120 | )? 121 | \} 122 | REGEX; 123 | const string DEFAULT_DISPATCH_REGEX = '[^/]+'; 124 | public function parse(string $route): array; 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 by Nikita Popov. 2 | 3 | Some rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following 14 | disclaimer in the documentation and/or other materials provided 15 | with the distribution. 16 | 17 | * The names of the contributors may not be used to endorse or 18 | promote products derived from this software without specific 19 | prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nikic/fast-route", 3 | "description": "Fast request router for PHP", 4 | "keywords": ["routing", "router"], 5 | "license": "BSD-3-Clause", 6 | "authors": [ 7 | { 8 | "name": "Nikita Popov", 9 | "email": "nikic@php.net" 10 | } 11 | ], 12 | "autoload": { 13 | "psr-4": { 14 | "FastRoute\\": "src/" 15 | }, 16 | "files": ["src/functions.php"] 17 | }, 18 | "require": { 19 | "php": ">=5.4.0" 20 | }, 21 | "require-dev": { 22 | "phpunit/phpunit": "^4.8.35|~5.7" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | 14 | 15 | ./test/ 16 | 17 | 18 | 19 | 20 | 21 | ./src/ 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/psalm.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/BadRouteException.php: -------------------------------------------------------------------------------- 1 | $route) { 21 | $suffixLen++; 22 | $suffix .= "\t"; 23 | 24 | $regexes[] = '(?:' . $regex . '/(\t{' . $suffixLen . '})\t{' . ($count - $suffixLen) . '})'; 25 | $routeMap[$suffix] = [$route->handler, $route->variables]; 26 | } 27 | 28 | $regex = '~^(?|' . implode('|', $regexes) . ')$~'; 29 | return ['regex' => $regex, 'suffix' => '/' . $suffix, 'routeMap' => $routeMap]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/DataGenerator/GroupCountBased.php: -------------------------------------------------------------------------------- 1 | $route) { 18 | $numVariables = count($route->variables); 19 | $numGroups = max($numGroups, $numVariables); 20 | 21 | $regexes[] = $regex . str_repeat('()', $numGroups - $numVariables); 22 | $routeMap[$numGroups + 1] = [$route->handler, $route->variables]; 23 | 24 | ++$numGroups; 25 | } 26 | 27 | $regex = '~^(?|' . implode('|', $regexes) . ')$~'; 28 | return ['regex' => $regex, 'routeMap' => $routeMap]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/DataGenerator/GroupPosBased.php: -------------------------------------------------------------------------------- 1 | $route) { 18 | $regexes[] = $regex; 19 | $routeMap[$offset] = [$route->handler, $route->variables]; 20 | 21 | $offset += count($route->variables); 22 | } 23 | 24 | $regex = '~^(?:' . implode('|', $regexes) . ')$~'; 25 | return ['regex' => $regex, 'routeMap' => $routeMap]; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/DataGenerator/MarkBased.php: -------------------------------------------------------------------------------- 1 | $route) { 18 | $regexes[] = $regex . '(*MARK:' . $markName . ')'; 19 | $routeMap[$markName] = [$route->handler, $route->variables]; 20 | 21 | ++$markName; 22 | } 23 | 24 | $regex = '~^(?|' . implode('|', $regexes) . ')$~'; 25 | return ['regex' => $regex, 'routeMap' => $routeMap]; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/Dispatcher.php: -------------------------------------------------------------------------------- 1 | 'value', ...]] 19 | * 20 | * @param string $httpMethod 21 | * @param string $uri 22 | * 23 | * @return array 24 | */ 25 | public function dispatch($httpMethod, $uri); 26 | } 27 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/Dispatcher/CharCountBased.php: -------------------------------------------------------------------------------- 1 | staticRouteMap, $this->variableRouteData) = $data; 10 | } 11 | 12 | protected function dispatchVariableRoute($routeData, $uri) 13 | { 14 | foreach ($routeData as $data) { 15 | if (!preg_match($data['regex'], $uri . $data['suffix'], $matches)) { 16 | continue; 17 | } 18 | 19 | list($handler, $varNames) = $data['routeMap'][end($matches)]; 20 | 21 | $vars = []; 22 | $i = 0; 23 | foreach ($varNames as $varName) { 24 | $vars[$varName] = $matches[++$i]; 25 | } 26 | return [self::FOUND, $handler, $vars]; 27 | } 28 | 29 | return [self::NOT_FOUND]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/Dispatcher/GroupCountBased.php: -------------------------------------------------------------------------------- 1 | staticRouteMap, $this->variableRouteData) = $data; 10 | } 11 | 12 | protected function dispatchVariableRoute($routeData, $uri) 13 | { 14 | foreach ($routeData as $data) { 15 | if (!preg_match($data['regex'], $uri, $matches)) { 16 | continue; 17 | } 18 | 19 | list($handler, $varNames) = $data['routeMap'][count($matches)]; 20 | 21 | $vars = []; 22 | $i = 0; 23 | foreach ($varNames as $varName) { 24 | $vars[$varName] = $matches[++$i]; 25 | } 26 | return [self::FOUND, $handler, $vars]; 27 | } 28 | 29 | return [self::NOT_FOUND]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/Dispatcher/GroupPosBased.php: -------------------------------------------------------------------------------- 1 | staticRouteMap, $this->variableRouteData) = $data; 10 | } 11 | 12 | protected function dispatchVariableRoute($routeData, $uri) 13 | { 14 | foreach ($routeData as $data) { 15 | if (!preg_match($data['regex'], $uri, $matches)) { 16 | continue; 17 | } 18 | 19 | // find first non-empty match 20 | for ($i = 1; '' === $matches[$i]; ++$i); 21 | 22 | list($handler, $varNames) = $data['routeMap'][$i]; 23 | 24 | $vars = []; 25 | foreach ($varNames as $varName) { 26 | $vars[$varName] = $matches[$i++]; 27 | } 28 | return [self::FOUND, $handler, $vars]; 29 | } 30 | 31 | return [self::NOT_FOUND]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/Dispatcher/MarkBased.php: -------------------------------------------------------------------------------- 1 | staticRouteMap, $this->variableRouteData) = $data; 10 | } 11 | 12 | protected function dispatchVariableRoute($routeData, $uri) 13 | { 14 | foreach ($routeData as $data) { 15 | if (!preg_match($data['regex'], $uri, $matches)) { 16 | continue; 17 | } 18 | 19 | list($handler, $varNames) = $data['routeMap'][$matches['MARK']]; 20 | 21 | $vars = []; 22 | $i = 0; 23 | foreach ($varNames as $varName) { 24 | $vars[$varName] = $matches[++$i]; 25 | } 26 | return [self::FOUND, $handler, $vars]; 27 | } 28 | 29 | return [self::NOT_FOUND]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/Dispatcher/RegexBasedAbstract.php: -------------------------------------------------------------------------------- 1 | staticRouteMap[$httpMethod][$uri])) { 23 | $handler = $this->staticRouteMap[$httpMethod][$uri]; 24 | return [self::FOUND, $handler, []]; 25 | } 26 | 27 | $varRouteData = $this->variableRouteData; 28 | if (isset($varRouteData[$httpMethod])) { 29 | $result = $this->dispatchVariableRoute($varRouteData[$httpMethod], $uri); 30 | if ($result[0] === self::FOUND) { 31 | return $result; 32 | } 33 | } 34 | 35 | // For HEAD requests, attempt fallback to GET 36 | if ($httpMethod === 'HEAD') { 37 | if (isset($this->staticRouteMap['GET'][$uri])) { 38 | $handler = $this->staticRouteMap['GET'][$uri]; 39 | return [self::FOUND, $handler, []]; 40 | } 41 | if (isset($varRouteData['GET'])) { 42 | $result = $this->dispatchVariableRoute($varRouteData['GET'], $uri); 43 | if ($result[0] === self::FOUND) { 44 | return $result; 45 | } 46 | } 47 | } 48 | 49 | // If nothing else matches, try fallback routes 50 | if (isset($this->staticRouteMap['*'][$uri])) { 51 | $handler = $this->staticRouteMap['*'][$uri]; 52 | return [self::FOUND, $handler, []]; 53 | } 54 | if (isset($varRouteData['*'])) { 55 | $result = $this->dispatchVariableRoute($varRouteData['*'], $uri); 56 | if ($result[0] === self::FOUND) { 57 | return $result; 58 | } 59 | } 60 | 61 | // Find allowed methods for this URI by matching against all other HTTP methods as well 62 | $allowedMethods = []; 63 | 64 | foreach ($this->staticRouteMap as $method => $uriMap) { 65 | if ($method !== $httpMethod && isset($uriMap[$uri])) { 66 | $allowedMethods[] = $method; 67 | } 68 | } 69 | 70 | foreach ($varRouteData as $method => $routeData) { 71 | if ($method === $httpMethod) { 72 | continue; 73 | } 74 | 75 | $result = $this->dispatchVariableRoute($routeData, $uri); 76 | if ($result[0] === self::FOUND) { 77 | $allowedMethods[] = $method; 78 | } 79 | } 80 | 81 | // If there are no allowed methods the route simply does not exist 82 | if ($allowedMethods) { 83 | return [self::METHOD_NOT_ALLOWED, $allowedMethods]; 84 | } 85 | 86 | return [self::NOT_FOUND]; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/Route.php: -------------------------------------------------------------------------------- 1 | httpMethod = $httpMethod; 30 | $this->handler = $handler; 31 | $this->regex = $regex; 32 | $this->variables = $variables; 33 | } 34 | 35 | /** 36 | * Tests whether this route matches the given string. 37 | * 38 | * @param string $str 39 | * 40 | * @return bool 41 | */ 42 | public function matches($str) 43 | { 44 | $regex = '~^' . $this->regex . '$~'; 45 | return (bool) preg_match($regex, $str); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/RouteCollector.php: -------------------------------------------------------------------------------- 1 | routeParser = $routeParser; 25 | $this->dataGenerator = $dataGenerator; 26 | $this->currentGroupPrefix = ''; 27 | } 28 | 29 | /** 30 | * Adds a route to the collection. 31 | * 32 | * The syntax used in the $route string depends on the used route parser. 33 | * 34 | * @param string|string[] $httpMethod 35 | * @param string $route 36 | * @param mixed $handler 37 | */ 38 | public function addRoute($httpMethod, $route, $handler) 39 | { 40 | $route = $this->currentGroupPrefix . $route; 41 | $routeDatas = $this->routeParser->parse($route); 42 | foreach ((array) $httpMethod as $method) { 43 | foreach ($routeDatas as $routeData) { 44 | $this->dataGenerator->addRoute($method, $routeData, $handler); 45 | } 46 | } 47 | } 48 | 49 | /** 50 | * Create a route group with a common prefix. 51 | * 52 | * All routes created in the passed callback will have the given group prefix prepended. 53 | * 54 | * @param string $prefix 55 | * @param callable $callback 56 | */ 57 | public function addGroup($prefix, callable $callback) 58 | { 59 | $previousGroupPrefix = $this->currentGroupPrefix; 60 | $this->currentGroupPrefix = $previousGroupPrefix . $prefix; 61 | $callback($this); 62 | $this->currentGroupPrefix = $previousGroupPrefix; 63 | } 64 | 65 | /** 66 | * Adds a GET route to the collection 67 | * 68 | * This is simply an alias of $this->addRoute('GET', $route, $handler) 69 | * 70 | * @param string $route 71 | * @param mixed $handler 72 | */ 73 | public function get($route, $handler) 74 | { 75 | $this->addRoute('GET', $route, $handler); 76 | } 77 | 78 | /** 79 | * Adds a POST route to the collection 80 | * 81 | * This is simply an alias of $this->addRoute('POST', $route, $handler) 82 | * 83 | * @param string $route 84 | * @param mixed $handler 85 | */ 86 | public function post($route, $handler) 87 | { 88 | $this->addRoute('POST', $route, $handler); 89 | } 90 | 91 | /** 92 | * Adds a PUT route to the collection 93 | * 94 | * This is simply an alias of $this->addRoute('PUT', $route, $handler) 95 | * 96 | * @param string $route 97 | * @param mixed $handler 98 | */ 99 | public function put($route, $handler) 100 | { 101 | $this->addRoute('PUT', $route, $handler); 102 | } 103 | 104 | /** 105 | * Adds a DELETE route to the collection 106 | * 107 | * This is simply an alias of $this->addRoute('DELETE', $route, $handler) 108 | * 109 | * @param string $route 110 | * @param mixed $handler 111 | */ 112 | public function delete($route, $handler) 113 | { 114 | $this->addRoute('DELETE', $route, $handler); 115 | } 116 | 117 | /** 118 | * Adds a PATCH route to the collection 119 | * 120 | * This is simply an alias of $this->addRoute('PATCH', $route, $handler) 121 | * 122 | * @param string $route 123 | * @param mixed $handler 124 | */ 125 | public function patch($route, $handler) 126 | { 127 | $this->addRoute('PATCH', $route, $handler); 128 | } 129 | 130 | /** 131 | * Adds a HEAD route to the collection 132 | * 133 | * This is simply an alias of $this->addRoute('HEAD', $route, $handler) 134 | * 135 | * @param string $route 136 | * @param mixed $handler 137 | */ 138 | public function head($route, $handler) 139 | { 140 | $this->addRoute('HEAD', $route, $handler); 141 | } 142 | 143 | /** 144 | * Returns the collected route data, as provided by the data generator. 145 | * 146 | * @return array 147 | */ 148 | public function getData() 149 | { 150 | return $this->dataGenerator->getData(); 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/RouteParser.php: -------------------------------------------------------------------------------- 1 | $segment) { 43 | if ($segment === '' && $n !== 0) { 44 | throw new BadRouteException('Empty optional part'); 45 | } 46 | 47 | $currentRoute .= $segment; 48 | $routeDatas[] = $this->parsePlaceholders($currentRoute); 49 | } 50 | return $routeDatas; 51 | } 52 | 53 | /** 54 | * Parses a route string that does not contain optional segments. 55 | * 56 | * @param string 57 | * @return mixed[] 58 | */ 59 | private function parsePlaceholders($route) 60 | { 61 | if (!preg_match_all( 62 | '~' . self::VARIABLE_REGEX . '~x', $route, $matches, 63 | PREG_OFFSET_CAPTURE | PREG_SET_ORDER 64 | )) { 65 | return [$route]; 66 | } 67 | 68 | $offset = 0; 69 | $routeData = []; 70 | foreach ($matches as $set) { 71 | if ($set[0][1] > $offset) { 72 | $routeData[] = substr($route, $offset, $set[0][1] - $offset); 73 | } 74 | $routeData[] = [ 75 | $set[1][0], 76 | isset($set[2]) ? trim($set[2][0]) : self::DEFAULT_DISPATCH_REGEX 77 | ]; 78 | $offset = $set[0][1] + strlen($set[0][0]); 79 | } 80 | 81 | if ($offset !== strlen($route)) { 82 | $routeData[] = substr($route, $offset); 83 | } 84 | 85 | return $routeData; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/src/bootstrap.php: -------------------------------------------------------------------------------- 1 | 'FastRoute\\RouteParser\\Std', 16 | 'dataGenerator' => 'FastRoute\\DataGenerator\\GroupCountBased', 17 | 'dispatcher' => 'FastRoute\\Dispatcher\\GroupCountBased', 18 | 'routeCollector' => 'FastRoute\\RouteCollector', 19 | ]; 20 | 21 | /** @var RouteCollector $routeCollector */ 22 | $routeCollector = new $options['routeCollector']( 23 | new $options['routeParser'], new $options['dataGenerator'] 24 | ); 25 | $routeDefinitionCallback($routeCollector); 26 | 27 | return new $options['dispatcher']($routeCollector->getData()); 28 | } 29 | 30 | /** 31 | * @param callable $routeDefinitionCallback 32 | * @param array $options 33 | * 34 | * @return Dispatcher 35 | */ 36 | function cachedDispatcher(callable $routeDefinitionCallback, array $options = []) 37 | { 38 | $options += [ 39 | 'routeParser' => 'FastRoute\\RouteParser\\Std', 40 | 'dataGenerator' => 'FastRoute\\DataGenerator\\GroupCountBased', 41 | 'dispatcher' => 'FastRoute\\Dispatcher\\GroupCountBased', 42 | 'routeCollector' => 'FastRoute\\RouteCollector', 43 | 'cacheDisabled' => false, 44 | ]; 45 | 46 | if (!isset($options['cacheFile'])) { 47 | throw new \LogicException('Must specify "cacheFile" option'); 48 | } 49 | 50 | if (!$options['cacheDisabled'] && file_exists($options['cacheFile'])) { 51 | $dispatchData = require $options['cacheFile']; 52 | if (!is_array($dispatchData)) { 53 | throw new \RuntimeException('Invalid cache file "' . $options['cacheFile'] . '"'); 54 | } 55 | return new $options['dispatcher']($dispatchData); 56 | } 57 | 58 | $routeCollector = new $options['routeCollector']( 59 | new $options['routeParser'], new $options['dataGenerator'] 60 | ); 61 | $routeDefinitionCallback($routeCollector); 62 | 63 | /** @var RouteCollector $routeCollector */ 64 | $dispatchData = $routeCollector->getData(); 65 | if (!$options['cacheDisabled']) { 66 | file_put_contents( 67 | $options['cacheFile'], 68 | 'markTestSkipped('PHP 5.6 required for MARK support'); 12 | } 13 | } 14 | 15 | protected function getDispatcherClass() 16 | { 17 | return 'FastRoute\\Dispatcher\\MarkBased'; 18 | } 19 | 20 | protected function getDataGeneratorClass() 21 | { 22 | return 'FastRoute\\DataGenerator\\MarkBased'; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/test/HackTypechecker/HackTypecheckerTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('HHVM only'); 15 | } 16 | if (!version_compare(HHVM_VERSION, '3.9.0', '>=')) { 17 | $this->markTestSkipped('classname requires HHVM 3.9+'); 18 | } 19 | 20 | // The typechecker recurses the whole tree, so it makes sure 21 | // that everything in fixtures/ is valid when this runs. 22 | 23 | $output = []; 24 | $exit_code = null; 25 | exec( 26 | 'hh_server --check ' . escapeshellarg(__DIR__ . '/../../') . ' 2>&1', 27 | $output, 28 | $exit_code 29 | ); 30 | if ($exit_code === self::SERVER_ALREADY_RUNNING_CODE) { 31 | $this->assertTrue( 32 | $recurse, 33 | 'Typechecker still running after running hh_client stop' 34 | ); 35 | // Server already running - 3.10 => 3.11 regression: 36 | // https://github.com/facebook/hhvm/issues/6646 37 | exec('hh_client stop 2>/dev/null'); 38 | $this->testTypechecks(/* recurse = */ false); 39 | return; 40 | 41 | } 42 | $this->assertSame(0, $exit_code, implode("\n", $output)); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/test/HackTypechecker/fixtures/all_options.php: -------------------------------------------------------------------------------- 1 | {}, 8 | shape( 9 | 'routeParser' => \FastRoute\RouteParser\Std::class, 10 | 'dataGenerator' => \FastRoute\DataGenerator\GroupCountBased::class, 11 | 'dispatcher' => \FastRoute\Dispatcher\GroupCountBased::class, 12 | 'routeCollector' => \FastRoute\RouteCollector::class, 13 | ), 14 | ); 15 | } 16 | 17 | function all_options_cached(): \FastRoute\Dispatcher { 18 | return \FastRoute\cachedDispatcher( 19 | $collector ==> {}, 20 | shape( 21 | 'routeParser' => \FastRoute\RouteParser\Std::class, 22 | 'dataGenerator' => \FastRoute\DataGenerator\GroupCountBased::class, 23 | 'dispatcher' => \FastRoute\Dispatcher\GroupCountBased::class, 24 | 'routeCollector' => \FastRoute\RouteCollector::class, 25 | 'cacheFile' => '/dev/null', 26 | 'cacheDisabled' => false, 27 | ), 28 | ); 29 | } 30 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/test/HackTypechecker/fixtures/empty_options.php: -------------------------------------------------------------------------------- 1 | {}, shape()); 7 | } 8 | 9 | function empty_options_cached(): \FastRoute\Dispatcher { 10 | return \FastRoute\cachedDispatcher($collector ==> {}, shape()); 11 | } 12 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/test/HackTypechecker/fixtures/no_options.php: -------------------------------------------------------------------------------- 1 | {}); 7 | } 8 | 9 | function no_options_cached(): \FastRoute\Dispatcher { 10 | return \FastRoute\cachedDispatcher($collector ==> {}); 11 | } 12 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/test/RouteCollectorTest.php: -------------------------------------------------------------------------------- 1 | delete('/delete', 'delete'); 14 | $r->get('/get', 'get'); 15 | $r->head('/head', 'head'); 16 | $r->patch('/patch', 'patch'); 17 | $r->post('/post', 'post'); 18 | $r->put('/put', 'put'); 19 | 20 | $expected = [ 21 | ['DELETE', '/delete', 'delete'], 22 | ['GET', '/get', 'get'], 23 | ['HEAD', '/head', 'head'], 24 | ['PATCH', '/patch', 'patch'], 25 | ['POST', '/post', 'post'], 26 | ['PUT', '/put', 'put'], 27 | ]; 28 | 29 | $this->assertSame($expected, $r->routes); 30 | } 31 | 32 | public function testGroups() 33 | { 34 | $r = new DummyRouteCollector(); 35 | 36 | $r->delete('/delete', 'delete'); 37 | $r->get('/get', 'get'); 38 | $r->head('/head', 'head'); 39 | $r->patch('/patch', 'patch'); 40 | $r->post('/post', 'post'); 41 | $r->put('/put', 'put'); 42 | 43 | $r->addGroup('/group-one', function (DummyRouteCollector $r) { 44 | $r->delete('/delete', 'delete'); 45 | $r->get('/get', 'get'); 46 | $r->head('/head', 'head'); 47 | $r->patch('/patch', 'patch'); 48 | $r->post('/post', 'post'); 49 | $r->put('/put', 'put'); 50 | 51 | $r->addGroup('/group-two', function (DummyRouteCollector $r) { 52 | $r->delete('/delete', 'delete'); 53 | $r->get('/get', 'get'); 54 | $r->head('/head', 'head'); 55 | $r->patch('/patch', 'patch'); 56 | $r->post('/post', 'post'); 57 | $r->put('/put', 'put'); 58 | }); 59 | }); 60 | 61 | $r->addGroup('/admin', function (DummyRouteCollector $r) { 62 | $r->get('-some-info', 'admin-some-info'); 63 | }); 64 | $r->addGroup('/admin-', function (DummyRouteCollector $r) { 65 | $r->get('more-info', 'admin-more-info'); 66 | }); 67 | 68 | $expected = [ 69 | ['DELETE', '/delete', 'delete'], 70 | ['GET', '/get', 'get'], 71 | ['HEAD', '/head', 'head'], 72 | ['PATCH', '/patch', 'patch'], 73 | ['POST', '/post', 'post'], 74 | ['PUT', '/put', 'put'], 75 | ['DELETE', '/group-one/delete', 'delete'], 76 | ['GET', '/group-one/get', 'get'], 77 | ['HEAD', '/group-one/head', 'head'], 78 | ['PATCH', '/group-one/patch', 'patch'], 79 | ['POST', '/group-one/post', 'post'], 80 | ['PUT', '/group-one/put', 'put'], 81 | ['DELETE', '/group-one/group-two/delete', 'delete'], 82 | ['GET', '/group-one/group-two/get', 'get'], 83 | ['HEAD', '/group-one/group-two/head', 'head'], 84 | ['PATCH', '/group-one/group-two/patch', 'patch'], 85 | ['POST', '/group-one/group-two/post', 'post'], 86 | ['PUT', '/group-one/group-two/put', 'put'], 87 | ['GET', '/admin-some-info', 'admin-some-info'], 88 | ['GET', '/admin-more-info', 'admin-more-info'], 89 | ]; 90 | 91 | $this->assertSame($expected, $r->routes); 92 | } 93 | } 94 | 95 | class DummyRouteCollector extends RouteCollector 96 | { 97 | public $routes = []; 98 | 99 | public function __construct() 100 | { 101 | } 102 | 103 | public function addRoute($method, $route, $handler) 104 | { 105 | $route = $this->currentGroupPrefix . $route; 106 | $this->routes[] = [$method, $route, $handler]; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/test/RouteParser/StdTest.php: -------------------------------------------------------------------------------- 1 | parse($routeString); 14 | $this->assertSame($expectedRouteDatas, $routeDatas); 15 | } 16 | 17 | /** @dataProvider provideTestParseError */ 18 | public function testParseError($routeString, $expectedExceptionMessage) 19 | { 20 | $parser = new Std(); 21 | $this->setExpectedException('FastRoute\\BadRouteException', $expectedExceptionMessage); 22 | $parser->parse($routeString); 23 | } 24 | 25 | public function provideTestParse() 26 | { 27 | return [ 28 | [ 29 | '/test', 30 | [ 31 | ['/test'], 32 | ] 33 | ], 34 | [ 35 | '/test/{param}', 36 | [ 37 | ['/test/', ['param', '[^/]+']], 38 | ] 39 | ], 40 | [ 41 | '/te{ param }st', 42 | [ 43 | ['/te', ['param', '[^/]+'], 'st'] 44 | ] 45 | ], 46 | [ 47 | '/test/{param1}/test2/{param2}', 48 | [ 49 | ['/test/', ['param1', '[^/]+'], '/test2/', ['param2', '[^/]+']] 50 | ] 51 | ], 52 | [ 53 | '/test/{param:\d+}', 54 | [ 55 | ['/test/', ['param', '\d+']] 56 | ] 57 | ], 58 | [ 59 | '/test/{ param : \d{1,9} }', 60 | [ 61 | ['/test/', ['param', '\d{1,9}']] 62 | ] 63 | ], 64 | [ 65 | '/test[opt]', 66 | [ 67 | ['/test'], 68 | ['/testopt'], 69 | ] 70 | ], 71 | [ 72 | '/test[/{param}]', 73 | [ 74 | ['/test'], 75 | ['/test/', ['param', '[^/]+']], 76 | ] 77 | ], 78 | [ 79 | '/{param}[opt]', 80 | [ 81 | ['/', ['param', '[^/]+']], 82 | ['/', ['param', '[^/]+'], 'opt'] 83 | ] 84 | ], 85 | [ 86 | '/test[/{name}[/{id:[0-9]+}]]', 87 | [ 88 | ['/test'], 89 | ['/test/', ['name', '[^/]+']], 90 | ['/test/', ['name', '[^/]+'], '/', ['id', '[0-9]+']], 91 | ] 92 | ], 93 | [ 94 | '', 95 | [ 96 | [''], 97 | ] 98 | ], 99 | [ 100 | '[test]', 101 | [ 102 | [''], 103 | ['test'], 104 | ] 105 | ], 106 | [ 107 | '/{foo-bar}', 108 | [ 109 | ['/', ['foo-bar', '[^/]+']] 110 | ] 111 | ], 112 | [ 113 | '/{_foo:.*}', 114 | [ 115 | ['/', ['_foo', '.*']] 116 | ] 117 | ], 118 | ]; 119 | } 120 | 121 | public function provideTestParseError() 122 | { 123 | return [ 124 | [ 125 | '/test[opt', 126 | "Number of opening '[' and closing ']' does not match" 127 | ], 128 | [ 129 | '/test[opt[opt2]', 130 | "Number of opening '[' and closing ']' does not match" 131 | ], 132 | [ 133 | '/testopt]', 134 | "Number of opening '[' and closing ']' does not match" 135 | ], 136 | [ 137 | '/test[]', 138 | 'Empty optional part' 139 | ], 140 | [ 141 | '/test[[opt]]', 142 | 'Empty optional part' 143 | ], 144 | [ 145 | '[[test]]', 146 | 'Empty optional part' 147 | ], 148 | [ 149 | '/test[/opt]/required', 150 | 'Optional segments can only occur at the end of a route' 151 | ], 152 | ]; 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /vendor/nikic/fast-route/test/bootstrap.php: -------------------------------------------------------------------------------- 1 | > `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi 23 | 24 | script: 25 | - cd ext/pimple 26 | - if [ "$PIMPLE_EXT" == "yes" ]; then yes n | make test | tee output ; grep -E 'Tests failed +. +0' output; fi 27 | - if [ "$PIMPLE_EXT" == "yes" ]; then export SYMFONY_DEPRECATIONS_HELPER=weak; fi 28 | - cd ../.. 29 | - ./vendor/bin/simple-phpunit 30 | 31 | matrix: 32 | include: 33 | - php: hhvm 34 | dist: trusty 35 | env: PIMPLE_EXT=no 36 | exclude: 37 | - php: 7.0 38 | env: PIMPLE_EXT=yes 39 | - php: 7.1 40 | env: PIMPLE_EXT=yes 41 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/CHANGELOG: -------------------------------------------------------------------------------- 1 | * 3.2.3 (2017-XX-XX) 2 | 3 | * n/a 4 | 5 | * 3.2.2 (2017-07-23) 6 | 7 | * reverted extending a protected closure throws an exception (deprecated it instead) 8 | 9 | * 3.2.1 (2017-07-17) 10 | 11 | * fixed PHP error 12 | 13 | * 3.2.0 (2017-07-17) 14 | 15 | * added a PSR-11 service locator 16 | * added a PSR-11 wrapper 17 | * added ServiceIterator 18 | * fixed extending a protected closure (now throws InvalidServiceIdentifierException) 19 | 20 | * 3.1.0 (2017-07-03) 21 | 22 | * deprecated the C extension 23 | * added support for PSR-11 exceptions 24 | 25 | * 3.0.2 (2015-09-11) 26 | 27 | * refactored the C extension 28 | * minor non-significant changes 29 | 30 | * 3.0.1 (2015-07-30) 31 | 32 | * simplified some code 33 | * fixed a segfault in the C extension 34 | 35 | * 3.0.0 (2014-07-24) 36 | 37 | * removed the Pimple class alias (use Pimple\Container instead) 38 | 39 | * 2.1.1 (2014-07-24) 40 | 41 | * fixed compiler warnings for the C extension 42 | * fixed code when dealing with circular references 43 | 44 | * 2.1.0 (2014-06-24) 45 | 46 | * moved the Pimple to Pimple\Container (with a BC layer -- Pimple is now a 47 | deprecated alias which will be removed in Pimple 3.0) 48 | * added Pimple\ServiceProviderInterface (and Pimple::register()) 49 | 50 | * 2.0.0 (2014-02-10) 51 | 52 | * changed extend to automatically re-assign the extended service and keep it as shared or factory 53 | (to keep BC, extend still returns the extended service) 54 | * changed services to be shared by default (use factory() for factory 55 | services) 56 | 57 | * 1.0.0 58 | 59 | * initial version 60 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2017 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pimple/pimple", 3 | "type": "library", 4 | "description": "Pimple, a simple Dependency Injection Container", 5 | "keywords": ["dependency injection", "container"], 6 | "homepage": "http://pimple.sensiolabs.org", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Fabien Potencier", 11 | "email": "fabien@symfony.com" 12 | } 13 | ], 14 | "require": { 15 | "php": ">=5.3.0", 16 | "psr/container": "^1.0" 17 | }, 18 | "require-dev": { 19 | "symfony/phpunit-bridge": "^3.2" 20 | }, 21 | "autoload": { 22 | "psr-0": { "Pimple": "src/" } 23 | }, 24 | "extra": { 25 | "branch-alias": { 26 | "dev-master": "3.2.x-dev" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/.gitignore: -------------------------------------------------------------------------------- 1 | *.sw* 2 | .deps 3 | Makefile 4 | Makefile.fragments 5 | Makefile.global 6 | Makefile.objects 7 | acinclude.m4 8 | aclocal.m4 9 | build/ 10 | config.cache 11 | config.guess 12 | config.h 13 | config.h.in 14 | config.log 15 | config.nice 16 | config.status 17 | config.sub 18 | configure 19 | configure.in 20 | install-sh 21 | libtool 22 | ltmain.sh 23 | missing 24 | mkinstalldirs 25 | run-tests.php 26 | *.loT 27 | .libs/ 28 | modules/ 29 | *.la 30 | *.lo 31 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/README.md: -------------------------------------------------------------------------------- 1 | This is Pimple 2 implemented in C 2 | 3 | * PHP >= 5.3 4 | * Not tested under Windows, might work 5 | 6 | Install 7 | ======= 8 | 9 | > phpize 10 | > ./configure 11 | > make 12 | > make install 13 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/config.m4: -------------------------------------------------------------------------------- 1 | dnl $Id$ 2 | dnl config.m4 for extension pimple 3 | 4 | dnl Comments in this file start with the string 'dnl'. 5 | dnl Remove where necessary. This file will not work 6 | dnl without editing. 7 | 8 | dnl If your extension references something external, use with: 9 | 10 | dnl PHP_ARG_WITH(pimple, for pimple support, 11 | dnl Make sure that the comment is aligned: 12 | dnl [ --with-pimple Include pimple support]) 13 | 14 | dnl Otherwise use enable: 15 | 16 | PHP_ARG_ENABLE(pimple, whether to enable pimple support, 17 | dnl Make sure that the comment is aligned: 18 | [ --enable-pimple Enable pimple support]) 19 | 20 | if test "$PHP_PIMPLE" != "no"; then 21 | dnl Write more examples of tests here... 22 | 23 | dnl # --with-pimple -> check with-path 24 | dnl SEARCH_PATH="/usr/local /usr" # you might want to change this 25 | dnl SEARCH_FOR="/include/pimple.h" # you most likely want to change this 26 | dnl if test -r $PHP_PIMPLE/$SEARCH_FOR; then # path given as parameter 27 | dnl PIMPLE_DIR=$PHP_PIMPLE 28 | dnl else # search default path list 29 | dnl AC_MSG_CHECKING([for pimple files in default path]) 30 | dnl for i in $SEARCH_PATH ; do 31 | dnl if test -r $i/$SEARCH_FOR; then 32 | dnl PIMPLE_DIR=$i 33 | dnl AC_MSG_RESULT(found in $i) 34 | dnl fi 35 | dnl done 36 | dnl fi 37 | dnl 38 | dnl if test -z "$PIMPLE_DIR"; then 39 | dnl AC_MSG_RESULT([not found]) 40 | dnl AC_MSG_ERROR([Please reinstall the pimple distribution]) 41 | dnl fi 42 | 43 | dnl # --with-pimple -> add include path 44 | dnl PHP_ADD_INCLUDE($PIMPLE_DIR/include) 45 | 46 | dnl # --with-pimple -> check for lib and symbol presence 47 | dnl LIBNAME=pimple # you may want to change this 48 | dnl LIBSYMBOL=pimple # you most likely want to change this 49 | 50 | dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, 51 | dnl [ 52 | dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $PIMPLE_DIR/lib, PIMPLE_SHARED_LIBADD) 53 | dnl AC_DEFINE(HAVE_PIMPLELIB,1,[ ]) 54 | dnl ],[ 55 | dnl AC_MSG_ERROR([wrong pimple lib version or lib not found]) 56 | dnl ],[ 57 | dnl -L$PIMPLE_DIR/lib -lm 58 | dnl ]) 59 | dnl 60 | dnl PHP_SUBST(PIMPLE_SHARED_LIBADD) 61 | 62 | PHP_NEW_EXTENSION(pimple, pimple.c, $ext_shared) 63 | fi 64 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/config.w32: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // vim:ft=javascript 3 | 4 | // If your extension references something external, use ARG_WITH 5 | // ARG_WITH("pimple", "for pimple support", "no"); 6 | 7 | // Otherwise, use ARG_ENABLE 8 | // ARG_ENABLE("pimple", "enable pimple support", "no"); 9 | 10 | if (PHP_PIMPLE != "no") { 11 | EXTENSION("pimple", "pimple.c"); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/pimple_compat.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * This file is part of Pimple. 4 | * 5 | * Copyright (c) 2014 Fabien Potencier 6 | * 7 | * Permission is hereby granted, free of charge, to any person obtaining a copy 8 | * of this software and associated documentation files (the "Software"), to deal 9 | * in the Software without restriction, including without limitation the rights 10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the Software is furnished 12 | * to do so, subject to the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be included in all 15 | * copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | * THE SOFTWARE. 24 | */ 25 | 26 | #ifndef PIMPLE_COMPAT_H_ 27 | #define PIMPLE_COMPAT_H_ 28 | 29 | #include "Zend/zend_extensions.h" /* for ZEND_EXTENSION_API_NO */ 30 | 31 | #define PHP_5_0_X_API_NO 220040412 32 | #define PHP_5_1_X_API_NO 220051025 33 | #define PHP_5_2_X_API_NO 220060519 34 | #define PHP_5_3_X_API_NO 220090626 35 | #define PHP_5_4_X_API_NO 220100525 36 | #define PHP_5_5_X_API_NO 220121212 37 | #define PHP_5_6_X_API_NO 220131226 38 | 39 | #define IS_PHP_56 ZEND_EXTENSION_API_NO == PHP_5_6_X_API_NO 40 | #define IS_AT_LEAST_PHP_56 ZEND_EXTENSION_API_NO >= PHP_5_6_X_API_NO 41 | 42 | #define IS_PHP_55 ZEND_EXTENSION_API_NO == PHP_5_5_X_API_NO 43 | #define IS_AT_LEAST_PHP_55 ZEND_EXTENSION_API_NO >= PHP_5_5_X_API_NO 44 | 45 | #define IS_PHP_54 ZEND_EXTENSION_API_NO == PHP_5_4_X_API_NO 46 | #define IS_AT_LEAST_PHP_54 ZEND_EXTENSION_API_NO >= PHP_5_4_X_API_NO 47 | 48 | #define IS_PHP_53 ZEND_EXTENSION_API_NO == PHP_5_3_X_API_NO 49 | #define IS_AT_LEAST_PHP_53 ZEND_EXTENSION_API_NO >= PHP_5_3_X_API_NO 50 | 51 | #if IS_PHP_53 52 | #define object_properties_init(obj, ce) do { \ 53 | zend_hash_copy(obj->properties, &ce->default_properties, zval_copy_property_ctor(ce), NULL, sizeof(zval *)); \ 54 | } while (0); 55 | #endif 56 | 57 | #define ZEND_OBJ_INIT(obj, ce) do { \ 58 | zend_object_std_init(obj, ce TSRMLS_CC); \ 59 | object_properties_init((obj), (ce)); \ 60 | } while(0); 61 | 62 | #if IS_PHP_53 || IS_PHP_54 63 | static void zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos) { 64 | Bucket *p; 65 | 66 | p = pos ? (*pos) : ht->pInternalPointer; 67 | 68 | if (!p) { 69 | Z_TYPE_P(key) = IS_NULL; 70 | } else if (p->nKeyLength) { 71 | Z_TYPE_P(key) = IS_STRING; 72 | Z_STRVAL_P(key) = estrndup(p->arKey, p->nKeyLength - 1); 73 | Z_STRLEN_P(key) = p->nKeyLength - 1; 74 | } else { 75 | Z_TYPE_P(key) = IS_LONG; 76 | Z_LVAL_P(key) = p->h; 77 | } 78 | } 79 | #endif 80 | 81 | #endif /* PIMPLE_COMPAT_H_ */ 82 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test for read_dim/write_dim handlers 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 38 | 39 | --EXPECTF-- 40 | foo 41 | 42 42 | foo2 43 | foo99 44 | baz 45 | strstr -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test for constructor 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 'foo')); 11 | var_dump($p[42]); 12 | ?> 13 | --EXPECT-- 14 | NULL 15 | string(3) "foo" 16 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/003.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test empty dimensions 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 14 | --EXPECT-- 15 | int(42) 16 | string(3) "bar" -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/004.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test has/unset dim handlers 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 24 | --EXPECT-- 25 | int(42) 26 | NULL 27 | bool(true) 28 | bool(false) 29 | bool(true) 30 | bool(true) -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/005.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test simple class inheritance 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | someAttr; 23 | ?> 24 | --EXPECT-- 25 | string(3) "hit" 26 | foo 27 | fooAttr -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/006.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test complex class inheritance 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 'bar', 88 => 'baz'); 38 | 39 | $p = new TestPimple($defaultValues); 40 | $p[42] = 'foo'; 41 | var_dump($p[42]); 42 | var_dump($p[0]); 43 | ?> 44 | --EXPECT-- 45 | string(13) "hit offsetset" 46 | string(27) "hit offsetget in TestPimple" 47 | string(25) "hit offsetget in MyPimple" 48 | string(3) "foo" 49 | string(27) "hit offsetget in TestPimple" 50 | string(25) "hit offsetget in MyPimple" 51 | string(3) "baz" -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/007.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test for read_dim/write_dim handlers 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 20 | --EXPECTF-- 21 | foo 22 | 42 -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/008.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test frozen services 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 29 | --EXPECTF-- 30 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/009.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test service is called as callback, and only once 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 12 | --EXPECTF-- 13 | bool(true) -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/010.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test service is called as callback for every callback type 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 36 | --EXPECTF-- 37 | callme 38 | called 39 | Foo::bar 40 | array(2) { 41 | [0]=> 42 | string(3) "Foo" 43 | [1]=> 44 | string(3) "bar" 45 | } -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/011.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test service callback throwing an exception 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | 18 | --EXPECTF-- 19 | all right! -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/012.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test service factory 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | factory($f = function() { var_dump('called-1'); return 'ret-1';}); 11 | 12 | $p[] = $f; 13 | 14 | $p[] = function () { var_dump('called-2'); return 'ret-2'; }; 15 | 16 | var_dump($p[0]); 17 | var_dump($p[0]); 18 | var_dump($p[1]); 19 | var_dump($p[1]); 20 | ?> 21 | --EXPECTF-- 22 | string(8) "called-1" 23 | string(5) "ret-1" 24 | string(8) "called-1" 25 | string(5) "ret-1" 26 | string(8) "called-2" 27 | string(5) "ret-2" 28 | string(5) "ret-2" -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/013.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test keys() 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | keys()); 11 | 12 | $p['foo'] = 'bar'; 13 | $p[] = 'foo'; 14 | 15 | var_dump($p->keys()); 16 | 17 | unset($p['foo']); 18 | 19 | var_dump($p->keys()); 20 | ?> 21 | --EXPECTF-- 22 | array(0) { 23 | } 24 | array(2) { 25 | [0]=> 26 | string(3) "foo" 27 | [1]=> 28 | int(0) 29 | } 30 | array(1) { 31 | [0]=> 32 | int(0) 33 | } -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/014.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test raw() 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | raw('foo')); 16 | var_dump($p[42]); 17 | 18 | unset($p['foo']); 19 | 20 | try { 21 | $p->raw('foo'); 22 | echo "expected exception"; 23 | } catch (InvalidArgumentException $e) { } 24 | --EXPECTF-- 25 | string(8) "called-2" 26 | string(5) "ret-2" 27 | object(Closure)#%i (0) { 28 | } 29 | string(8) "called-2" 30 | string(5) "ret-2" -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/015.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test protect() 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | protect($f); 13 | 14 | var_dump($p['foo']); 15 | --EXPECTF-- 16 | object(Closure)#%i (0) { 17 | } -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/016.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test extend() 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | extend(12, function ($w) { var_dump($w); return 'bar'; }); /* $callable in code above */ 19 | 20 | var_dump($c('param')); 21 | --EXPECTF-- 22 | string(5) "param" 23 | string(3) "foo" 24 | string(3) "bar" -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/017.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test extend() with exception in service extension 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | extend(12, function ($w) { throw new BadMethodCallException; }); 12 | 13 | try { 14 | $p[12]; 15 | echo "Exception expected"; 16 | } catch (BadMethodCallException $e) { } 17 | --EXPECTF-- 18 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/017_1.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test extend() with exception in service factory 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | extend(12, function ($w) { return 'foobar'; }); 12 | 13 | try { 14 | $p[12]; 15 | echo "Exception expected"; 16 | } catch (BadMethodCallException $e) { } 17 | --EXPECTF-- 18 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/018.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test register() 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | register(new Foo, array(42 => 'bar')); 18 | 19 | var_dump($p[42]); 20 | --EXPECTF-- 21 | object(Pimple\Container)#1 (0) { 22 | } 23 | string(3) "bar" -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/019.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test register() returns static and is a fluent interface 3 | --SKIPIF-- 4 | 5 | --FILE-- 6 | register(new Foo)); 17 | --EXPECTF-- 18 | bool(true) 19 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/bench.phpb: -------------------------------------------------------------------------------- 1 | factory($factory); 42 | 43 | $p['factory'] = $factory; 44 | 45 | echo $p['factory']; 46 | echo $p['factory']; 47 | echo $p['factory']; 48 | 49 | } 50 | 51 | echo microtime(true) - $time; 52 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/ext/pimple/tests/bench_shared.phpb: -------------------------------------------------------------------------------- 1 | 26 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | ./src/Pimple/Tests 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php: -------------------------------------------------------------------------------- 1 | 35 | */ 36 | class ExpectedInvokableException extends \InvalidArgumentException implements ContainerExceptionInterface 37 | { 38 | } 39 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php: -------------------------------------------------------------------------------- 1 | 35 | */ 36 | class FrozenServiceException extends \RuntimeException implements ContainerExceptionInterface 37 | { 38 | /** 39 | * @param string $id Identifier of the frozen service 40 | */ 41 | public function __construct($id) 42 | { 43 | parent::__construct(\sprintf('Cannot override frozen service "%s".', $id)); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php: -------------------------------------------------------------------------------- 1 | 35 | */ 36 | class InvalidServiceIdentifierException extends \InvalidArgumentException implements NotFoundExceptionInterface 37 | { 38 | /** 39 | * @param string $id The invalid identifier 40 | */ 41 | public function __construct($id) 42 | { 43 | parent::__construct(\sprintf('Identifier "%s" does not contain an object definition.', $id)); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php: -------------------------------------------------------------------------------- 1 | 35 | */ 36 | class UnknownIdentifierException extends \InvalidArgumentException implements NotFoundExceptionInterface 37 | { 38 | /** 39 | * @param string $id The unknown identifier 40 | */ 41 | public function __construct($id) 42 | { 43 | parent::__construct(\sprintf('Identifier "%s" is not defined.', $id)); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Psr11/Container.php: -------------------------------------------------------------------------------- 1 | 36 | */ 37 | final class Container implements ContainerInterface 38 | { 39 | private $pimple; 40 | 41 | public function __construct(PimpleContainer $pimple) 42 | { 43 | $this->pimple = $pimple; 44 | } 45 | 46 | public function get($id) 47 | { 48 | return $this->pimple[$id]; 49 | } 50 | 51 | public function has($id) 52 | { 53 | return isset($this->pimple[$id]); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php: -------------------------------------------------------------------------------- 1 | 37 | */ 38 | class ServiceLocator implements ContainerInterface 39 | { 40 | private $container; 41 | private $aliases = array(); 42 | 43 | /** 44 | * @param PimpleContainer $container The Container instance used to locate services 45 | * @param array $ids Array of service ids that can be located. String keys can be used to define aliases 46 | */ 47 | public function __construct(PimpleContainer $container, array $ids) 48 | { 49 | $this->container = $container; 50 | 51 | foreach ($ids as $key => $id) { 52 | $this->aliases[\is_int($key) ? $id : $key] = $id; 53 | } 54 | } 55 | 56 | /** 57 | * {@inheritdoc} 58 | */ 59 | public function get($id) 60 | { 61 | if (!isset($this->aliases[$id])) { 62 | throw new UnknownIdentifierException($id); 63 | } 64 | 65 | return $this->container[$this->aliases[$id]]; 66 | } 67 | 68 | /** 69 | * {@inheritdoc} 70 | */ 71 | public function has($id) 72 | { 73 | return isset($this->aliases[$id]) && isset($this->container[$this->aliases[$id]]); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/ServiceIterator.php: -------------------------------------------------------------------------------- 1 | 33 | */ 34 | final class ServiceIterator implements \Iterator 35 | { 36 | private $container; 37 | private $ids; 38 | 39 | public function __construct(Container $container, array $ids) 40 | { 41 | $this->container = $container; 42 | $this->ids = $ids; 43 | } 44 | 45 | public function rewind() 46 | { 47 | \reset($this->ids); 48 | } 49 | 50 | public function current() 51 | { 52 | return $this->container[\current($this->ids)]; 53 | } 54 | 55 | public function key() 56 | { 57 | return \current($this->ids); 58 | } 59 | 60 | public function next() 61 | { 62 | \next($this->ids); 63 | } 64 | 65 | public function valid() 66 | { 67 | return null !== \key($this->ids); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php: -------------------------------------------------------------------------------- 1 | value = $value; 35 | 36 | return $service; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php: -------------------------------------------------------------------------------- 1 | factory(function () { 51 | return new Service(); 52 | }); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php: -------------------------------------------------------------------------------- 1 | 31 | */ 32 | class Service 33 | { 34 | public $value; 35 | } 36 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php: -------------------------------------------------------------------------------- 1 | 33 | */ 34 | class PimpleServiceProviderInterfaceTest extends \PHPUnit_Framework_TestCase 35 | { 36 | public function testProvider() 37 | { 38 | $pimple = new Container(); 39 | 40 | $pimpleServiceProvider = new Fixtures\PimpleServiceProvider(); 41 | $pimpleServiceProvider->register($pimple); 42 | 43 | $this->assertEquals('value', $pimple['param']); 44 | $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']); 45 | 46 | $serviceOne = $pimple['factory']; 47 | $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne); 48 | 49 | $serviceTwo = $pimple['factory']; 50 | $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo); 51 | 52 | $this->assertNotSame($serviceOne, $serviceTwo); 53 | } 54 | 55 | public function testProviderWithRegisterMethod() 56 | { 57 | $pimple = new Container(); 58 | 59 | $pimple->register(new Fixtures\PimpleServiceProvider(), array( 60 | 'anotherParameter' => 'anotherValue', 61 | )); 62 | 63 | $this->assertEquals('value', $pimple['param']); 64 | $this->assertEquals('anotherValue', $pimple['anotherParameter']); 65 | 66 | $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $pimple['service']); 67 | 68 | $serviceOne = $pimple['factory']; 69 | $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne); 70 | 71 | $serviceTwo = $pimple['factory']; 72 | $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceTwo); 73 | 74 | $this->assertNotSame($serviceOne, $serviceTwo); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php: -------------------------------------------------------------------------------- 1 | assertSame($pimple['service'], $psr->get('service')); 45 | } 46 | 47 | /** 48 | * @expectedException \Psr\Container\NotFoundExceptionInterface 49 | * @expectedExceptionMessage Identifier "service" is not defined. 50 | */ 51 | public function testGetThrowsExceptionIfServiceIsNotFound() 52 | { 53 | $pimple = new Container(); 54 | $psr = new PsrContainer($pimple); 55 | 56 | $psr->get('service'); 57 | } 58 | 59 | public function testHasReturnsTrueIfServiceExists() 60 | { 61 | $pimple = new Container(); 62 | $pimple['service'] = function () { 63 | return new Service(); 64 | }; 65 | $psr = new PsrContainer($pimple); 66 | 67 | $this->assertTrue($psr->has('service')); 68 | } 69 | 70 | public function testHasReturnsFalseIfServiceDoesNotExist() 71 | { 72 | $pimple = new Container(); 73 | $psr = new PsrContainer($pimple); 74 | 75 | $this->assertFalse($psr->has('service')); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php: -------------------------------------------------------------------------------- 1 | 38 | */ 39 | class ServiceLocatorTest extends TestCase 40 | { 41 | public function testCanAccessServices() 42 | { 43 | $pimple = new Container(); 44 | $pimple['service'] = function () { 45 | return new Fixtures\Service(); 46 | }; 47 | $locator = new ServiceLocator($pimple, array('service')); 48 | 49 | $this->assertSame($pimple['service'], $locator->get('service')); 50 | } 51 | 52 | public function testCanAccessAliasedServices() 53 | { 54 | $pimple = new Container(); 55 | $pimple['service'] = function () { 56 | return new Fixtures\Service(); 57 | }; 58 | $locator = new ServiceLocator($pimple, array('alias' => 'service')); 59 | 60 | $this->assertSame($pimple['service'], $locator->get('alias')); 61 | } 62 | 63 | /** 64 | * @expectedException \Pimple\Exception\UnknownIdentifierException 65 | * @expectedExceptionMessage Identifier "service" is not defined. 66 | */ 67 | public function testCannotAccessAliasedServiceUsingRealIdentifier() 68 | { 69 | $pimple = new Container(); 70 | $pimple['service'] = function () { 71 | return new Fixtures\Service(); 72 | }; 73 | $locator = new ServiceLocator($pimple, array('alias' => 'service')); 74 | 75 | $service = $locator->get('service'); 76 | } 77 | 78 | /** 79 | * @expectedException \Pimple\Exception\UnknownIdentifierException 80 | * @expectedExceptionMessage Identifier "foo" is not defined. 81 | */ 82 | public function testGetValidatesServiceCanBeLocated() 83 | { 84 | $pimple = new Container(); 85 | $pimple['service'] = function () { 86 | return new Fixtures\Service(); 87 | }; 88 | $locator = new ServiceLocator($pimple, array('alias' => 'service')); 89 | 90 | $service = $locator->get('foo'); 91 | } 92 | 93 | /** 94 | * @expectedException \Pimple\Exception\UnknownIdentifierException 95 | * @expectedExceptionMessage Identifier "invalid" is not defined. 96 | */ 97 | public function testGetValidatesTargetServiceExists() 98 | { 99 | $pimple = new Container(); 100 | $pimple['service'] = function () { 101 | return new Fixtures\Service(); 102 | }; 103 | $locator = new ServiceLocator($pimple, array('alias' => 'invalid')); 104 | 105 | $service = $locator->get('alias'); 106 | } 107 | 108 | public function testHasValidatesServiceCanBeLocated() 109 | { 110 | $pimple = new Container(); 111 | $pimple['service1'] = function () { 112 | return new Fixtures\Service(); 113 | }; 114 | $pimple['service2'] = function () { 115 | return new Fixtures\Service(); 116 | }; 117 | $locator = new ServiceLocator($pimple, array('service1')); 118 | 119 | $this->assertTrue($locator->has('service1')); 120 | $this->assertFalse($locator->has('service2')); 121 | } 122 | 123 | public function testHasChecksIfTargetServiceExists() 124 | { 125 | $pimple = new Container(); 126 | $pimple['service'] = function () { 127 | return new Fixtures\Service(); 128 | }; 129 | $locator = new ServiceLocator($pimple, array('foo' => 'service', 'bar' => 'invalid')); 130 | 131 | $this->assertTrue($locator->has('foo')); 132 | $this->assertFalse($locator->has('bar')); 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php: -------------------------------------------------------------------------------- 1 | assertSame(array('service1' => $pimple['service1'], 'service2' => $pimple['service2']), iterator_to_array($iterator)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /vendor/psr/container/.gitignore: -------------------------------------------------------------------------------- 1 | composer.lock 2 | composer.phar 3 | /vendor/ 4 | -------------------------------------------------------------------------------- /vendor/psr/container/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2016 container-interop 4 | Copyright (c) 2016 PHP Framework Interoperability Group 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | this software and associated documentation files (the "Software"), to deal in 8 | the Software without restriction, including without limitation the rights to 9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /vendor/psr/container/README.md: -------------------------------------------------------------------------------- 1 | # PSR Container 2 | 3 | This repository holds all interfaces/classes/traits related to [PSR-11](https://github.com/container-interop/fig-standards/blob/master/proposed/container.md). 4 | 5 | Note that this is not a container implementation of its own. See the specification for more details. 6 | -------------------------------------------------------------------------------- /vendor/psr/container/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "psr/container", 3 | "type": "library", 4 | "description": "Common Container Interface (PHP FIG PSR-11)", 5 | "keywords": ["psr", "psr-11", "container", "container-interop", "container-interface"], 6 | "homepage": "https://github.com/php-fig/container", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "PHP-FIG", 11 | "homepage": "http://www.php-fig.org/" 12 | } 13 | ], 14 | "require": { 15 | "php": ">=5.3.0" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "Psr\\Container\\": "src/" 20 | } 21 | }, 22 | "extra": { 23 | "branch-alias": { 24 | "dev-master": "1.0.x-dev" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vendor/psr/container/src/ContainerExceptionInterface.php: -------------------------------------------------------------------------------- 1 | =5.3.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Psr\\Http\\Message\\": "src/" 19 | } 20 | }, 21 | "extra": { 22 | "branch-alias": { 23 | "dev-master": "1.0.x-dev" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vendor/psr/http-message/src/ResponseInterface.php: -------------------------------------------------------------------------------- 1 | container = $container; 34 | } 35 | 36 | /** 37 | * Resolve toResolve into a closure so that the router can dispatch. 38 | * 39 | * If toResolve is of the format 'class:method', then try to extract 'class' 40 | * from the container otherwise instantiate it and then dispatch 'method'. 41 | * 42 | * @param mixed $toResolve 43 | * 44 | * @return callable 45 | * 46 | * @throws RuntimeException if the callable does not exist 47 | * @throws RuntimeException if the callable is not resolvable 48 | */ 49 | public function resolve($toResolve) 50 | { 51 | if (is_callable($toResolve)) { 52 | return $toResolve; 53 | } 54 | 55 | if (!is_string($toResolve)) { 56 | $this->assertCallable($toResolve); 57 | } 58 | 59 | // check for slim callable as "class:method" 60 | if (preg_match(self::CALLABLE_PATTERN, $toResolve, $matches)) { 61 | $resolved = $this->resolveCallable($matches[1], $matches[2]); 62 | $this->assertCallable($resolved); 63 | 64 | return $resolved; 65 | } 66 | 67 | $resolved = $this->resolveCallable($toResolve); 68 | $this->assertCallable($resolved); 69 | 70 | return $resolved; 71 | } 72 | 73 | /** 74 | * Check if string is something in the DIC 75 | * that's callable or is a class name which has an __invoke() method. 76 | * 77 | * @param string $class 78 | * @param string $method 79 | * @return callable 80 | * 81 | * @throws \RuntimeException if the callable does not exist 82 | */ 83 | protected function resolveCallable($class, $method = '__invoke') 84 | { 85 | if ($this->container->has($class)) { 86 | return [$this->container->get($class), $method]; 87 | } 88 | 89 | if (!class_exists($class)) { 90 | throw new RuntimeException(sprintf('Callable %s does not exist', $class)); 91 | } 92 | 93 | return [new $class($this->container), $method]; 94 | } 95 | 96 | /** 97 | * @param Callable $callable 98 | * 99 | * @throws \RuntimeException if the callable is not resolvable 100 | */ 101 | protected function assertCallable($callable) 102 | { 103 | if (!is_callable($callable)) { 104 | throw new RuntimeException(sprintf( 105 | '%s is not resolvable', 106 | is_array($callable) || is_object($callable) ? json_encode($callable) : $callable 107 | )); 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/CallableResolverAwareTrait.php: -------------------------------------------------------------------------------- 1 | container instanceof ContainerInterface) { 39 | return $callable; 40 | } 41 | 42 | /** @var CallableResolverInterface $resolver */ 43 | $resolver = $this->container->get('callableResolver'); 44 | 45 | return $resolver->resolve($callable); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/DeferredCallable.php: -------------------------------------------------------------------------------- 1 | callable = $callable; 31 | $this->container = $container; 32 | } 33 | 34 | public function __invoke() 35 | { 36 | $callable = $this->resolveCallable($this->callable); 37 | if ($callable instanceof Closure) { 38 | $callable = $callable->bindTo($this->container); 39 | } 40 | 41 | $args = func_get_args(); 42 | 43 | return call_user_func_array($callable, $args); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/Exception/ContainerException.php: -------------------------------------------------------------------------------- 1 | request = $request; 20 | parent::__construct(sprintf('Unsupported HTTP method "%s" provided', $method)); 21 | } 22 | 23 | public function getRequest() 24 | { 25 | return $this->request; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/Exception/MethodNotAllowedException.php: -------------------------------------------------------------------------------- 1 | allowedMethods = $allowedMethods; 34 | } 35 | 36 | /** 37 | * Get allowed methods 38 | * 39 | * @return string[] 40 | */ 41 | public function getAllowedMethods() 42 | { 43 | return $this->allowedMethods; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/Exception/NotFoundException.php: -------------------------------------------------------------------------------- 1 | request = $request; 47 | $this->response = $response; 48 | } 49 | 50 | /** 51 | * Get request 52 | * 53 | * @return ServerRequestInterface 54 | */ 55 | public function getRequest() 56 | { 57 | return $this->request; 58 | } 59 | 60 | /** 61 | * Get response 62 | * 63 | * @return ResponseInterface 64 | */ 65 | public function getResponse() 66 | { 67 | return $this->response; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/Handlers/AbstractError.php: -------------------------------------------------------------------------------- 1 | displayErrorDetails = (bool) $displayErrorDetails; 29 | } 30 | 31 | /** 32 | * Write to the error log if displayErrorDetails is false 33 | * 34 | * @param \Exception|\Throwable $throwable 35 | * 36 | * @return void 37 | */ 38 | protected function writeToErrorLog($throwable) 39 | { 40 | if ($this->displayErrorDetails) { 41 | return; 42 | } 43 | 44 | $message = 'Slim Application Error:' . PHP_EOL; 45 | $message .= $this->renderThrowableAsText($throwable); 46 | while ($throwable = $throwable->getPrevious()) { 47 | $message .= PHP_EOL . 'Previous error:' . PHP_EOL; 48 | $message .= $this->renderThrowableAsText($throwable); 49 | } 50 | 51 | $message .= PHP_EOL . 'View in rendered output by enabling the "displayErrorDetails" setting.' . PHP_EOL; 52 | 53 | $this->logError($message); 54 | } 55 | 56 | /** 57 | * Render error as Text. 58 | * 59 | * @param \Exception|\Throwable $throwable 60 | * 61 | * @return string 62 | */ 63 | protected function renderThrowableAsText($throwable) 64 | { 65 | $text = sprintf('Type: %s' . PHP_EOL, get_class($throwable)); 66 | 67 | if ($code = $throwable->getCode()) { 68 | $text .= sprintf('Code: %s' . PHP_EOL, $code); 69 | } 70 | 71 | if ($message = $throwable->getMessage()) { 72 | $text .= sprintf('Message: %s' . PHP_EOL, htmlentities($message)); 73 | } 74 | 75 | if ($file = $throwable->getFile()) { 76 | $text .= sprintf('File: %s' . PHP_EOL, $file); 77 | } 78 | 79 | if ($line = $throwable->getLine()) { 80 | $text .= sprintf('Line: %s' . PHP_EOL, $line); 81 | } 82 | 83 | if ($trace = $throwable->getTraceAsString()) { 84 | $text .= sprintf('Trace: %s', $trace); 85 | } 86 | 87 | return $text; 88 | } 89 | 90 | /** 91 | * Wraps the error_log function so that this can be easily tested 92 | * 93 | * @param $message 94 | */ 95 | protected function logError($message) 96 | { 97 | error_log($message); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/Handlers/AbstractHandler.php: -------------------------------------------------------------------------------- 1 | getHeaderLine('Accept'); 43 | $selectedContentTypes = array_intersect(explode(',', $acceptHeader), $this->knownContentTypes); 44 | 45 | if (count($selectedContentTypes)) { 46 | return current($selectedContentTypes); 47 | } 48 | 49 | // handle +json and +xml specially 50 | if (preg_match('/\+(json|xml)/', $acceptHeader, $matches)) { 51 | $mediaType = 'application/' . $matches[1]; 52 | if (in_array($mediaType, $this->knownContentTypes)) { 53 | return $mediaType; 54 | } 55 | } 56 | 57 | return 'text/html'; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/Handlers/NotAllowed.php: -------------------------------------------------------------------------------- 1 | getMethod() === 'OPTIONS') { 37 | $status = 200; 38 | $contentType = 'text/plain'; 39 | $output = $this->renderPlainOptionsMessage($methods); 40 | } else { 41 | $status = 405; 42 | $contentType = $this->determineContentType($request); 43 | switch ($contentType) { 44 | case 'application/json': 45 | $output = $this->renderJsonNotAllowedMessage($methods); 46 | break; 47 | 48 | case 'text/xml': 49 | case 'application/xml': 50 | $output = $this->renderXmlNotAllowedMessage($methods); 51 | break; 52 | 53 | case 'text/html': 54 | $output = $this->renderHtmlNotAllowedMessage($methods); 55 | break; 56 | default: 57 | throw new UnexpectedValueException('Cannot render unknown content type ' . $contentType); 58 | } 59 | } 60 | 61 | $body = new Body(fopen('php://temp', 'r+')); 62 | $body->write($output); 63 | $allow = implode(', ', $methods); 64 | 65 | return $response 66 | ->withStatus($status) 67 | ->withHeader('Content-type', $contentType) 68 | ->withHeader('Allow', $allow) 69 | ->withBody($body); 70 | } 71 | 72 | /** 73 | * Render PLAIN message for OPTIONS response 74 | * 75 | * @param array $methods 76 | * @return string 77 | */ 78 | protected function renderPlainOptionsMessage($methods) 79 | { 80 | $allow = implode(', ', $methods); 81 | 82 | return 'Allowed methods: ' . $allow; 83 | } 84 | 85 | /** 86 | * Render JSON not allowed message 87 | * 88 | * @param array $methods 89 | * @return string 90 | */ 91 | protected function renderJsonNotAllowedMessage($methods) 92 | { 93 | $allow = implode(', ', $methods); 94 | 95 | return '{"message":"Method not allowed. Must be one of: ' . $allow . '"}'; 96 | } 97 | 98 | /** 99 | * Render XML not allowed message 100 | * 101 | * @param array $methods 102 | * @return string 103 | */ 104 | protected function renderXmlNotAllowedMessage($methods) 105 | { 106 | $allow = implode(', ', $methods); 107 | 108 | return "Method not allowed. Must be one of: $allow"; 109 | } 110 | 111 | /** 112 | * Render HTML not allowed message 113 | * 114 | * @param array $methods 115 | * @return string 116 | */ 117 | protected function renderHtmlNotAllowedMessage($methods) 118 | { 119 | $allow = implode(', ', $methods); 120 | $output = << 122 | 123 | Method not allowed 124 | 137 | 138 | 139 |

Method not allowed

140 |

Method not allowed. Must be one of: $allow

141 | 142 | 143 | END; 144 | 145 | return $output; 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/Handlers/NotFound.php: -------------------------------------------------------------------------------- 1 | getMethod() === 'OPTIONS') { 36 | $contentType = 'text/plain'; 37 | $output = $this->renderPlainNotFoundOutput(); 38 | } else { 39 | $contentType = $this->determineContentType($request); 40 | switch ($contentType) { 41 | case 'application/json': 42 | $output = $this->renderJsonNotFoundOutput(); 43 | break; 44 | 45 | case 'text/xml': 46 | case 'application/xml': 47 | $output = $this->renderXmlNotFoundOutput(); 48 | break; 49 | 50 | case 'text/html': 51 | $output = $this->renderHtmlNotFoundOutput($request); 52 | break; 53 | 54 | default: 55 | throw new UnexpectedValueException('Cannot render unknown content type ' . $contentType); 56 | } 57 | } 58 | 59 | $body = new Body(fopen('php://temp', 'r+')); 60 | $body->write($output); 61 | 62 | return $response->withStatus(404) 63 | ->withHeader('Content-Type', $contentType) 64 | ->withBody($body); 65 | } 66 | 67 | /** 68 | * Render plain not found message 69 | * 70 | * @return ResponseInterface 71 | */ 72 | protected function renderPlainNotFoundOutput() 73 | { 74 | return 'Not found'; 75 | } 76 | 77 | /** 78 | * Return a response for application/json content not found 79 | * 80 | * @return ResponseInterface 81 | */ 82 | protected function renderJsonNotFoundOutput() 83 | { 84 | return '{"message":"Not found"}'; 85 | } 86 | 87 | /** 88 | * Return a response for xml content not found 89 | * 90 | * @return ResponseInterface 91 | */ 92 | protected function renderXmlNotFoundOutput() 93 | { 94 | return 'Not found'; 95 | } 96 | 97 | /** 98 | * Return a response for text/html content not found 99 | * 100 | * @param ServerRequestInterface $request The most recent Request object 101 | * 102 | * @return ResponseInterface 103 | */ 104 | protected function renderHtmlNotFoundOutput(ServerRequestInterface $request) 105 | { 106 | $homeUrl = (string)($request->getUri()->withPath('')->withQuery('')->withFragment('')); 107 | return << 109 | 110 | Page Not Found 111 | 128 | 129 | 130 |

Page Not Found

131 |

132 | The page you are looking for could not be found. Check the address bar 133 | to ensure your URL is spelled correctly. If all else fails, you can 134 | visit our home page at the link below. 135 |

136 | Visit the Home Page 137 | 138 | 139 | END; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php: -------------------------------------------------------------------------------- 1 | $v) { 38 | $request = $request->withAttribute($k, $v); 39 | } 40 | 41 | return call_user_func($callable, $request, $response, $routeArguments); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/Handlers/Strategies/RequestResponseArgs.php: -------------------------------------------------------------------------------- 1 | 'HTTP/1.1', 44 | 'REQUEST_METHOD' => 'GET', 45 | 'REQUEST_SCHEME' => $defscheme, 46 | 'SCRIPT_NAME' => '', 47 | 'REQUEST_URI' => '', 48 | 'QUERY_STRING' => '', 49 | 'SERVER_NAME' => 'localhost', 50 | 'SERVER_PORT' => $defport, 51 | 'HTTP_HOST' => 'localhost', 52 | 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 53 | 'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8', 54 | 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 55 | 'HTTP_USER_AGENT' => 'Slim Framework', 56 | 'REMOTE_ADDR' => '127.0.0.1', 57 | 'REQUEST_TIME' => time(), 58 | 'REQUEST_TIME_FLOAT' => microtime(true), 59 | ], $userData); 60 | 61 | return new static($data); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/Http/RequestBody.php: -------------------------------------------------------------------------------- 1 | middlewareLock) { 56 | throw new RuntimeException('Middleware can’t be added once the stack is dequeuing'); 57 | } 58 | 59 | if (is_null($this->tip)) { 60 | $this->seedMiddlewareStack(); 61 | } 62 | $next = $this->tip; 63 | $this->tip = function ( 64 | ServerRequestInterface $request, 65 | ResponseInterface $response 66 | ) use ( 67 | $callable, 68 | $next 69 | ) { 70 | $result = call_user_func($callable, $request, $response, $next); 71 | if ($result instanceof ResponseInterface === false) { 72 | throw new UnexpectedValueException( 73 | 'Middleware must return instance of \Psr\Http\Message\ResponseInterface' 74 | ); 75 | } 76 | 77 | return $result; 78 | }; 79 | 80 | return $this; 81 | } 82 | 83 | /** 84 | * Seed middleware stack with first callable 85 | * 86 | * @param callable $kernel The last item to run as middleware 87 | * 88 | * @throws RuntimeException if the stack is seeded more than once 89 | */ 90 | protected function seedMiddlewareStack(callable $kernel = null) 91 | { 92 | if (!is_null($this->tip)) { 93 | throw new RuntimeException('MiddlewareStack can only be seeded once.'); 94 | } 95 | if ($kernel === null) { 96 | $kernel = $this; 97 | } 98 | $this->tip = $kernel; 99 | } 100 | 101 | /** 102 | * Call middleware stack 103 | * 104 | * @param ServerRequestInterface $request A request object 105 | * @param ResponseInterface $response A response object 106 | * 107 | * @return ResponseInterface 108 | */ 109 | public function callMiddlewareStack(ServerRequestInterface $request, ResponseInterface $response) 110 | { 111 | if (is_null($this->tip)) { 112 | $this->seedMiddlewareStack(); 113 | } 114 | /** @var callable $start */ 115 | $start = $this->tip; 116 | $this->middlewareLock = true; 117 | $response = $start($request, $response); 118 | $this->middlewareLock = false; 119 | return $response; 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/Routable.php: -------------------------------------------------------------------------------- 1 | middleware; 59 | } 60 | 61 | /** 62 | * Get the route pattern 63 | * 64 | * @return string 65 | */ 66 | public function getPattern() 67 | { 68 | return $this->pattern; 69 | } 70 | 71 | /** 72 | * Set container for use with resolveCallable 73 | * 74 | * @param ContainerInterface $container 75 | * 76 | * @return self 77 | */ 78 | public function setContainer(ContainerInterface $container) 79 | { 80 | $this->container = $container; 81 | return $this; 82 | } 83 | 84 | /** 85 | * Prepend middleware to the middleware collection 86 | * 87 | * @param callable|string $callable The callback routine 88 | * 89 | * @return static 90 | */ 91 | public function add($callable) 92 | { 93 | $this->middleware[] = new DeferredCallable($callable, $this->container); 94 | return $this; 95 | } 96 | 97 | /** 98 | * Set the route pattern 99 | * 100 | * @param string $newPattern 101 | */ 102 | public function setPattern($newPattern) 103 | { 104 | $this->pattern = $newPattern; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /vendor/slim/slim/Slim/RouteGroup.php: -------------------------------------------------------------------------------- 1 | pattern = $pattern; 30 | $this->callable = $callable; 31 | } 32 | 33 | /** 34 | * Invoke the group to register any Routable objects within it. 35 | * 36 | * @param App $app The App instance to bind/pass to the group callable 37 | */ 38 | public function __invoke(App $app = null) 39 | { 40 | $callable = $this->resolveCallable($this->callable); 41 | if ($callable instanceof Closure && $app !== null) { 42 | $callable = $callable->bindTo($app); 43 | } 44 | 45 | $callable($app); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /vendor/slim/slim/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "slim/slim", 3 | "type": "library", 4 | "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", 5 | "keywords": ["framework","micro","api","router"], 6 | "homepage": "https://slimframework.com", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Josh Lockhart", 11 | "email": "hello@joshlockhart.com", 12 | "homepage": "https://joshlockhart.com" 13 | }, 14 | { 15 | "name": "Andrew Smith", 16 | "email": "a.smith@silentworks.co.uk", 17 | "homepage": "http://silentworks.co.uk" 18 | }, 19 | { 20 | "name": "Rob Allen", 21 | "email": "rob@akrabat.com", 22 | "homepage": "http://akrabat.com" 23 | }, 24 | { 25 | "name": "Gabriel Manricks", 26 | "email": "gmanricks@me.com", 27 | "homepage": "http://gabrielmanricks.com" 28 | } 29 | ], 30 | "require": { 31 | "php": ">=5.5.0", 32 | "pimple/pimple": "^3.0", 33 | "psr/http-message": "^1.0", 34 | "nikic/fast-route": "^1.0", 35 | "container-interop/container-interop": "^1.2", 36 | "psr/container": "^1.0" 37 | }, 38 | "require-dev": { 39 | "squizlabs/php_codesniffer": "^2.5", 40 | "phpunit/phpunit": "^4.0" 41 | }, 42 | "provide": { 43 | "psr/http-message-implementation": "1.0" 44 | }, 45 | "autoload": { 46 | "psr-4": { 47 | "Slim\\": "Slim" 48 | } 49 | }, 50 | "scripts": { 51 | "test": [ 52 | "@phpunit", 53 | "@phpcs" 54 | ], 55 | "phpunit": "php vendor/bin/phpunit", 56 | "phpcs": "php vendor/bin/phpcs" 57 | } 58 | } 59 | --------------------------------------------------------------------------------